ArduinoCore-mbed
ArduinoCore-mbed copied to clipboard
Portenta H7 I2C broken on 4.0.2
Apparently something weird happened with 4.0.2 update in I2C communication. I have a Portenta H7 (bootloader v24) with a Max31343 RTC on I2C channel 1.
This example sketch from AnalogRTCLibrary https://github.com/MaximIntegrated/AnalogRTCLibrary/blob/master/examples/MAX31343/Time/Time.ino gives different results when running on 3.5.4
2021-11-24 15:10:01
2021-11-24 15:10:02
2021-11-24 15:10:03
2021-11-24 15:10:04
2021-11-24 15:10:05
2021-11-24 15:10:06
2021-11-24 15:10:07
2021-11-24 15:10:08
2021-11-24 15:10:09
and on 4.0.2
2001-04-00 00:00:00
2003-04-00 00:00:00
2004-04-00 00:00:00
2005-04-00 00:00:00
2006-04-00 00:00:00
2007-04-00 00:00:00
2008-04-00 00:00:00
2009-04-00 00:00:00
2010-04-00 00:00:00
Modifying the library to request 6 more registers (13 total starting from 0x06) I can see that the excepted values are returned but shifted.
0 0 0 2 64 4 0 18 21 1 36 17 33
The valid values start from position 6, so apparently the RTC is replying to a read request starting from position 0x00.
I rewrote the same sketch without any library (Wire nor AnalogRTCLib) and interacting with the Max using mbed::I2C class but the results are the same. It seems to me that something is going bad with the first i2c write.
Probably it's not related to the latest commit on this repository, i tried to build the Arduino Core againts mbed 6.16.0 and everything looks good. Could be related to some of the modifications made on mbed-os, maybe this one? https://github.com/ARMmbed/mbed-os/pull/15350/files#diff-c089370afba7dd06d88671e4103a3edace9c88d8cd07c318275c5bfa9378a8e2
Probably has been fixed on mbed https://github.com/ARMmbed/mbed-os/commit/65f45cd38351f5356d9c2f6e2b775f814a7a3f9a will give a try building on mbed master branch and will you some feedback
apparently the issue has been fixed by that commit, here you can find the core built on latest mbed master https://github.com/ARMmbed/mbed-os/commit/d0ca14e4fe58c6e7096392d70edc9fd2a0d320ae
i keep the issue open just for reference, but feel free to close