The problems of FXOS8700C on FRDM-STBC-AGM01

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

The problems of FXOS8700C on FRDM-STBC-AGM01

1,309 Views
sunnytan
Contributor I

Hi,all

   Please help me, Thank you very much.

   I connect one CortexM4 board with FXAS21002 and FXOS8700C on FRDM-STBC-AGM01 by I2C, I used the same I2C(Pin: I2C-SCL1/I2C-SDA1).

   I initializad FXAS21002 and FXOS8700C at the same time. I used the yourexample code.

Problem 1:

   FXAS21002 reades the value of WHO_AM_I(0x0C) is successful, and FXOS8700C reades the value of WHO_AM_I(0x0D) is successful. then Closed the devices. The second,the values of WHO_AM_I was readed, but FXAS21002 is successful and FXOS8700C is failed(The value is 0x00), why?

Problem 2:

     I readed the valus of accelerometer are all 0x00, why?

   

0 Kudos
2 Replies

759 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 the bus?

What exactly do you mean by "then Closed the devices"?

How did you initialize the FXOS8700CQ and how do you read the accel/mag data (polling/interrupt)?

As for the example code, I believe this one is more suitable.

Best regards,

Tomas

0 Kudos

759 Views
sunnytan
Contributor I

Hi,Tomas

   Thank you.

   1."Closed the devices" means Disconnect the I2C.

   2. I used the polling model.

  Pseudo code :

         main()

         {

                  initI2C();

                  initFXAS21002();

                  initFXOS8700C();   

                  while(1)

                   {

                          ReadAccelData();

                          ReadMagData();

                   }

         }

 initFXOS8700C()

{
   uint8_t wmi = 0xff;

   wmi = Single_Read(FXOS8700_ADDR, FXOS8700_WHO_AM_I);
   kprintf("FXOS8700 WMI = %02x\n", wmi);
   if (wmi != 0xC7)
   {
      return -1;

   }

   Single_Write(FXOS8700_ADDR, FXOS8700_CTRL_REG2, 0x40);
   DelayMs(1);

   Single_Write(FXOS8700_ADDR, M_CTRL_REG1, 0x1F); // Hybrid mode (accelerometer + magnetometer), max OSR
   Single_Write(FXOS8700_ADDR, M_CTRL_REG2, 0x20); // M_OUT_X_MSB register 0x33 follows the OUT_Z_LSB                                                                                                 // register 0x06 (used for burst read)
   Single_Write(FXOS8700_ADDR, XYZ_DATA_CFG_REG, 0x00); // +/-2g range with 0.244mg/LSB
   Single_Write(FXOS8700_ADDR, FXOS8700_CTRL_REG1, 0x0D); // ODR = 200Hz, low noise, Active mode

   return 0;
}

 ReadAccelData()

{

   uint8_t BUF[6] = {0,};

   BUF[0] = Single_Read(FXOS8700_ADDR, FXOS8700_OUT_X_MSB_REG); // Read data output registers 0x01-0x06
   BUF[1] = Single_Read(FXOS8700_ADDR, FXOS8700_OUT_X_LSB_REG); // Read data output registers 0x01-0x06
   BUF[2] = Single_Read(FXOS8700_ADDR, FXOS8700_OUT_Y_MSB_REG); // Read data output registers 0x01-0x06
   BUF[3] = Single_Read(FXOS8700_ADDR, FXOS8700_OUT_Y_LSB_REG); // Read data output registers 0x01-0x06
   BUF[4] = Single_Read(FXOS8700_ADDR, FXOS8700_OUT_Z_MSB_REG); // Read data output registers 0x01-0x06
   BUF[5] = Single_Read(FXOS8700_ADDR, FXOS8700_OUT_Z_LSB_REG); // Read data output registers 0x01-0x06

   for(int i=0;i<6; i++)
      kprintf("FXOS8700 Acc.: BUF[%d]-->%02x\n",i,BUF[i]);

}

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

I am looking forward to your reply, Thank you very much

0 Kudos