Page 1 of 1

gpio interrupt fail after wifi enable

Posted: Sun Mar 03, 2019 10:47 am
by edwardpangct
I'm new to ESP32-IDF.
I wrote a DHT11 driver using GPIO interrupt for edge timing measurement. ANYEDGE interrupt occurs every 25us, 54us, or 70us, and esp_timer_get_time is used in interrupt to time data.
After 80 ISR done, Interrupt is disable, and my code starts to process the timing data in a FreeRTOS task handler.
This parts works well in expectation.

HOWEVER, after I turning on WIFI, i cannot get 80 interrupts anymore (maybe even none of it).
I tried to assign CPU 1 to driver task with xTaskCreatePinnedToCore, but no luck.
any suggestion to debug? any best practice to use ESP32-IDF?

Re: gpio interrupt fail after wifi enable

Posted: Sun Mar 03, 2019 1:07 pm
by ESP_igrr
Are you also registering GPIO interrupt on CPU1, or on CPU0? If you are enabling the interrupt from CPU0, then interrupt timing may be affected by Wi-Fi interrupt.

Aside from that, you may get much better results if you use RMT peripheral instead of GPIO. RMT can record pulse durations into memory, and trigger an interrupt only after the end of the pulse train. See for example https://github.com/bertmelis/esp32DHT.

Re: gpio interrupt fail after wifi enable

Posted: Mon Mar 11, 2019 2:43 am
by edwardpangct
Thx, referring to your suggested RMT audrino driver example, I port it to ESP-IDF with some modificaiton. It works fine now.