FXAS21002's WHO_AM_I is 0

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

FXAS21002's WHO_AM_I is 0

Jump to solution
3,643 Views
sunnytan
Contributor I

    I connect one CortexM4 board with FXAS21002 on FRDM-STBC-AGM01 by I2C.

    Slave address 0x20 is used because SA0=0 is pull-down.. When read register WHO_AM_I(0x0c),0 is returned. Analyzed with oscilloscope, the I2C communication works well. 0 is sent from slave side.

    When read register (INT_SOURCE_FLAG)0x0B, it is also 0.

    Why? Do I need to configure additional parameters? How to make it works? Thanks very much.

Pseudo code : I2CMasterTransmit(SlaveAddress 0x20, RegisterAddress 0x0C)

                        I2CMasterReceive(SlaveAddress 0x20)

Pin: MCU SCL <-> FRDM-STBC-AGM01 SCL

       MCU SDA <-> FRDM-STBC-AGM01 SDA

       MCU VDD <-> FRDM-STBC-AGM01 VDD

       MCU GND <-> FRDM-STBC-AGM01 GND

0 Kudos
Reply
1 Solution
2,904 Views
TomasVaverka
NXP TechSupport
NXP TechSupport

Hi Sunny,

Please review carefully your I2C traffic. A very common problem during the read operation is that some customers send the stop condition (a LOW to HIGH transition of SDA while SCL is HIGH) instead of sending the repeated start condition after the second byte (0x0C), so please double check it.

Best regards,

Tomas

View solution in original post

7 Replies
2,904 Views
TomasVaverka
NXP TechSupport
NXP TechSupport

Hi Sunny,

If you have an oscilloscope or a logic analyzer, can you please post here a plot illustrating what is going on on the bus when you read the WHO_AM_I register?

You should see something like this:

FXAS21002 WHO_AM_I Read.JPG

The transaction looks as follows:

 

1. Send a start sequence

2. Send 0x40      // FXAS21002 slave address with the R/W bit low or 0x20 << 1

3. Send 0x0C

4. Send a start sequence again (repeated start)

5. Send 0x41      // FXAS21002 slave address with the R/W bit high or (0x20 << 1) | 0x01

6. Read the data byte from WHO_AM_I register

7. Send NAK and the stop sequence

I hope it helps.

Best regards,

Tomas

0 Kudos
Reply
2,907 Views
sunnytan
Contributor I

Hi Tomas,

   Thank you for replay.

   I am sorry, I can't upload the picture in our company. but I used the oscilloscope to analyze, The oscillogram is different from your, my oscillogram is as following:

pastedImage_3.png

l am looking forward to your reply. 

Thank you very much.

  Best regards,

  Sunny 

0 Kudos
Reply
2,905 Views
TomasVaverka
NXP TechSupport
NXP TechSupport

Hi Sunny,

Please review carefully your I2C traffic. A very common problem during the read operation is that some customers send the stop condition (a LOW to HIGH transition of SDA while SCL is HIGH) instead of sending the repeated start condition after the second byte (0x0C), so please double check it.

Best regards,

Tomas

2,907 Views
sunnytan
Contributor I

Hi Tomas,

   I need your help. thank you very much.

   I used the Rate threshold interrupt model for FXAS21002C, I keep  shaking the sensor, the first period of data is correct, after a while, the data is all 0.

   Why? Do I need to configure additional parameters? How to make it works? 

 

Pseudo code :

         1. init FXAS21002C,configure the register:

               Write(0x20, CTRL_REG1, 0x40); 
               DelayMs(1);

 

               Write(0x20, RT_THS, 0x05);  // Set threshold to 96 dps
               Write(0x20, RT_COUNT, 0x0A); // 1/DDR * 10 *1000 ms
               Write(0x20, RT_CFG, 0x07);

               Write(0x20, CTRL_REG0, 0x03); 
                Write(0x20, CTRL_REG2, 0x30);     // Rate threshold interrupt enabled and routed to INT1
                Write(0x20, CTRL_REG1, 0x02);    // ODR = 800Hz, Active mode 

      2.Shaking the sensor, callback fuction for interrupt signal, read the data from the gyroscope's register.

      3. the first period of data is correct, after a while, the data is all 0.

                     

Pins: MCU SCL <-> FRDM-STBC-AGM01 SCL

         MCU SDA <-> FRDM-STBC-AGM01 SDA

         MCU VDD <-> FRDM-STBC-AGM01 VDD

         MCU GND <-> FRDM-STBC-AGM01 GND

         MCU GPIO <-> FRDM-STBC-AGM01 INT1-21002

0 Kudos
Reply
2,907 Views
TomasVaverka
NXP TechSupport
NXP TechSupport

Hi Sunny,

Take a closer look at my example code and try to reproduce it.

If the problem still persists, get back to me and I will take a deeper look at your settings.

Best regards,

Tomas

0 Kudos
Reply
2,907 Views
sunnytan
Contributor I

Hi Tomas,

   I used your example code, but the problem still persists, and I found the real-time is very bad.

I also found when the value of RT_SRC_REG( Read(0x20, RT_SRC_REG) ) is 0x00, the data is 0 and it can't recover.

 

0 Kudos
Reply
2,907 Views
sunnytan
Contributor I

Hi Tomas,

   Thank you very much.

   you are right, I have solved the problem.

Best regards,

Sunny

0 Kudos
Reply