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.
Disable All Interrupts
Re: Disable All Interrupts
Hi fnord_disc,
If you are using Arduino-esp32 core with versions 1.0.6, 2.0.0-rc1, or the latest "master" branch, there is another workaround for the GPIO glitch issue that doesn't involve disabling the interrupts.
You can call adc_power_acquire function in the "setup" of your sketch. It will force the ADC module to be on, eliminating the glitches occurring due to ADC being enabled or disabled.
If you are using Arduino-esp32 core with versions 1.0.6, 2.0.0-rc1, or the latest "master" branch, there is another workaround for the GPIO glitch issue that doesn't involve disabling the interrupts.
You can call adc_power_acquire function in the "setup" of your sketch. It will force the ADC module to be on, eliminating the glitches occurring due to ADC being enabled or disabled.
Code: Select all
#include "driver/adc.h"
void setup()
{
adc_power_acquire();
}
-
- Posts: 2
- Joined: Fri Aug 06, 2021 10:25 am
Re: Disable All Interrupts
Thank you very much! That solution works perfectly.
Who is online
Users browsing this forum: No registered users and 75 guests