UART interrupt timing and overflow error S32k148_176EVB

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

UART interrupt timing and overflow error S32k148_176EVB

1,519 Views
andrew_thornbor
Contributor II

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 

Labels (1)
3 Replies

1,280 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Hello Andrew,

I have gone briefly through the description and attachments, I think that it would be better if you send the whole test project so that we could test it on our side.
However, it sounds like a problem with SW overhead, the SDK drivers are quite big. You can test it with a higher core frequency in HSRUN.
I have noticed that TX module has higher priority (14) than the RX module (15).
The CPU is probably busy sending the bytes and there is no room left for the RX interrupt.

Regards,

Daniel

1,280 Views
andrew_thornbor
Contributor II

Hey Daniel, thank you for the response!

I am not sure how to attach a file via a comment so I will update the original post with the whole project.

Also, I thought the higher the number the higher the priority. I will take a look and change that number. 

I will also try a higher core frequency I thought a speed of 48 Mhz would be fast enough for a 1 Mbps baud. I will adjust that accordingly. 

Let me know if you have any more questions. 

0 Kudos

1,280 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Hi Andrew, 

Thanks for the test project but I can't get it working for some reason. 

The LPUART1 module is not sending anything.

Regarding the priorities, yes, the lower the number, the higher the priority.

Please refer to the core user guide. ARM Information Center 

The S32K1xx series implements only 16 priorities configurable in the 4 MSB of the PRI_x bit fields.

pastedImage_1.png

 

Regards,

Daniel

0 Kudos