Parallel Out I2S with DMA Interrupts
Posted: Mon Jan 21, 2019 1:04 pm
Hello,
I'm using the I2S driver to output in 16-bit parallel mode with two buffer to allow nonstop transmission, my aim is to use the I2S_OUT_DONE_INT_RAW interrupt to call a function which updates the buffer that has just been output via DMA, meanwhile the second buffer will be output via dma, until the done interrupt is called allowing me to refill the buffer and so on.
I'm having trouble getting my interrupt setup correctly the program will run but my interrupt is never called, I have verified that the parallel I2S is working with a logic analyzer.
Please can you take a look at the code I'm using to setup the interrupt and spot any issues with it?
Useful topics for using I2S parallel output:
https://www.esp32.com/viewtopic.php?f=13&t=3256
https://www.esp32.com/viewtopic.php?f=17&t=3188
https://github.com/har-in-air/ESP32-LCD-I2S
Useful I2S Interrupt Example:
https://github.com/nkolban/esp32-snippe ... ls/I2S.cpp
Thanks,
Will
I'm using the I2S driver to output in 16-bit parallel mode with two buffer to allow nonstop transmission, my aim is to use the I2S_OUT_DONE_INT_RAW interrupt to call a function which updates the buffer that has just been output via DMA, meanwhile the second buffer will be output via dma, until the done interrupt is called allowing me to refill the buffer and so on.
I'm having trouble getting my interrupt setup correctly the program will run but my interrupt is never called, I have verified that the parallel I2S is working with a logic analyzer.
Please can you take a look at the code I'm using to setup the interrupt and spot any issues with it?
Code: Select all
static intr_handle_t my_interrupt_handle;
static void IRAM_ATTR dmaInt(void* arg) {
printf("Buffer Transferred");
//Code to fill buffer that was just transferred.
}
void app_main()
{
//Other code to setup the I2S
I2S1.int_clr.val = I2S1.int_raw.val;
I2S1.int_ena.val = 0;
I2S1.int_ena.out_done = 1; //Maybe I2S_OUT_DONE_INT_RAW
//Setup I2S DMA Interrupt
esp_err_t err = esp_intr_alloc(
ETS_I2S1_INTR_SOURCE,
ESP_INTR_FLAG_INTRDISABLED | ESP_INTR_FLAG_LEVEL1 | ESP_INTR_FLAG_IRAM,
&dmaInt,
NULL,
&my_interrupt_handle
);
//Enable the Interrupt
ESP_ERROR_CHECK(esp_intr_enable(my_interrupt_handle));
}
https://www.esp32.com/viewtopic.php?f=13&t=3256
https://www.esp32.com/viewtopic.php?f=17&t=3188
https://github.com/har-in-air/ESP32-LCD-I2S
Useful I2S Interrupt Example:
https://github.com/nkolban/esp32-snippe ... ls/I2S.cpp
Thanks,
Will