juergenpabel / HAL9000

Personal voice assistant based on kalliope with HAL9000 enclosure
GNU General Public License v3.0
39 stars 2 forks source link

arduino firmware: random crashes/freezes on RP2040 when running MCP23X17 task on 2nd core #2

Open juergenpabel opened 3 weeks ago

juergenpabel commented 3 weeks ago

The arduino firmware crashes/freezes randomly (only) when run on RP2040 with the MCP23X17 running as a task on the 2nd core (works without issues on ESP32). I have already analyzed for potential causes but didn't come up with a reasonable explanation, so for now I am assuming some issue in the arduino-pico runtime; until I can identify the cause this issue is meant to document the process (and if it does indeed turn out to be an issue in arduino-pico, I will open an issue there and link here).

As a workaround I disabled task creation for RP2040 firmwares (see Microcontroller::task_create() in enclosure/firmware/arduino/src/device/microcontroller/rp2040.cpp) and regular checking of MCP23X17 states is invoked from loop()).

juergenpabel commented 2 weeks ago

OK, so the issue seems to be that (for RP2040 only):

So a working workaround is (for RP2040) to switch over to (non-recursive) mutex - due to code changes recursiveness isn't relevant anymore anyhow, so I might just remove recursiveness alltogether.

juergenpabel commented 2 weeks ago

support for recursive mutexes removed

juergenpabel commented 1 week ago

Reopened as crashes/freezes still occur...randomly