IMXRT1024 DMA Multiple UART Usage

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

IMXRT1024 DMA Multiple UART Usage

跳至解决方案
1,224 次查看
Lukas_Frank
Senior Contributor I

Hi all,

 

I am just trying to use multiple UART modules on my board. I just added UART2 requirements to default lpuart_edma_transfer(SDK) example. I will be sharing lpuart_edma_transfer.c file below. Here is the following updates that I have been added to default file:

 

Handlers for EDMA and UART2 RX and TX :

 

lpuart_edma_handle_t g_lpuartEdmaHandle2;
edma_handle_t g_lpuartTxEdmaHandle2;
edma_handle_t g_lpuartRxEdmaHandle2;

 

 Usercallbacks for UART2 :

 

volatile bool rxBufferEmpty2                                          = true;
volatile bool txBufferFull2                                           = false;
volatile bool txOnGoing2                                              = false;
volatile bool rxOnGoing2                                              = false;

void LPUART_UserCallback_2(LPUART_Type *base, lpuart_edma_handle_t *handle, status_t status, void *userData)
{

    if (kStatus_LPUART_TxIdle == status)
    {
        txBufferFull2 = false;
        txOnGoing2    = false;
    }

    if (kStatus_LPUART_RxIdle == status)
    {
        rxBufferEmpty2 = false;
        rxOnGoing2    = false;
    }
}

 

 DMA Source and Channel operations for UART2 :

 

    DMAMUX_SetSource(EXAMPLE_LPUART_DMAMUX_BASEADDR, LPUART_TX_DMA_CHANNEL2, LPUART_TX_DMA_REQUEST2);
    DMAMUX_SetSource(EXAMPLE_LPUART_DMAMUX_BASEADDR, LPUART_RX_DMA_CHANNEL2, LPUART_RX_DMA_REQUEST2);
    DMAMUX_EnableChannel(EXAMPLE_LPUART_DMAMUX_BASEADDR, LPUART_TX_DMA_CHANNEL2);
    DMAMUX_EnableChannel(EXAMPLE_LPUART_DMAMUX_BASEADDR, LPUART_RX_DMA_CHANNEL2);

 

 DMA Create Handle for UART2 :

 

    EDMA_CreateHandle(&g_lpuartTxEdmaHandle2, EXAMPLE_LPUART_DMA_BASEADDR, LPUART_TX_DMA_CHANNEL2);
    EDMA_CreateHandle(&g_lpuartRxEdmaHandle2, EXAMPLE_LPUART_DMA_BASEADDR, LPUART_RX_DMA_CHANNEL2);

 

LPUART Create Transfer Handle for UART2:

 

    LPUART_TransferCreateHandleEDMA(DEMO_LPUART2, 
    								&g_lpuartEdmaHandle2, 
									LPUART_UserCallback_2, 
									NULL, 
									&g_lpuartTxEdmaHandle2,
                                    &g_lpuartRxEdmaHandle2);

 

Sending operations:

 

    while(1)
    {
		LPUART_ReceiveEDMA(DEMO_LPUART, &g_lpuartEdmaHandle, &receiveXfer);

		LPUART_SendEDMA(DEMO_LPUART2, &g_lpuartEdmaHandle2, &sendXfer);
    }

 

After the whole change, I connect my UART2(TX) and UART1(RX) with jumpers. But there is no  data communication. What is wrong with that? Could you help me please.

 

Thanks and Regards.

标签 (1)
0 项奖励
回复
1 解答
1,211 次查看
jeremyzhou
NXP Employee
NXP Employee

Hi,
Thank you for your interest in NXP Semiconductor products and for the opportunity to serve you.
After having a brief review of the lpuart_edma_transfer.c, I find that you don't initialize the LPUART2 prior to configuring the DMA channel, so please check it carefully.

jeremyzhou_0-1630898161251.png

Hope it helps.
Have a great day,
TIC

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

 

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

在原帖中查看解决方案

2 回复数
1,212 次查看
jeremyzhou
NXP Employee
NXP Employee

Hi,
Thank you for your interest in NXP Semiconductor products and for the opportunity to serve you.
After having a brief review of the lpuart_edma_transfer.c, I find that you don't initialize the LPUART2 prior to configuring the DMA channel, so please check it carefully.

jeremyzhou_0-1630898161251.png

Hope it helps.
Have a great day,
TIC

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

 

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

1,207 次查看
Lukas_Frank
Senior Contributor I

Hi Dear @jeremyzhou ,

 

Thank you for your help

 

Thanks and Regards.

0 项奖励
回复