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 件の賞賛
返信