I am attempting to hook up two Adafruit M0 Feathers (SAMD cores) together to communicate over I2C and share information for a spaceflight application. Normal processor operation is going well, however I would like to make the setup more robust with the ability for one processor to recognize if the other has stalled, crashed, or is stuck anywhere in its operation. Currently, it's on a deadman switch where any time they successfully communicate, the reset timer is set back to zero and if it ever exceeds some time, the other core is reset.
I would like to be able to create runtime exceptions on demand (attached to an interrupt pin) to test this in a real situation, is this possible on an Arduino? Initial testing hasn't had any luck as the complier catches most things and the rest don't cause exceptions.
In addition, I use the Wire.request() function for the master to request data from the slave. If the slave core is in a infinite loop ( while(1); ), the master seems to freeze inside that function. Any idea why?
I am linking two Adafruit M0 Feathers for a spacecraft application over I2C to share information in a Master/Slave setup. I am trying to write code such that the master core can recognize if the slave is stuck in an infinite loop or crashed with a dead-man timer, ie: No successful communication for 20 sec -> reset the slave. When I attempt to request data when I2C isn't connected, it successful recognizes this and proceeds with the rest of the code.
However, the problem is when if the slave core is put in an infinite loop (on purpose for testing) the Wire.request() function stalls and waits for the slave to respond. Is there way to prevent this blocking or put a manual timeout in? Also any explanation of exactly how Wire.request works would be helpful.
Can you do anything with watchdog timer on the ATSAMD21G18 to make it restart if it gets stuck ?
To force a crash in an interrupt service routine, can you try to hide an indirect divide by zero operation from the compiler ?