This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Part Number: MSP432P401R
Hi,
We have an I2C bus where there are 2 devices. Let's call them device A and device B(MSP432). The communication between the 2 is as follows:
1) to begin, B is a slave on the I2C and A will be the I2C master.
2) A does an I2C write to B.
3) B will switch to I2C master. A will switch to I2C slave.
4) B does an I2C write to A.
and the steps start all over again.
This works most of the time, but occasionally there is a corrupt transaction on the bus. On further analysis, I found that the MSP is holding the SCL line low for an extended period of time after it has received a message from A. I initially thought this was clock stretching, but the MSP is holding the SCL low after it has completely received the data.
I changed the flow to something like this:
1) to begin, B is a slave on the I2C and A will be the I2C master.
2) A does an I2C write to B.
3) B will switch to I2C master. A will switch to I2C slave.
4) On B: while(is_bus_free(i2c));
5) B does an I2C write to A.
With the addition of the while condition, the communication works without any issues. There are no failures after overnight runs. The questions I have are:
1) Why would MSP hold the SCL line low after receiving the message?
2) Is while(is_bus_free(i2c)); ok? Is there a condition when this while loop will never exit? Meaning the bus will be bus forever and thus the fw stuck here for ever.
Thanks,
Bhargav
**Attention** This is a public forum