UART Rx won't restart after interruption to Rx data

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

UART Rx won't restart after interruption to Rx data

977 次查看
johngreenjets
Contributor III

I have created a model to receive UART based on the example code 'lpuart_s32k14x.mdl'.

I had to modify it slightly, because I need to receive 10 continuous bytes of data sent at a 100ms cycle rate.

The code works fine, until the UART data is interrupted such as:

  • disconnected from the external transmitter
  • external transmitter is powered down
  • debugger halted and restarted

When the UART data transmission restarts , the code does not receive the data unless the processor is reset.

I cannot find what is causing the fault or how to handle resetting the fault so that it automatically starts receiving data again.

The only thing I've noticed is that the LPUART0.CTRL register has the value 0x0F240000 when its working and 0x00000000 when it stops working.

Whats causing the issue and how can I resolve this ?

The model is attached for reference (LPUART_RX.zip)

johngreenjets_1-1727967095635.png

 

For reference, below is a scope trace of the UART data....

johngreenjets_2-1727967511006.png

The UART data contains the following parameters:

  • Byte 0: Temperature
  • Byte 1: Voltage high byte
  • Byte 2: Voltage low byte
  • Byte 3: Current high byte
  • Byte 4: Current low byte
  • Byte 5: Consumption high byte
  • Byte 6: Consumption low byte
  • Byte 7: Rpm high byte
  • Byte 8: Rpm low byte
  • Byte 9: 8-bit CRC

 

 

 

 

0 项奖励
回复
2 回复数

945 次查看
johngreenjets
Contributor III

I imported the xml project into S32DS and set breakpoint in the function LPUART_DRV_ErrIrqHandler (in lpuart_driver.c). 

I set a break point in each of the error types...

  • Overrun
  • Framing error
  • Parity error
  • Noise detect

When I disconnect the serial data, I get a framing error.

When I power down the transmitter, I get a noise error.

When I pause the debugger, I get an overrun error.

I need the software to automatically recover from these errors once the fault has been removed (with the exception of the paused debugger as this would only happen during debugging).

How do I achieve this ?

0 项奖励
回复

972 次查看
johngreenjets
Contributor III

Also, I noticed that the LPUART0 ISR block has options for:

  • Transmit buffer empty
  • End of transfer
  • Error event

 

johngreenjets_0-1727968351564.png

If these are enabled, it means the subsystem will be triggered if any one of those events occur.

But then when the subsystem is triggered, how do you determine which event caused the trigger ?

 

0 项奖励
回复