On Sun, 2012-01-08 at 12:34 +0100, antonio rosa wrote:
> Hi Antonio,
> 
> I've been reading your response and analyzing the component ADXL345P.
> Specifically, to initialize the accelerometer, if databuf [0]
> corresponds to  ADXL345_THRES_TAP  register (depending on the
> component datasheet), databuff [1] corresponds to the  OFSX  register
> (address 0x1E), then databuff [16] should be   for POWER_CTL BW_RATE
> register and not as shown on the driver, so I still do not understand
> the order used in the driver. 

You are reading it wrong... 

databuf[0] = ADXL345_THRESH_TAP;
databuf[1] = 0x40; //ADXL345_THRESH_TAP
databuf[2] = 0x0;  //ADXL345_OFSX
databuf[3] = 0x0;  //ADXL345_OFSY

databuf[0] corresponds to the address of the first register (0x1D), then
databuf[1] corresponds to the value passed to that register (THRESH_TAP)
and so on (register 0x1E - ADXL345_OFSX - gets the value of databuf[2],
etc).  As we are passing multiple values to configurate the sensor the
first byte of databuf indicates the initial register to write in, and
then we tell the driver the number of register we want to write in
starting from the one in databuf[0], the actual number of bytes writen
is 18 bytes so we indicate a buffer of 19 including the address of the
first register.

e = call I2CBasicAddr.write((I2C_START | I2C_STOP), ADXL345_ADDRESS, 19,
databuf);

> On the other hand, why do  you use as a management device address  #
> define ADXL345_ADDRESS 0x53?

If you read the datasheet, you will see:

"An alternate I2C address of 0x53 (followed by the R/W bit)
can be chosen by grounding the ALT ADDRESS pin (Pin 12)".

Regards,


> Thanks.
> 
> 
> 2011/12/30 Antonio Liñán C. <ali...@zolertia.com>
>         Sorry for the delayed response, I'm on vacations :)
>         
>         I believe it's set up that way because in databuff[0] the
>         address of the
>         first register is passed (0x1D) and from there the next
>         registers (0x1E,
>         0x1F...) are configured with the following corresponding
>         values stated
>         in databuf[1-18].
>         
>         Regards, happy holidays!
>         
>         Antonio.
>         
>         On Tue, 2011-12-27 at 21:02 +0100, antonio rosa wrote:
>         > Hi to all,
>         >
>         > I'm using the driver ADLX345 provides by Zolertia and I have
>         a
>         > question. Them you  granted the resource I2C and you are in
>         the case
>         > ADXLCMD_START,
>         > why you fill the two first positions of databuf  with a
>         value that
>         > refering to the same register THRES HOLD TAP (I don't know
>         if the
>         > databuf[1] is for THRESH_TAP or OffsetX). Can you  help me,
>         please ?
>         > databuf[0] = ADXL345_THRESH_TAP;
>         > databuf[1] = 0x40;                    //ADXL345_THRESH_TAP
>         >
>         >
>         >
>         >
>         >
>         >
>         >
>         >
>         >
>         >
>         >
>         >
>         >
>         
>         > _______________________________________________
>         > Tinyos-help mailing list
>         > Tinyos-help@millennium.berkeley.edu
>         >
>         
> https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
>         
>         
> 


_______________________________________________
Tinyos-help mailing list
Tinyos-help@millennium.berkeley.edu
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to