Hi Dear @jeremyzhou ,
Thanks for your feedback. I just get confused a little bit when you said "--- No, I'm afraid not.". Could you please confirm my code about the way I go ? I will be shairing below. Could you check that please? (lpuart_edma_rb_transfer.c attached)
I have some highlited questions here:
Q1 : Should I use separate lpuart_edma_handle_t for each UARTx object?
Q2: Should I align tcdMemoryPoolPtr like below ?
//Increased tcdMemoryPoolPtr[1] to tcdMemoryPoolPtr[2]
AT_NONCACHEABLE_SECTION_ALIGN(static edma_tcd_t tcdMemoryPoolPtr[2], sizeof(edma_tcd_t));
Q3: Should I use seperate edma_handle_t for each RX(like g_lpuartRxEdmaHandle, g_lpuartRxEdmaHandle2, so on) or Can I use one g_lpuartRxEdmaHandle for all and only change tcdUsed? For the time being, I used like below. There are some missing point for me in comment lines for tcdUsed, tail, tcdMemoryPoolPtr[indexValue=?] and tcdPool[indexValue=?]. Could you please check that?
static void EXAMPLE_StartRingBufferEDMA2(void)
{
edma_transfer_config_t xferConfig;
EDMA_InstallTCDMemory(&g_lpuartRxEdmaHandle2, (edma_tcd_t *)&tcdMemoryPoolPtr[1], 1U); //NOT SURE
EDMA_PrepareTransfer(&xferConfig, (void *)(uint32_t *)LPUART_GetDataRegisterAddress(EXAMPLE_LPUART2),
sizeof(uint8_t), g_ringBuffer2, sizeof(uint8_t), sizeof(uint8_t), EXAMPLE_RING_BUFFER_SIZE,
kEDMA_PeripheralToMemory);
g_lpuartRxEdmaHandle2.tcdUsed = 2U; //NOT SURE 1U or 2U
g_lpuartRxEdmaHandle2.tail = 0U; //NOT SURE What?
EDMA_TcdReset(&g_lpuartRxEdmaHandle2.tcdPool[1U]);
EDMA_TcdSetTransferConfig(&g_lpuartRxEdmaHandle2.tcdPool[1U], &xferConfig, tcdMemoryPoolPtr);
g_lpuartRxEdmaHandle2.tcdPool[1U].CSR |= DMA_CSR_INTMAJOR_MASK;
EDMA_InstallTCD(g_lpuartRxEdmaHandle2.base, g_lpuartRxEdmaHandle2.channel, &g_lpuartRxEdmaHandle2.tcdPool[1U]);
EDMA_SetCallback(&g_lpuartRxEdmaHandle2, EXAMPLE_RxEDMACallback2, NULL);
EDMA_StartTransfer(&g_lpuartRxEdmaHandle2);
LPUART_EnableRxDMA(EXAMPLE_LPUART2, true);
LPUART_EnableInterrupts(EXAMPLE_LPUART2, kLPUART_IdleLineInterruptEnable);
EnableIRQ(EXAMPLE_LPUART_IRQn2);
}
I am appretiate for your help.
Thanks and Regards.