-
Notifications
You must be signed in to change notification settings - Fork 7.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
turning off interrupts doesn't work #832
Comments
Not sure why you get compilation errors (I am on PlatformIO using the staging version of arduino-esp32), but I use Here is the modified readSensor() function:
|
I got errors because the docs I saw say portENTER_CRITICAL() doesn't take an argument. If I use your format, I can make everything work nicely by using that for sei()/cli() in Arduino.h. I'll make a pull request. |
This issue is closed, because it looks as if it is not a bug or problem with the ESP32 Arduino core or its support libraries. For general API usage questions or help on specific coding challenges, please visit the arduino-esp32 Gitter channel. If you feel this issue was closed in error, reopen it and comment, why you think this is a bug in the Arduino-Core. |
The following code shows that disabling interrupts is not implemented for this platform:
https://github.com/espressif/arduino-esp32/blob/master/cores/esp32/Arduino.h#L83
This is causing problems for me because I'm trying to read a DHT22 temperature sensor. The library contains a critical section (https://github.com/adafruit/DHT-sensor-library/blob/master/DHT.cpp#L149) where it needs to measure the length of high and low pulses on a digital input pin. Interrupts going off throw off the measurement. I've modified the code to watch timers instead of counting cycles (adafruit/DHT-sensor-library#93), but I still see a 5-10% failure rate.
It looks like FreeRTOS has functions to use in critical sections: http://www.freertos.org/taskENTER_CRITICAL_taskEXIT_CRITICAL.html. Using those macros leads to compilation errors. Is it possible to use FreeRTOS functions from Arduino code?
This all may be related to #811
The text was updated successfully, but these errors were encountered: