This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

UARTE in circular mode

Hi,

I have a question about the UARTE peripheral. is it possible to keep the DMA running and let it write to ram in a circular way? I used DMA on the stm32 before and there we can set it in a circular mode. When the ptr reached the last configured ram address it automatically starts from the front. And while the DMA is running, is there any way to get the current amount in the buffer? Now i have to stop rx before the amount register becomes valid.

Parents
  • I actually created a solution using PPI and TIMER in counter mode to get the amount while keeping DMA active:

    NRF_TIMER1->MODE = TIMER_MODE_MODE_LowPowerCounter << TIMER_MODE_MODE_Pos;
    NRF_TIMER1->BITMODE = TIMER_BITMODE_BITMODE_16Bit << TIMER_BITMODE_BITMODE_Pos;
    NRF_TIMER1->TASKS_CLEAR = 1;
    NRF_TIMER1->TASKS_START = 1;
    
    NRF_PPI->CH[0].EEP = (SE_UInt32)&pContext->pUart->EVENTS_RXDRDY;
    NRF_PPI->CH[0].TEP = (SE_UInt32)&NRF_TIMER1->TASKS_COUNT;
    
    NRF_PPI->CH[1].EEP = (SE_UInt32)&pContext->pUart->EVENTS_ENDRX;
    NRF_PPI->CH[1].TEP = (SE_UInt32)&NRF_TIMER1->TASKS_CLEAR;
    
    NRF_PPI->CHENSET =  PPI_CHENSET_CH0_Set << PPI_CHENSET_CH0_Pos | PPI_CHENSET_CH1_Set << PPI_CHENSET_CH1_Pos ;
    

    This way I can keep the DMA running and the counter value indicates the current write index of the DMA. Now i can handle the data while keeping the receiver running.

Reply
  • I actually created a solution using PPI and TIMER in counter mode to get the amount while keeping DMA active:

    NRF_TIMER1->MODE = TIMER_MODE_MODE_LowPowerCounter << TIMER_MODE_MODE_Pos;
    NRF_TIMER1->BITMODE = TIMER_BITMODE_BITMODE_16Bit << TIMER_BITMODE_BITMODE_Pos;
    NRF_TIMER1->TASKS_CLEAR = 1;
    NRF_TIMER1->TASKS_START = 1;
    
    NRF_PPI->CH[0].EEP = (SE_UInt32)&pContext->pUart->EVENTS_RXDRDY;
    NRF_PPI->CH[0].TEP = (SE_UInt32)&NRF_TIMER1->TASKS_COUNT;
    
    NRF_PPI->CH[1].EEP = (SE_UInt32)&pContext->pUart->EVENTS_ENDRX;
    NRF_PPI->CH[1].TEP = (SE_UInt32)&NRF_TIMER1->TASKS_CLEAR;
    
    NRF_PPI->CHENSET =  PPI_CHENSET_CH0_Set << PPI_CHENSET_CH0_Pos | PPI_CHENSET_CH1_Set << PPI_CHENSET_CH1_Pos ;
    

    This way I can keep the DMA running and the counter value indicates the current write index of the DMA. Now i can handle the data while keeping the receiver running.

Children
No Data
Related