AnsweredAssumed Answered

UART interrupt timing and overflow error S32k148_176EVB

Question asked by Andrew Thornborough on Dec 7, 2018
Latest reply on Dec 18, 2018 by Daniel Martynek

Hello,

 

To start, this is my first time using the s32 product line and it seems to be going pretty well!

 

Currently, I am running a small uart test using the lpuart SDK that is provided.

 

I am working with the S32K148_176EVB Eval Board and my goal is to read a UART signal generated by another uart peripheral from the same chip. 

 

The reason for this is to test the functionality of the and reliability of the UART protocol. 

 

Currently what I am doing is sending a set of 4 bytes. via one uart (lpuart1) and then reading  4 bytes (lpuart0)  via the SDK. 

 

The general flow initiates the read for 4 bytes via an SDK (LPUART_DRV_ReceiveData) and then send 4 bytes via the SDK (LPUART_DRV_SendData) finally it waits until the Receiving uart has all 4 bytes (lpuart0).

 

I currently have a setup where it works great at low speeds. However, when I ramp up the baud rate some weird things begin to happen.

 

My suspicion is with the interrupt timing but I am not 100% sure. The errors start to happen at the 1mbps. It also does not error out when sending 1 byte at a time compared to 4 at high speeds. Again I have a feeling the interrupts are at play here. 

 

Finally, when I looked in I saw the order of operations with the interrupts is as follows.

 

 

 Send a byte1 from uart1 to uart0     UART1_TX ->UART0_RX

 Send a byte2 from uart1 to uart0     UART1_TX ->UART0_RX

 Send a byte3 from uart1 to uart0     UART1_TX ->UART0_RX

 Send a byte4 from uart1 to uart0     UART1_TX ->UART0_RX 

 Receive a byte1 from uart0 to uart1 UART0_RX <- UART1_TX 

 Overrun error from uart0               UART0_RX  error

 

 

The order of operation I expected to be 

 

Send a byte1 from uart1 to uart0

Receive a byte1 from uart0 to uart1

Send a byte2 from uart1 to uart0

Receive a byte2 from uart0 to uart1

Send a byte3 from uart1 to uart0

Receive a byte3 from uart0 to uart1

Send a byte4 from uart1 to uart0

Receive a byte4 from uart0 to uart1

 

....

 

 

Do you have an idea on what is going on here? Is the baud rate to fast and is tripping over the interrupt? I am not really sure why it is acting this way.  I put some code and a picture of my setup so you can see what I am working with. 

 

Thanks have a great day!

Andrew 

Attachments

Outcomes