esp-idf/examples/system/nmi_isr
Omar Chebib 928859307f fix(esp_hw_support): make the NMI interrupts available for the main application
Closes https://github.com/espressif/esp-idf/issues/13629

NMI interrupt level has been freed for all the Xtensa targets, making it possible
for the main application to use it. An example has been added to show how to
proceed.
2024-08-29 13:55:47 +08:00
..
main fix(esp_hw_support): make the NMI interrupts available for the main application 2024-08-29 13:55:47 +08:00
CMakeLists.txt fix(esp_hw_support): make the NMI interrupts available for the main application 2024-08-29 13:55:47 +08:00
pytest_nmi_isr.py fix(esp_hw_support): make the NMI interrupts available for the main application 2024-08-29 13:55:47 +08:00
README.md fix(esp_hw_support): make the NMI interrupts available for the main application 2024-08-29 13:55:47 +08:00
sdkconfig.defaults fix(esp_hw_support): make the NMI interrupts available for the main application 2024-08-29 13:55:47 +08:00

Supported Targets ESP32 ESP32-S2 ESP32-S3

NMI ISR Example

This example demonstrates how to allocate and use non-maskable interrupt (NMI) on Xtensa-based targets. The asm_funcs.S file contains the ISR that will be run on the core that installed the NMI. The callback should be fairly simple and must be entirely written in assembly.

Defining an NMI handler can be done by defining a routine named xt_nmi. That routine will be called via call0 instruction, as such, before returning from the ISR, the return address register, a0, must be restored thanks to the instruction:

rsr a0, EXCSAVE + XCHAL_NMILEVEL

How to use example

Hardware Required

Example can run on any Xtensa-based ESP32 development board. Since the example uses GPIO19 as a bi-directional pin, make sure not to connect it to anything.

Configure the project

No particular configuration is required to run this example, the default one is suitable.

Build and Flash

idf.py build flash monitor

(To exit the serial monitor, type Ctrl-].)

See the Getting Started Guide for full steps to configure and use ESP-IDF to build projects.

Example output

example: Start
example: Success