i2s dma interrupt commands

Baldhead
Posts: 470
Joined: Sun Mar 31, 2019 5:16 am

i2s dma interrupt commands

Postby Baldhead » Wed Mar 04, 2020 1:37 pm

Hi,

Below is a code snippet used to start a transmission on the i2s module using dma.

My question is if i need to use these 3 commands within the i2s dma interrupt every time i start a new i2s/dma transmission.

The problem is that when the dma interrupt occurs, the i2s transmitter still remains sending data, because of the fifo memory that is configured, in this case, with 64 positions.

Code: Select all

// i2s dma interrupt

I2S0.conf.tx_start = 0;    // Check if  need to do this sequence at the end of the transmission within the dma interrupt.
I2S0.conf.tx_reset = 1;    // The problem is that when the dma interrupt occurs, the i2s transmitter still remains    
I2S0.conf.tx_reset = 0;    // sending data, because of the fifo memory that is configured, in this case, with 64 positions.

Code: Select all

static inline void i2s_dma_trans_start_interrupt( uint32_t addr )
{
    I2S0.out_link.addr = addr;
    
    I2S0.out_link.start = 1;
    I2S0.fifo_conf.dscr_en = 1;    // Enable I2S DMA mode. Disable fifo mode.
    I2S0.fifo_conf.dscr_en = 1;    
    I2S0.conf.tx_start = 1;  
}

Thank's for the help.

Baldhead
Posts: 470
Joined: Sun Mar 31, 2019 5:16 am

Re: i2s dma interrupt commands

Postby Baldhead » Fri Mar 06, 2020 3:24 pm

Hello again,

I would like to know if all i2s0 module interrupt sources registered and enabled enter in a single point only.

Example:

Code: Select all

static void IRAM_ATTR i2s_isr ( )    // Single point entry for all i2s0 module interrupt sources registered and enabled ????
{
    if ( I2SX.int_st.out_eof ) 
    {    
    }
    
    if ( I2SX.int_st.out_total_eof )
    {
    }
    
    if ( I2SX.int_st.out_done )
    {
    }
    
    if ( I2SX.int_st.tx_rempty )
    {    
    }
        
    I2SX.int_clr.val = I2SX.int_st.val;    // Clear all interrupt flags.
}
And inside that single interrupt routine i need to test to know what type of interrupt occurred ?

Or i can have one single entry point interrupt service routine(isr) for each type of interrupt registered and enabled ?

Code: Select all

// i2s interrupt subroutine register

static esp_err_t i2s_isr_register( )
{
    return esp_intr_alloc ( ETS_I2SX_INTR_SOURCE, ESP_INTR_FLAG_IRAM, i2s_isr, NULL, NULL );  
}

////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////
// i2s interrupt subroutine


static void IRAM_ATTR i2s_isr ( )    // All registered and enabled interrupts of the i2s module enter this function ???? 
{   

    if ( I2SX.int_st.out_eof )      
    {
        // some code
    }

    if ( I2SX.int_st.out_dscr_err )
    {
        ESP_EARLY_LOGE ( "I2S_TAG", "dma error, interrupt status: 0x%08x", I2SX.int_st.val );   
    }
    

    while ( !I2SX.state.tx_idle );    // On dma interrupt, i2s still are sending data over the i2s physical port(transmitter), because of the fifo memory, that is configured, in my case, with 64 positions.
      

    I2SX.conf.tx_start = 0;    // Check if i need to do this sequence here at the end of the fisical port transmission.
    I2SX.conf.tx_reset = 1;    // Without this sequence it doesn't work.
    I2SX.conf.tx_reset = 0;  
 
 
    I2SX.int_clr.val = I2SX.int_st.val;
}

Note: I2SX = I2S0.


Thank's for the help.

Baldhead
Posts: 470
Joined: Sun Mar 31, 2019 5:16 am

Re: i2s dma interrupt commands

Postby Baldhead » Fri Mar 06, 2020 10:41 pm

If i disable the code below, the dma interrupt still occur, but the i2s transmitter not send any data by the physical port.

In fact the first transmission works and the other transmissions don't work anymore, but the dma interrupt continues to occur.

I reset esp32 chip by external reset button to observe this behavior and i measure the pins with an oscilloscope.

I am using "ESP32-DevKitC-VB" and "ESP32-LCDKit" boards to test.

Code: Select all

/*
while ( !I2SX.state.tx_idle );    // On dma interrupt, i2s still are sending data over the i2s physical port(transmitter), because of the fifo memory, that is configured, in my case, with 64 positions.
      

    I2SX.conf.tx_start = 0;    // Check if i need to do this sequence here at the end of the fisical port transmission.
    I2SX.conf.tx_reset = 1;    // Without this sequence it doesn't work.
    I2SX.conf.tx_reset = 0;
*/  
 

Who is online

Users browsing this forum: Bing [Bot], top_secret_guy and 87 guests