When using multiple serial ports of NXP IMXRT1020, overrun problems are likely to occur

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

When using multiple serial ports of NXP IMXRT1020, overrun problems are likely to occur

1,036 Views
Aaron-hu
Contributor I

Board: NXP IMXRT1020

Linux version: Linux version 4.5.0-g83127a04-dirty

The 485 serial port driver is in interrupt mode.

Aaronhu_2-1735287257058.png

 

Issue Description:

1,  I used the chip's three 485 serial ports to communicate with external devices, One of the serial ports(PORTB) as a Master to request data from external devices, and the other two serial ports(PORTC and PORTD) as a Slave to respond to requests from external devices(As shown below).

Aaronhu_0-1735286201668.png

2,  If the baud rates of the three serial ports are set to the same value (e.g.: all are 2400 or 19200 or 115200, etc.), there will be no Overrun error. However, if they are set to different values, the serial port with the higher baud rate will have Overrun errors(As shown below).

Aaronhu_1-1735286955683.png

3, How should I solve this problem? Thank you very much.

0 Kudos
Reply
5 Replies

1,000 Views
mayliu1
NXP Employee
NXP Employee

Hi @Aaron-hu ,

Thank you for your interest in the NXP MIMXRT product, I would  like to provide service for you.

1: I suggest that you set serial port ( the port which you set a higher baud rate) interrupt to the highest priority, so it will be given priority for processing whenever a UART byte is received.

2: I also suggest that you program the codes in all interrupts as concise and efficient as possible , Please minimize the interrupt execution time .

3: Finally, I suggest that you use DMA for serial port communication, This method can reduce the CPU load, it can also reduce the frequency of interrupt occurrence.

Wish it helps you.
If you still have question about it, please kindly let me know.

BR

mayliu

0 Kudos
Reply

989 Views
Aaron-hu
Contributor I

Ciao @mayliu1

Thank you very much for your reply and support. Could you tell me how to set the priority of the corresponding interrupt in Linux lpuart driver code?

For example: I want to increase the priority of the following interrupt. What should I do after I apply for the interrupt?

Aaronhu_2-1735610567100.png

Aaronhu_1-1735610516805.png

Thank you again.

0 Kudos
Reply

981 Views
mayliu1
NXP Employee
NXP Employee

Hi @Aaron-hu 

 

Thanks for your update information.

I am sorry that  that I'm using the Windows MCUXpresso IDE and the SDK library  provided by NXP. I'm not developing in the Linux environment.

I can share how to set the interrupt priority in my environment.

NVIC_SetPriority(IRQn_Type IRQn, uint32_t priority)

The first param is IRQn Interrupt number. You can find IRQn_Type in MIMXRT1021.h file.

mayliu1_1-1735633376652.png

UART TX and RX use the same Interrupt vector number.

The second param is priority Priority to set .

 

Wish it helps you.
If you still have question about it, please kindly let me know.

BR

mayliu

0 Kudos
Reply

938 Views
Aaron-hu
Contributor I

Ciao @mayliu1

Thanks for your reply, I wonder if we have Linux support ?

 

Best regards

Aaron

0 Kudos
Reply

922 Views
mayliu1
NXP Employee
NXP Employee

Hi @Aaron-hu 

Thanks for your update information.

I'd like to confirm with you whether the MIMXRT1020 chip you are using runs Linux or not.

If yes, I'm sorry that NXP does not  officially support Linux for the MIMXRT1XXX, instead, we support the use of the SDK code running on the MIMXRT1XXX.

Wish you a nice day

BR

mayliu

0 Kudos
Reply