ESP32 External Interrupt with functions SPI

fran748
Posts: 3
Joined: Wed Feb 17, 2021 5:26 pm

ESP32 External Interrupt with functions SPI

Postby fran748 » Wed Mar 03, 2021 7:49 pm

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.

ESP_Sprite
Posts: 9730
Joined: Thu Nov 26, 2015 4:08 am

Re: ESP32 External Interrupt with functions SPI

Postby ESP_Sprite » Thu Mar 04, 2021 2:07 am

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.

Who is online

Users browsing this forum: julcol and 49 guests