I am trying to write a firmata sysex command that allows for the CM3L to be turned off by the MCU for a period of time. The code is based on
balena-fin-coprocessor-firmata and can be found on this branch here.
How it works
When a Firmata sysex command is sent with type
0x0F, the MCU will wait for a period of time before cutting power to the CM3L by clearing
GPIO PF5 (PW_ON_3V3). The MCU will then further wait for a period of time before reapplying the power to the CM3L. These times are configurable via the sysex command itself.
With the code I can successfully cut power to the CM3L via the MCU, but the CM3L will immediately boot back up again, instead of remaining off for a period of time.
Here is a list of things that I have tried:
- Removing non-core routines in the main loop (commented out ADC, digital) -> no effect
- Testing the powersave FSM separately -> FSM works as it should in
- Comment out GPIO commands that turn the CM3L off -> CM3L and MCU stay on and work like normal
- Created a noop systemresethandler -> no effect
- Shutdown the CM3L using
shutdown -h nowvia ssh -> CM3L no longer accepts ssh connections (indicating the CM3L is off)
- Putting an infinite loop immediately after turning the CM3L off -> CM3L powers off then immediately comes back on and MCU is not reachable via firmata (indicating the MCU stuck in infinite loop despite CM3L reset)
Is this something related to the MCU or related to the hardware? I have tried to look through the schematics and the firmware code to find why such a reset might happen but I am now stuck as to what to try next.