AnsweredAssumed Answered

Is there a lpuart edma transfer size limit?

Question asked by Stefan Mitterhauser on Jan 17, 2020
Latest reply on Jan 30, 2020 by jeremyzhou

Hello,

I am using a combination of the lpuart_edma_rb_transfer and semc_sdram examples for the RT1020 EVK board to evaluate the uart transfer for big data sizes. From the host PC I send a data file via Tera Term to the target and the target simply returns the data received to the host PC. The ring buffer and the send buffer are located in external SDRAM. If I send less than 32kByte everything works fine. As soon as the buffer size is set to 32kByte or above the transfer won't work (it also does not work for a single byte transfer). Maybe there is something wrong with the EXAMPLE_LPUART_IRQHandler in more detail the calculation of the receivedBytes variable because if I only send one byte the calculated Nr. of receivedBytes is set to 32257 and it should be 1. The init functions and IRQ handler are from the example codes. Below the code parts I have changed:

 

//#define EXAMPLE_RING_BUFFER_SIZE (32*1024U) //does not work
#define EXAMPLE_RING_BUFFER_SIZE (32*1024U - 1) //works


AT_NONCACHEABLE_SECTION_INIT(uint8_t* g_rxBuffer) = {(uint8_t *)(EXAMPLE_SEMC_START_ADDRESS + EXAMPLE_RING_BUFFER_SIZE + 50)};

AT_NONCACHEABLE_SECTION_INIT(uint8_t* g_ringBuffer) = {(uint8_t *)EXAMPLE_SEMC_START_ADDRESS};


/*!
* @brief Main function
*/

int main(void)
{
    lpuart_transfer_t sendXfer;

    BOARD_ConfigMPU();
    BOARD_InitPins();
    BOARD_BootClockRUN();

    // deactivate caches
    L1CACHE_DisableICache();
    L1CACHE_DisableDCache();
   
    CLOCK_InitSysPfd(kCLOCK_Pfd2, 29);
    /* Set semc clock to 163.86 MHz */
    CLOCK_SetMux(kCLOCK_SemcMux, 1);
    CLOCK_SetDiv(kCLOCK_SemcDiv, 1);

    if (BOARD_InitSEMC() != kStatus_Success)
    {
        while(1);
    }
   
    /* Initialize the LPUART module. */
    EXAMPLE_InitLPUART();

    /* Intialzie the EDMA configuration. */
    EXAMPLE_InitEDMA();

    sendXfer.data     = g_rxBuffer;
    sendXfer.dataSize = EXAMPLE_RING_BUFFER_SIZE;
   
    /* Start ring buffer with EDMA used. */
    EXAMPLE_StartRingBufferEDMA();

    while (1)
    {
        isIdleLineDetected = false;
               
        /* Wait for IDLE line detect. */
        while (!isIdleLineDetected)
        {
        }
        EXAMPLE_ReadRingBuffer(g_ringBuffer, g_rxBuffer, receivedBytes);
        sendXfer.dataSize = receivedBytes;
        LPUART_SendEDMA(EXAMPLE_LPUART, &g_lpuartEdmaHandle, &sendXfer);
    }
}

 

Kind regards,

Stefan

Outcomes