AnsweredAssumed Answered

UART frame/parity error with MQX 4.1

Question asked by liu dachuan on Mar 11, 2015
Latest reply on Mar 19, 2015 by Daniel Chen

We are working on K60N512 and MQX 4.1. There are 9 serial ports on the board and 5 of them are K60's build-in SCI port and the other ports are expended by a uart tranceiver(TL16C754).

Our board is the RS-485 master device, it sends modbus querry frames and the slave device will response immediately. We find that when our board is receiving data from slave device, three build-in SCI ports loss characters occasionally. We trace the code and find every time the UART loss character, the S1[PE] and S1[FE] flags are set.
It seems there are some frame errors or parity errors on the Rxd line. But we capture the signals by logic analyzer when the PE/FE interrupt triggers, every thing is fine, we can't see any abnormal signal.
The problem is only on UART2/3/4, not on UART0/1 which have 8-entry FIFOs and expend UART tranceiver.


We did some tests below, it seems the problem is somehow related with the MQX's interrupt/schedule machanism.
Test 1:
The default systick is 200, when we turn it to 100, it works fine. Then we turn it to 400, the problem occurs more frequently. And then we turn it to 600, it gets back to normal again.

Test 2:
We setup a test project and leave only two UART thread and one IIC read/write thread, the problem is still. When we remove the IIC thread, it's fine.

If we replace the IIC thread with a hwtimer task that rises up to 3000 interrupts per second, we can reproduce the UART module's problem.

We believe that the parity and frame errors should be pure hardware/CPU faults, and we can't explain why it's related with the software and OS.

Any one can help?
Thanks!

Outcomes