Diracx
Diracx

Reputation: 101

Problem in receiving data from BNO085 over I2C interfaced with SAMD21

I have interfaced BNO085 with SAMD21G18A controller via I2C synchronous communication running at 100KHz on SERCOM1 of controller and processor is running at 8MHz. I am trying to read Gyroscope and Accelerometer's data using SHTP protocol (reference manual). which the sensor employs.

Here's how I am doing the I2C initialization:

    i2c_m_sync_get_io_descriptor(&SYS_I2C_BUS, &io);
    i2c_m_sync_enable(&SYS_I2C_BUS);
    i2c_m_sync_set_slaveaddr(&SYS_I2C_BUS, I2C_Address_of.IMU_BNO, I2C_M_SEVEN); //Address = 0x68

When I try to receive data, I always get the following packet:

enter image description here

From this reference manual, we can see that it is an advertisement channel of BNO085, It confirms that the communication is established with the controller. I tried soft resetting BNO085 using

    shtpData[0] = 1;
    BNO085_send_packet(CHANNEL_EXECUTABLE, 1);  //CHANNEL_EXECUTABLE = 1, size = 1

and I have turned the mode to 'ON' to take it out of sleep mode using

    shtpData[0] = 2; 
    BNO085_send_packet(CHANNEL_EXECUTABLE, 1);  //CHANNEL_EXECUTABLE = 1, size = 1

When I try to read the Product_ID report using SHTP_REPORT_PRODUCT_ID_REQUEST(0xf9) I do not receive anything of the data rather the same thing as the above image.

Here's a link of my I2C probing using logic analyser-> Waveforms

What am I missing and how to read the correct data from BNO085?

Upvotes: 1

Views: 308

Answers (1)

CHUN WEI CHOU
CHUN WEI CHOU

Reputation: 1

I faced the same problem recently, the steps below may solve,

  1. Read out advertisement completely messages one time, the reference manual indicates all the other command will not work before read out advertisement.(sh2_open in sh2, will read out all message)(Ensure that your i2c read command read all cargo)
  2. Use device on command to startup internal sensor.(sh2_devOn in sh2)

Hope these steps would help.

Upvotes: 0

Related Questions