Page 1 of 1

ESP32 External Interrupt with functions SPI

Posted: Wed Mar 03, 2021 7:49 pm
by fran748
Hello.
I have a question. I am developing a project that consists of obtaining the values from the ADE9000 through the spi bus, to process this information with the ESP32 and upload the data to server. I am using the Arduino IDE.
The problem lies in when it occurs an event such as voltage dip and swell. The ADE9000 activates a pin of the ESP32, this produces an interrupt. But to disable this interrupt and get what kind of event has occurs poduced and its value, I need to read and write to a specific register through the spi bus. Therefore I need to use spi transfers inside the interrupt routine.
I want to know what problems this method causes and what solutions I can implement.
I have seen that the people have used binary sempahore, but I want to design a program without operating system based on tasks.

Re: ESP32 External Interrupt with functions SPI

Posted: Thu Mar 04, 2021 2:07 am
by ESP_Sprite
You're using an operating system anyway: Arduino is built on ESP-IDF, which is built on FreeRTOS. The other alternative would be to set a volatile variable in the interrupt, then check for that in your main loop and do the SPI transfer.