New
Hi,
In my application I am using PDMA ch1 for audio buffer updates. LCD display seems to be using PDMA as well. NVT_Draw1 function defined in fsa506.c there is some doc on how it works. It completely resets PDMA0, thus interrupting any other channels.
NVT_Draw1 is called each frame of the application. Bu the problems with PDMA interruption trace earlier all the way to APPW_Init() function. After it is called, my PDMA ch 1 stops working.
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] - (PDMA0->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] - (PDMA0->SCATBA);
/* Open PDMA channel 1 for I2S TX and channel 2 for I2S RX */
PDMA_Open(PDMA0, 0x1 << 1);
/* Configure PDMA transfer mode */
PDMA_SetTransferMode(PDMA0, 1, PDMA_I2S0_RX, 1, (uint32_t)&DMA_RXDESC[0]);
/* Enable PDMA channel 1&2 interrupt */
PDMA_EnableInt(PDMA0, 1, 0);
NVIC_EnableIRQ(PDMA0_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) {
//PDMA ch 1 related logic
}
GUI_Exec1();
APPW_Exec();
NVT_Draw1();
}
return 0;
}
In my application I am using PDMA ch1 for audio buffer updates. LCD display seems to be using PDMA as well. NVT_Draw1 function defined in fsa506.c there is some doc on how it works. It completely resets PDMA0, thus interrupting any other channels.
NVT_Draw1 is called each frame of the application. Bu the problems with PDMA interruption trace earlier all the way to APPW_Init() function. After it is called, my PDMA ch 1 stops working.
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] - (PDMA0->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] - (PDMA0->SCATBA);
/* Open PDMA channel 1 for I2S TX and channel 2 for I2S RX */
PDMA_Open(PDMA0, 0x1 << 1);
/* Configure PDMA transfer mode */
PDMA_SetTransferMode(PDMA0, 1, PDMA_I2S0_RX, 1, (uint32_t)&DMA_RXDESC[0]);
/* Enable PDMA channel 1&2 interrupt */
PDMA_EnableInt(PDMA0, 1, 0);
NVIC_EnableIRQ(PDMA0_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) {
//PDMA ch 1 related logic
}
GUI_Exec1();
APPW_Exec();
NVT_Draw1();
}
return 0;
}