New
Hi,
In my application I am using PDMA1 ch1 for audio buffer updates. LCD display seems to be using PDMA as well. NVT_Draw1 function defined in fsa506.c uses PDMA0 ch 2 to write data to LCD.
The problems with PDMA1 interruption traces earlier all the way to APPW_Init() function. After it is called, my PDMA ch 1 stops working.
I suspect that APPW_Init() uses PDMA to display initial image, and also overrides global PDMA configuration.
My question is whether there is any specific ways to handle PDMA for other than display purposes using this library.
Thank you.
My PDMA init:
void PDMA_Init1(void)
{
/* Rx description */
DMA_RXDESC[0].ctl = ((BUFF_LEN-1)<<PDMA_DSCT_CTL_TXCNT_Pos)|PDMA_WIDTH_32|PDMA_SAR_FIX|PDMA_DAR_INC|PDMA_REQ_SINGLE|PDMA_OP_SCATTER;
DMA_RXDESC[0].src = (uint32_t)&I2S0->RXFIFO;
DMA_RXDESC[0].dest = (uint32_t)(&audio_io_buffer1[0]);
DMA_RXDESC[0].offset = (uint32_t)&DMA_RXDESC[1] - (PDMA1->SCATBA);
DMA_RXDESC[1].ctl = ((BUFF_LEN-1)<<PDMA_DSCT_CTL_TXCNT_Pos)|PDMA_WIDTH_32|PDMA_SAR_FIX|PDMA_DAR_INC|PDMA_REQ_SINGLE|PDMA_OP_SCATTER;
DMA_RXDESC[1].src = (uint32_t)&I2S0->RXFIFO;
DMA_RXDESC[1].dest = (uint32_t)(&audio_io_buffer2[0]);
DMA_RXDESC[1].offset = (uint32_t)&DMA_RXDESC[0] - (PDMA1->SCATBA);
/* Open PDMA channel 1 for I2S TX and channel 2 for I2S RX */
PDMA_Open(PDMA1, 0x1 << 1);
/* Configure PDMA transfer mode */
PDMA_SetTransferMode(PDMA1, 1, PDMA_I2S0_RX, 1, (uint32_t)&DMA_RXDESC[0]);
/* Enable PDMA channel 1&2 interrupt */
PDMA_EnableInt(PDMA1, 1, 0);
NVIC_EnableIRQ(PDMA1_IRQn);
}
Main:
int main(void){
init_system();
PDMA_Init1();
tmr_init();
st1633i_low_level_init();
st1633i_startup_sequence();
APPW_X_Setup();
//PDMA ch 1 works up to this point!
APPW_Init(APPW_PROJECT_PATH);
APPW_CreatePersistentScreens();
APPW_CreateRoot(APPW_INITIAL_SCREEN, WM_HBKWIN);
while (1) {
if (s_u8CopyData) {
//PDMA1 ch 1 related logic
}
GUI_Exec1();
APPW_Exec();
NVT_Draw1();
}
return 0;
}
In my application I am using PDMA1 ch1 for audio buffer updates. LCD display seems to be using PDMA as well. NVT_Draw1 function defined in fsa506.c uses PDMA0 ch 2 to write data to LCD.
The problems with PDMA1 interruption traces earlier all the way to APPW_Init() function. After it is called, my PDMA ch 1 stops working.
I suspect that APPW_Init() uses PDMA to display initial image, and also overrides global PDMA configuration.
My question is whether there is any specific ways to handle PDMA for other than display purposes using this library.
Thank you.
My PDMA init:
void PDMA_Init1(void)
{
/* Rx description */
DMA_RXDESC[0].ctl = ((BUFF_LEN-1)<<PDMA_DSCT_CTL_TXCNT_Pos)|PDMA_WIDTH_32|PDMA_SAR_FIX|PDMA_DAR_INC|PDMA_REQ_SINGLE|PDMA_OP_SCATTER;
DMA_RXDESC[0].src = (uint32_t)&I2S0->RXFIFO;
DMA_RXDESC[0].dest = (uint32_t)(&audio_io_buffer1[0]);
DMA_RXDESC[0].offset = (uint32_t)&DMA_RXDESC[1] - (PDMA1->SCATBA);
DMA_RXDESC[1].ctl = ((BUFF_LEN-1)<<PDMA_DSCT_CTL_TXCNT_Pos)|PDMA_WIDTH_32|PDMA_SAR_FIX|PDMA_DAR_INC|PDMA_REQ_SINGLE|PDMA_OP_SCATTER;
DMA_RXDESC[1].src = (uint32_t)&I2S0->RXFIFO;
DMA_RXDESC[1].dest = (uint32_t)(&audio_io_buffer2[0]);
DMA_RXDESC[1].offset = (uint32_t)&DMA_RXDESC[0] - (PDMA1->SCATBA);
/* Open PDMA channel 1 for I2S TX and channel 2 for I2S RX */
PDMA_Open(PDMA1, 0x1 << 1);
/* Configure PDMA transfer mode */
PDMA_SetTransferMode(PDMA1, 1, PDMA_I2S0_RX, 1, (uint32_t)&DMA_RXDESC[0]);
/* Enable PDMA channel 1&2 interrupt */
PDMA_EnableInt(PDMA1, 1, 0);
NVIC_EnableIRQ(PDMA1_IRQn);
}
Main:
int main(void){
init_system();
PDMA_Init1();
tmr_init();
st1633i_low_level_init();
st1633i_startup_sequence();
APPW_X_Setup();
//PDMA ch 1 works up to this point!
APPW_Init(APPW_PROJECT_PATH);
APPW_CreatePersistentScreens();
APPW_CreateRoot(APPW_INITIAL_SCREEN, WM_HBKWIN);
while (1) {
if (s_u8CopyData) {
//PDMA1 ch 1 related logic
}
GUI_Exec1();
APPW_Exec();
NVT_Draw1();
}
return 0;
}
The post was edited 1 time, last by mdokukin ().