S32K146 LPUART EDMA failed

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

S32K146 LPUART EDMA failed

899 Views
317336284
Contributor I

Hi expert,

I have a problem, I use lpuart module of S32K146 to implement UART transfer function between Modem and MCU.

I Set the uart parameter: Baud Rate 230400, No parity, Stop Bit 1, 8 bit per char, DMA, using edmaController1, Rx DMA Channel 1, Tx DMA Channel 0.

Then i test the data transfer(MCU Send and Receive Data), after about 1 hour testing, the Programm will Crash in LPUART_SetReceiverCmd(base, false) , the LPUART CTRL Register bit RE is set  to 0(false), but when crash happend, i read its value is 1. 

The while loop below can not break out:

static inline void LPUART_SetReceiverCmd(LPUART_Type * base, bool enable)

{   

   base->CTRL = (base->CRTL & ~LPUART_CTRL_RE_MASK) | ((enable ? 1UL : UL) << LPUART_CTRL_RE_SHIFT);

   while((bool)((base->CTRL & LPUART_CTRL_RE_MASK) != 0U) != enable){} //crash point loop can not break out.

}

I reaad the LPUART CTRL Register bits ORIE, NEIE, FEIE, PEIE, all of the 4 bit is 1.

I check the crash stack, find that:

EDMA_DRV_IRQHanler()  -> LPUART_DRV_RxDmaCallback() -> LPUART_DRV_StopRxDma().

In LPUART_DRV_RxDmaCallback()  it goes to the else branch to call StopRxDma function. 

if(lpuartState->rxSize >0)

{

   ............

}

else

{

   LPUART_DRV_StopRxDma(instance);

   ......

}

I want to know why in function LPUART_SetReceiverCmd(base, false);

Code: base->CTRL = (base->CRTL & ~LPUART_CTRL_RE_MASK) | ((enable ? 1UL : UL) << LPUART_CTRL_RE_SHIFT);already set RE bit to 0, but its value keeps 1,

 which cause the  while loop next line cannot break out.

What condition  can cause the set register RE bit action fail?

How to fix the bug?

0 Kudos
1 Reply

792 Views
dianabatrlova
NXP TechSupport
NXP TechSupport

Hi Xiaoyu,

When RE is written to 0, this register bit will read as 1 until the receiver finishes receiving the current character.

Could you, please, check the LPUART Status Register (STAT) when the issue occurs?

Thank you.

Best Regards,

Diana

0 Kudos