S32K344 UART DMA example

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

S32K344 UART DMA example

跳至解决方案
6,753 次查看
S3RD4R
Contributor I

 

Hello all,

I am using S32K3X4EVB-Q172 development board. I have succesfully implemented interrupt based UART receive however I want to use DMA but i could not find any example. Is there any example of using DMA with UART? 

I am using latest MCAL SDK.

Best regards,

 

 

0 项奖励
回复
1 解答
6,687 次查看
PetrS
NXP TechSupport
NXP TechSupport

Hi,

this could be caused by cache. Try to either invalidate the address for the cache of the send buffer or place the buffer in a noncacheable memory.

#pragma GCC section bss ".mcal_bss_no_cacheable"
uint8_t tx_data[15];
#pragma GCC section bss

 

BR, Petr

在原帖中查看解决方案

0 项奖励
回复
5 回复数
6,480 次查看
WellsonGuo
Contributor II

Hello NXP TechSupport,
may I ask another question?

According to this example,
there is only UART1 for receiving and sending data in while loop,

if I add another UART3(interrupt mode) for communicating with this UART1, even if the DMA callback was triggered with event "LPUART_UART_IP_EVENT_END_TRANSFER", my buffer(Rx_Buffer) is still keeping empty, I don't know what's wrong with my procedures.

please help me, thanks~

*This code flow below is fine while interrupt mode.


while(1)
{
    lpuartStatus = Lpuart_Uart_Ip_AsyncReceive(UART_LPUART_INTERNAL_CHANNEL_1, Rx_Buffer, length);
    if (LPUART_UART_IP_STATUS_SUCCESS != lpuartStatus)
    {
        return FALSE;
    }

//Async send would be OVERRUN during 1.8Mbps baud rate

    lpuartStatus = Lpuart_Uart_Ip_SyncSend(UART_LPUART_INTERNAL_CHANNEL_3, Tx_Buffer,length,1000);
    if (LPUART_UART_IP_STATUS_SUCCESS != lpuartStatus)
    {
        return FALSE;
    }

    do
    {
        lpuartStatus = Lpuart_Uart_Ip_GetReceiveStatus(UART_LPUART_INTERNAL_CHANNEL_1, &remainingBytes);
    } while (LPUART_UART_IP_STATUS_BUSY == lpuartStatus && 0 < T_timeout--);
}

 

(updated)

If I change the priority of DMA channel(UART RX) from 0 to 2, I can receive part of some message from UART3, like below attachment.

 

0 项奖励
回复
6,711 次查看
S3RD4R
Contributor I

I have completed UART via DMA however i have an interesting case. When i copy captured data to a local variable or global variable and send it via UART, totally corrupt messages are sent. Below i add my code and UART output for reference. Do you have any idea?

 

0 项奖励
回复
6,688 次查看
PetrS
NXP TechSupport
NXP TechSupport

Hi,

this could be caused by cache. Try to either invalidate the address for the cache of the send buffer or place the buffer in a noncacheable memory.

#pragma GCC section bss ".mcal_bss_no_cacheable"
uint8_t tx_data[15];
#pragma GCC section bss

 

BR, Petr

0 项奖励
回复
6,729 次查看
S3RD4R
Contributor I

Thank you so much. I will check this example further. 

0 项奖励
回复
6,738 次查看
PetrS
NXP TechSupport
NXP TechSupport

Hi,

do not have example directly for this board, but see attached demo we got from Apps team.
Hope it helps.

BR, Petr

0 项奖励
回复