How to configure DMA Interrupts for UART in S32K324

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

How to configure DMA Interrupts for UART in S32K324

2,672 次查看
harish_ola
Contributor I

Hi All, 

We need to use DMA for LPUART in S32K324. There are no examples for this. 

We are not getting how can we make Transfer configuration, And in Interrupt handler they are not checking the Status of Interrupts, simply calling the handlers with events. 

harish_ola_0-1688537049771.png

 

There is no separate callbacks for LPUART0 and LPUART1. The Callback has to shared b/w the Instances also. 

harish_ola_1-1688537464251.png

 

Let me know how can we manage these. 

Thanks in advance..!

Regards, 

Harish G

#s32k324 #s32k3xx #lpuart #dma

0 项奖励
回复
4 回复数

2,540 次查看
Uday156
Contributor I

@danielmartynek @Dinesh_Guleria  It seems that the discussion is ongoing and hasn't reached a conclusion yet. I am also currently facing similar challenge and would appreciate some assistance from your end.  Please help me understand how to identify data reception and suggest the appropriate callback to use, along with when it will be triggered?

0 项奖励
回复

2,639 次查看
danielmartynek
NXP TechSupport
NXP TechSupport

Hi @Dinesh_Guleria,

I understand that you are working on this.

Can you update the thread?

 

BR, Daniel

 

2,632 次查看
Dinesh_Guleria
NXP Employee
NXP Employee

@danielmartynek @harish_ola 

I have already shared the UART code using DMA.

hen interrupt used UART status register is read :--
When using The interrupt mode, LPUART status read is done in this sequence in ISR code of UART :---
ISR(LPUART_UART_IP_0_IRQHandler) ---> Lpuart_Uart_Ip_IrqHandler() --> Lpuart_Uart_Ip_ErrIrqHandler() --> Lpuart_Uart_Ip_GetStatusFlag()

Lpuart_Uart_Ip_GetStatusFlag() read the UART STAT register to get following error of UART:--
LPUART_UART_IP_STATUS_TIMEOUT
LPUART_UART_IP_STATUS_TX_UNDERRUN
LPUART_UART_IP_STATUS_RX_OVERRUN
LPUART_UART_IP_STATUS_ABORTED
LPUART_UART_IP_STATUS_FRAMING_ERROR
LPUART_UART_IP_STATUS_PARITY_ERROR
LPUART_UART_IP_STATUS_NOISE_ERROR
LPUART_UART_IP_STATUS_DMA_ERROR

 

When DMA used for UART where in code UART status register is read, following is DMA handler flow code:--

ISR(Dma0_Ch16_IRQHandler) ---> IrqHandler(3U, 0U, 16U) ---> Dma_Ip_ErrorIrqHandler() or Dma_Ip_IntIrqHandler()  is callled

Dma_Ip_IntIrqHandler() -----> LocChState->LogicChId->IntCallback() which is this function : Lpuart_6_Uart_Ip_DmaRxCompleteCallback(void)--> Lpuart_Uart_Ip_CompleteReceiveUsingDma(6);

Dma_Ip_ErrorIrqHandler() -----> LocChState->LogicChId->ErrIntCallback();

@danielmartynek 
I am not able to get when DMA is used in that case where we are reading the UART status register ? Please can you suggest on it ?

 

Regards,
Dinesh

 

0 项奖励
回复

2,625 次查看
Dinesh_Guleria
NXP Employee
NXP Employee

@danielmartynek 

Client is asking when they Enable DMA with UART & do async receive :--
Lpuart_Uart_Ip_AsyncReceive(UART_LPUART_INTERNAL_CHANNEL, (uint8_t*)rx_data, 50);

 

Only way we can check the recived bytes:--
Lpuart_Uart_Ip_GetTransmitStatus(UART_LPUART_INTERNAL_CHANNEL, &remainingBytes);

 

if i am correct DMA will call the UART callback once all the data is received, right ?


Is there any other way to get an notification ? :--
Buffer is half full


Also If i am correct then UART will trigger the DMA on every correct reception of data, if some error is there in reception of data on UART DMA will not be rigged, right ?

 

If UART is configured to receive using DMA, and i call this function Lpuart_Uart_Ip_AsyncReceive() to receive the 50 bytes on UART, when will first time this DMA IRQ will be called, on first byte of reception on UART or when all the 50 bytes are received :--
Dma0_Ch0_IRQHandler()

 

0 项奖励
回复