Hey all, long time no post. Which is a great indicator that Particle has been a secondary thought for me as a developer for some time (things “just work”).
Finally found a reason to post - there is documentation lacking around the various i2c errors that the Wire library throws. For example when I get i2c errors type 6, I go to particle Wire library reference docs to see what that error means, but when I go there I see that error code 6 in not documented:
So I cloned the Particle OS repo, downloaded the STM32F2x5 Reference Manual, and got to work:
Here’s what I found in \hal\src\stm32f2xx\i2c_hal.c
Return value of 6 from Wire.endTransmission() is caused by timeout error in i2c_hal.c. After writing STOP bit, wait for timeout_ms for hardware to clear stop bit (i2c peripheral clears stop bit on Stop condition detection). See screenshot of Particle OS source code.