gpio interrupt fail after wifi enable

edwardpangct
Posts: 3
Joined: Sun Mar 03, 2019 10:32 am

gpio interrupt fail after wifi enable

Postby edwardpangct » Sun Mar 03, 2019 10:47 am

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?

ESP_igrr
Posts: 2067
Joined: Tue Dec 01, 2015 8:37 am

Re: gpio interrupt fail after wifi enable

Postby ESP_igrr » Sun Mar 03, 2019 1:07 pm

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.

edwardpangct
Posts: 3
Joined: Sun Mar 03, 2019 10:32 am

Re: gpio interrupt fail after wifi enable

Postby edwardpangct » Mon Mar 11, 2019 2:43 am

Thx, referring to your suggested RMT audrino driver example, I port it to ESP-IDF with some modificaiton. It works fine now.

Who is online

Users browsing this forum: Majestic-12 [Bot] and 104 guests