- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
Solved! Go to Solution.
- Labels:
-
PSoC 5LP
- Tags:
- i2c
- i2c master
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
Rakshith M B
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
Rakshith M B