Understanding Errors

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
lock attach
Attachments are accessible only for community members.
rbtics
Level 1
Level 1
10 sign-ins 5 replies posted 5 sign-ins

I am relatively new to coding and I am trying to write a bus write and bus read function for my BNO055 Sensor. While debugging, I am getting these error codes for my I2CMasterSendStart and I2CMasterWriteByte functions but I don't understand what they mean. Could anyone guide me to understanding these errors and how I should fix them? 

0 Likes
1 Solution
DheerajK_81
Moderator
Moderator
Moderator
First comment on KBA First comment on blog 5 questions asked

Hello @rbtics ,

If you intended to do a bus write, but you are seeing a bus read, it could be because you passed the wrong parameter to the imu_bn055_I2CMasterSendStart(uint32 slaveAddress, uint32 bitRnW, uint32 timeoutMs) function. 

Note that the second parameter of this function is used to define the transfer direction. Use the following values depending on the transfer:

  • For write: imu_bn055_I2C_WRITE_XFER_MODE
  • For read: imu_bn055_I2C_READ_XFER_MODE

Hope with this change, you are able to move forward 🙂

Regards,
Dheeraj

View solution in original post

0 Likes
6 Replies
DheerajK_81
Moderator
Moderator
Moderator
First comment on KBA First comment on blog 5 questions asked

Hello @rbtics ,

The error code that you see for I2CMasterSendStart can be decoded by placing a breakpoint inside imu_bn055_I2CMasterHandleStatus function and debugging it. imu_bn055_I2CMasterSendStart calls this function to handle the error status codes. Let me know what error code you see so that I can help you debug it further. 

The error code 0x04 that you see because of imu_bn055_I2CMasterWriteByte indicates that the Master was not ready. You can find all the error codes in imu_bn055_I2C.h file. 

DheerajK_81_0-1619415744352.png


Hope this helps 🙂

Regards,
Dheeraj

0 Likes
lock attach
Attachments are accessible only for community members.

Hi, 

Thanks for your previous reply. I tried to debug that function but still got the same error for the MasterSendStart Function which I am confused about because it doesn't correspond to any of the errors

0 Likes
DheerajK_81
Moderator
Moderator
Moderator
First comment on KBA First comment on blog 5 questions asked

Hello @rbtics ,

It does correspond to the error codes. In the imu_bn055_I2CMasterHandleStatus function, you will notice this line of code (highlighted in yellow):

DheerajK_81_0-1619617999977.png

And this is what it corresponds to:

DheerajK_81_1-1619618043119.png


The error code you see is 2147483648 i.e 0x8000_0000 or (0x01 << 31). So, basically, you are seeing a timeout when you are interacting with your sensor.

Please check the connections, the device address and probably try probing the I2C lines to see if you are seeing the right waveforms. 

Let me know your observations. 

Regards,
Dheeraj

 

0 Likes

Thank you for your suggestion. Unfortunately, I will not have access to an oscilloscope for a few days. But once I do, I will check the connections to make sure that there is a signal and update you on this. 

0 Likes

I was able to connect to a picoscope and got some data. I noticed that the data sent is for the bus read instead of the bus write. Do you know what could be going wrong in this?Screenshot (118).png

0 Likes
DheerajK_81
Moderator
Moderator
Moderator
First comment on KBA First comment on blog 5 questions asked

Hello @rbtics ,

If you intended to do a bus write, but you are seeing a bus read, it could be because you passed the wrong parameter to the imu_bn055_I2CMasterSendStart(uint32 slaveAddress, uint32 bitRnW, uint32 timeoutMs) function. 

Note that the second parameter of this function is used to define the transfer direction. Use the following values depending on the transfer:

  • For write: imu_bn055_I2C_WRITE_XFER_MODE
  • For read: imu_bn055_I2C_READ_XFER_MODE

Hope with this change, you are able to move forward 🙂

Regards,
Dheeraj

0 Likes