Setting up high level interrupt with Arduio core

OSCPUDEV
Posts: 20
Joined: Fri Jun 23, 2023 7:02 pm

Setting up high level interrupt with Arduio core

Postby OSCPUDEV » Thu Jul 13, 2023 5:55 pm

Does anyone have any information on how to setup a high level interrupt (int 5) with the Arduino IDE? I have seen code for the ESP-IDF, but nothing that allows you to actually point to an interrupt handler (ISR). I need to be able to attach/detach different interrupt code for the same function. I know that level 5 interrupts have to be done in assembly... that is not a problem. I know you can include the assembly (*.S file) as a file along with the project (a tab) and that does get included/assembled with the project. It might even be replacing the weak casting of xt_highint (something you have to specifically add at compile time for the ESP-IDF), but I need the ability change what ISR is used and AttachInterrupt/DeteachInterrupt does not work with high level interrupts (level 5/NMI).

Thanks!

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

Re: Setting up high level interrupt with Arduio core

Postby ESP_igrr » Fri Jul 14, 2023 2:45 pm

You can try to store the pointer to the actual interrupt handler (implemented in assembly) in a variable. Then in the interrupt entry point, save some registers onto the stack, load the pointer to the actual handler from the variable, and jump to that handler.

OSCPUDEV
Posts: 20
Joined: Fri Jun 23, 2023 7:02 pm

Re: Setting up high level interrupt with Arduio core

Postby OSCPUDEV » Sat Jul 15, 2023 9:22 am

I am not able to make the high level int actually work at all using the Arduino core files. I have tried including a basic assembly stub as a .S file and although memory free during the compile shows that the .S file was included, setting up the int with esp_intr_alloc() does seem to work. I have no issues using the ESP-IDF functions (in the Arduino environment) with level 1-3 int setup. Trying level 4/5/6/7 results in the ESP32 crashing (per the documentation warning). I was really hoping that I could just use something like gpio_install_isr_service(ESP_INTR_FLAG_LEVEL5); and point the interrupt code to a block of assembly, but that also crashes (or is ignored, depending on the exact setup).

Who is online

Users browsing this forum: No registered users and 66 guests