ESP32 DPORT access mitigation without IDF funtions

Daniel wrote 01/03/2021 at 14:56 0 points

Hi everyone,

I wanted to implement a dynamically loaded module for micropython on ESP32, that requires access to the DPORT registers which control the clock gating for the peripherals. Since there is no atomic bit set / clear instruction, this requires mutual exclusion. Problem with these modules is that I don't have access to the IDF / OS, therefore I can't just call the appropriate function. I want to avoid doing this without any mitigation, since it could cause undesired side effects. The usual workaround would be to disable the interrupts for this, but since its a dual-core its not that easy.

Does anyone have a solution for this?