currently I'm trying to assign a High Level Interrupt (ESP-IDF) to a GPIO Interrupt (positive edge). For this I read the information on https://docs.espressif.com/projects/esp ... rupts.html first.
My main question: How can I assign the external GPIO interrupt e.g. to GPIO PIN 4 to the high level interrupt in assembler ?
I have performed the following steps:
Step 1:
A file with the extension .S created: "my_hint.S" with the following content:
Code: Select all
#Include <xtensa/coreasm.h>
#include <xtensa/corebits.h>
#include <xtensa/config/system.h>
#include "freertos/xtensa_context.h"
#include "esp_panic.h"
#include "sdkconfig.h"
#include "soc/soc.h"
#include "soc/dport_reg.h"
.section .iram1, "ax"
.global xt_highint5
.type xt_highint5,@function
.align 4
xt_highint5:
jx a1 %This intentionally generates a crash to see if the interrupt handler is running.
;nop
rsr a0, EXCSAVE_5
rfi 5
.global ld_include_highint_hdl
ld_include_highint_hdl:
In the components.mk file under COMPONENT_ADD_LDFLAGS I added the assembler file via the symbol "ld_include_highint_hdl". When compiling the program the assembler file is linked and compiled.
Step 3:
My main.c looks like this:
Code: Select all
const gpio_num_t gpio_intr_pin = GPIO_NUM_4;
void app_main(){
gpio_config_t gpio_intr={
.intr_type=GPIO_INTR_POSEDGE,
.pin_bit_mask=(1ULL<<<gpio_intr_pin),
.mode=GPIO_MODE_INPUT,
.pull_up_en=GPIO_PULLUP_DISABLE,
.pull_down_en=GPIO_PULLDOWN_DISABLE,
};
ESP_ERROR_CHECK(gpio_config(&gpio_intr));
gpio_install_isr_service(ESP_INTR_FLAG_HIGH);
intr_matrix_set(0, ETS_GPIO_INTR_SOURCE, gpio_intr_pin);
esp_intr_alloc(ETS_GPIO_INTR_SOURCE,(int)ESP_INTR_FLAG_HIGH,NULL,NULL,&gpio_intr_handle);
ESP_INTR_ENABLE(gpio_intr_pin);
}
Thanks a lot !
Best regards,
opcode_x64
Translated with www.DeepL.com/Translator