Having a hard time Starting I2C Communication with BNO080

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.
AmCi_3754291
Level 2
Level 2

I'm having a hard time beginning a communication sequence between the PSOC and a BNO080 IMU.

I've created a send_packet function based on what the BNO datasheet says is supposed to happen, however all I've been able to observe on the scope is both the SCL line and SDL line going low.

This is my send packet function:

//BNO080 FUNCTIONS

void BNO080_sendPacket(uint8_t channelNumber, uint8_t dataLength) {

    UART_PutString("Beginning of send Packet sequence\n");

    uint8_t packetLength = dataLength+4; // adding the 4 header bytes

    //debugging tool

    char Buff[20];

    sprintf(Buff,"d=%d\n", packetLength);

   

    I2C_MasterSendStart(IMU_Address, I2C_WRITE_XFER_MODE);

    I2C_MasterWriteByte(packetLength);

    UART_PutString("First write command sent\n");

    I2C_MasterWriteByte(packetLength >> 8);

    UART_PutString("Second write command sent\n");

    I2C_MasterWriteByte(channelNumber);

    UART_PutString("Third write command sent\n");

    I2C_MasterWriteByte(sequenceNumber[channelNumber]++);

   

    //Sending the User's data packet

    for (uint8_t i=0; i < dataLength; i++){

        I2C_MasterWriteByte(shtpData);

    }

    I2C_MasterSendStop();

    UART_PutString("Packet sent\n");

I've attached my current code the relevant components are the BNO080.c and main.c!

Let me know if anything is unclear.

Thanks for your help

Amilcar

0 Likes
1 Solution
Rakshith
Moderator
Moderator
Moderator
250 likes received 1000 replies posted 750 replies posted

Hi AmCi_3754291

Please change the drive modes of the I2C pins in your project to 'Open Drain Drives Low' and also ensure that you have connected an external pull up resistor (2k - 10k) for both SDA and SCL lines. This might fix your issue.

To answer your question regarding separating KitProg and PSoC, yes, you can use a MiniProg to program your device instead of the KitProg.

Update: Drive mode of I2C pin should be 'Open Drain Drives Low'

Thanks and Regards,

Rakshith M B

Thanks and Regards,
Rakshith M B

View solution in original post

0 Likes
5 Replies
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

Can you please post your complete project so that we all can have a look at all of your settings. To do so, use

Creator->File->Create Workspace Bundle (minimal)

and attach the resulting file. Are you using a CY8CKIT-059 or something different?

Bob

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

Here's my full project right now

0 Likes

Confirm that the I2C address of BNO is 0x4b and not 0x4a.

Most of the APIs (except those for reading a byte) return a status byte which, when non-zero indicate an error condition. Start checking that at Beginning with the SendStart() API

Bob

0 Likes

The address is set to 0x4B! I've found 2 other issues that have taken me a few steps closer:

1. My logic converter was misbehaving: since I'm using the Kitprog to program and view my UART output [5V logic] and the BNO is 3.3V logic I was using a logic converter that wasn't behaving properly-- Question is there a way of separating the kitprog from the actual PSOC and continue to be able to program it? I tried plugging in directly from the microUSB on the kit and that didn't work

2. I2C_MasterWriteByte() and I2C_MasterReadByte() don't wait until transfers are complete! So I added a few 100 ms delays sprinkled around my functions.

Now I am able to reach the end of the start sequence. However, I'm still not getting the data on my monitor.

Inching closer though!

Thanks for your response Bob

Amilcar

0 Likes
Rakshith
Moderator
Moderator
Moderator
250 likes received 1000 replies posted 750 replies posted

Hi AmCi_3754291

Please change the drive modes of the I2C pins in your project to 'Open Drain Drives Low' and also ensure that you have connected an external pull up resistor (2k - 10k) for both SDA and SCL lines. This might fix your issue.

To answer your question regarding separating KitProg and PSoC, yes, you can use a MiniProg to program your device instead of the KitProg.

Update: Drive mode of I2C pin should be 'Open Drain Drives Low'

Thanks and Regards,

Rakshith M B

Thanks and Regards,
Rakshith M B
0 Likes