I'm working on a robot, with an raspberry Pi 3 as I2C master and 8 Atmega328P (the same as on the Uno boards, with bootloader) as I2C slaves.
At the beggining, everything works fine, but over the time, the different Arduinos start to hang. As far as I understand (and have seen on another project wit only one arduino as slave and a Jetson as master), the wire.h library has some infinite loops, waiting for some events that according to the I2C protocol are sure to happen. However, if there is some noise/too long cables/... , it can happen that at some point the protocol is not respected, and instead of getting a single failure, the Arduino enters into an infinite loop.
I have found several I2C master libraries that address this issue by adding timeouts for all loops. But I haven't found one for I2C slaves : do you know one?
Thanks a lot in advance
PS : on this project, I have about 20cm wires, but passing near motors, so it might explain to get sometimes an error (maybe once each 10 minute for a given arduino). I'm planning to reduce wire length in future when replacing the prototypes PCBs by a manufactured one acting as a shield for the Pi, but that isn't planned for the next few months (I have a lot of things I want to test before ordering the PCBs)