Skip to content

turning off interrupts doesn't work #832

Closed
@rtwfroody

Description

@rtwfroody

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

#define sei()
#define cli()
#define interrupts() sei()
#define noInterrupts() cli()

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions