Disable All Interrupts
Posted: Fri Aug 06, 2021 10:46 am
Hello,
I wish to disable my custom interrupts for parts of the code. The scenario is this:
I use the ESP32 as an RC flight controller. It monitors 6 GPIO pins for PWM signals from the receiver using interrupt routines to measure the length of the pulses (1-2ms). 2 of those pins are GPIO 36 and 39. These are pulled low for 80ns when the ESP32 queries the battery voltage using the ADC. This issue is documented here
https://www.espressif.com/sites/default ... p32_en.pdf
in section 3.11 and the given workaround is "ignore input from GPIO36 and GPIO39." The 80ns are enough to consistently trigger undesirable interrupts on PWM pulses, splitting ordinary pulses into 2 short ones. It's not possible to dismiss these measurements out of hand because one of them might still be inside the valid 1-2ms range.
Using the Arduino routines noInterrupts(); and interrupts(); around the ADC measurement has no effect. Detaching the interrupts and reattaching leads to somewhat better results, but also seems to disturb the pulse measurement for unclear reasons and is also fairly slow (~50 µs).
Please do not suggest I use different GPIO pins. I use every single pin on the ESP32 for something or other and if I don't have this problem in the PWM monitoring I would have it somewhere else.
I wish to disable my custom interrupts for parts of the code. The scenario is this:
I use the ESP32 as an RC flight controller. It monitors 6 GPIO pins for PWM signals from the receiver using interrupt routines to measure the length of the pulses (1-2ms). 2 of those pins are GPIO 36 and 39. These are pulled low for 80ns when the ESP32 queries the battery voltage using the ADC. This issue is documented here
https://www.espressif.com/sites/default ... p32_en.pdf
in section 3.11 and the given workaround is "ignore input from GPIO36 and GPIO39." The 80ns are enough to consistently trigger undesirable interrupts on PWM pulses, splitting ordinary pulses into 2 short ones. It's not possible to dismiss these measurements out of hand because one of them might still be inside the valid 1-2ms range.
Using the Arduino routines noInterrupts(); and interrupts(); around the ADC measurement has no effect. Detaching the interrupts and reattaching leads to somewhat better results, but also seems to disturb the pulse measurement for unclear reasons and is also fairly slow (~50 µs).
Please do not suggest I use different GPIO pins. I use every single pin on the ESP32 for something or other and if I don't have this problem in the PWM monitoring I would have it somewhere else.