Closed hideakitai closed 2 years ago
That looks like a bug as the repeated start condition is not sent. I need to find some time to look into this in more detail and remind myself of what is supposed to happen.
Can you please post a code snippet showing how you call the SoftWire constructor and setup the RX and TX buffers?
Nice logic traces - what did you use to capture them?
Thank you for the reply. I'm using the following setups.
// in the global scope
SoftWire sw(SDA, SCL);
char swTxBuffer[64];
char swRxBuffer[64];
// in the setup()
sw.setTxBuffer(swTxBuffer, sizeof(swTxBuffer));
sw.setRxBuffer(swRxBuffer, sizeof(swRxBuffer));
sw.setDelay_us(5);
sw.begin();
The entire code is here, and you can reproduce the problem by activating this line instead of the next one.
I'm using Logic Pro 16. It's a super easy and useful one :)
I finally found the time to investigate this properly. I believe it is fixed in v2.0.8. I wasn't able to test with the same I2C device as you, so I used a Microchip MCP79410 real-time clock. This is the logic analyzer trace obtained by writing to and then reading from that device.
I was encountering a similar problem with 2.0.7 getting the WHO_AM_I register from an NXP FXOS8700 sensor, and after applying this patch my problem has been fixed. Thanks for fixing this.
I was encountering a similar problem with 2.0.7 getting the WHO_AM_I register from an NXP FXOS8700 sensor, and after applying this patch my problem has been fixed. Thanks for fixing this.
Thanks for reporting - I'll close this issue now I have confirmation it is fixed.
Hi, thank you for the great work. I was trying to read the data with a restart condition like this.
A correct transaction with the
Wire
library looks like this.But it seems that a restart condition is not issued with
SoftWire
. The hardware setup and code are exactly the same except for the use ofSoftWire
instead ofWire
.I've forced to use
repeatedStart
instead ofstart
in Line 449 ofSoftWire.h
. Then I could issue a restart condition but the data was not correct.Do you have any idea to work around this issue?