Implementation of Interrupt Allocation
Posted: Mon Jul 06, 2020 11:12 pm
Hello! I'm looking to use the IRQ line for an ADC to trigger the next read in a scan mode and recently had my programming help quit and I am unsure what I should do from where I am.
I have the adc working well in single shot and continuous mode and behaving within the operating parameters of the datasheet.
They were attempting to use the following code to config the interrupt
and the following code to attempt to wait for read:
[Codebox]
void start_scan(){
fast_command(FAST_ADC_START);
// vTalkDelay(50 / portTICK_PERIOD_MS); // delay then read works
gpio_isr_handler_add(GPIO_IRQ, gpio_isr_handler, (void*) GPIO_IRQ);
read_from_register(REG_ADCDATA,4);
}[/Codebox]
this results in crash of the esp32s2 I am using. I am trying to solve the issue myself but part of what appears to be going on is that there is https://docs.espressif.com/projects/esp ... alloc.html and I am unsure of what parts to use for this as others. Everything is working very well in single shot and continuous mode but scan mode needs the irq that I haven't have the knowledge of how to implement.
any advice on how to setup this interrupt so that when the irq goes low again, it will trigger the read?
I have the adc working well in single shot and continuous mode and behaving within the operating parameters of the datasheet.
They were attempting to use the following code to config the interrupt
- void config_interrupt(){
- gpio_config_t io_conf;
- io_conf.itr_type = GPIO_PIN_INTR_NEGEDGE;
- io_conf.pin_bit_mask = GPIO_INPUT_PIN_SEL;
- io.conf.mode = GPIO_MODE_INPUT;
- gpio_install_isr_service(ESP_INTR_FLAG_DEFAULT);
- }
[Codebox]
void start_scan(){
fast_command(FAST_ADC_START);
// vTalkDelay(50 / portTICK_PERIOD_MS); // delay then read works
gpio_isr_handler_add(GPIO_IRQ, gpio_isr_handler, (void*) GPIO_IRQ);
read_from_register(REG_ADCDATA,4);
}[/Codebox]
this results in crash of the esp32s2 I am using. I am trying to solve the issue myself but part of what appears to be going on is that there is https://docs.espressif.com/projects/esp ... alloc.html and I am unsure of what parts to use for this as others. Everything is working very well in single shot and continuous mode but scan mode needs the irq that I haven't have the knowledge of how to implement.
any advice on how to setup this interrupt so that when the irq goes low again, it will trigger the read?