I’m working on a project with Mongoose OS and trying to achieve temporal dithering with the WS2812B LEDs .
Everything is working using the
mgos_set_hw_timer function (running at about 500Hz) but I noticed that sometimes (especially when there is a lot of network traffic) the function hangs for ~1/2 uS and this disrupts the ws2812b bit-banging causing flashes of color on the LED strip. This has been confirmed by using a logic analyzer: the timing gets completely disrupted.
Futher info: the ESP32 runs at 240MHz, the bit-banging part takes ~300uS to complete.
I’ve tried to enclose the function
taskENTER_CRITICAL_ISR(&mux); as well as raising the interrupt handler level but without luck. I also tried to pin the hw timer to the core
0 but then the glitches were even more.
mgos_unlock caused a core dump.
Is there a way to actually make a block of code running in ISR context actually uninterruptible?