UART RTOS Receive function status

My English is not very good.

I’m new with freertos, I’m having a hard time solving the following situation:
The UART_RTOS_Receive function is returning the status kStatus_UART_RxHardwareOverrun I am not able to solve it, I created a modbus code to communicate with the computer.

rxsize = 2;
status_t status = UART_RTOS_Receive(&UART_MODBUS_rtos_handle, modbus.rx_buffer, rxsize, &modbus.rx_nBytes);
if(status == kStatus_Success)

if(status == kStatus_UART_RxHardwareOverrun )

That almost certainly indicates you haven’t setup the device correctly. Hardware overrun indicates that the receiver has gotten too many characters before the code removed them, but a good driver, especially one designed for an RTOS should have and ISR that gets invoked as soon as a character arrives.

Either that ISR hasn’t been properly configured, or your code has very long critical sections that block the ISR from running.

I’m using the freescale K64F microcontroller.
The attached images is the UART configuration, could you help me to solve this situation?
I may be passing the modbus code that I implemented.

Those settings look reasonable. As @richard-damon indicated, the root cause of a hardware overrun is receiving more characters than the hardware can buffer. Please verify that the UART0_RX_TX_IRQn handler is unloading all the characters that arrive. It is possible that it is not unloading characters or that a higher priority interrupt is preventing the UART interrupts from happening, or that a critical section is active long enough to block the UART interrupt.

In the past I have toggled a pin (high-low) in the UART interrupt. Then I can see where the characters arrive and the ISR handles them. It becomes quite clear if something is blocking the ISR.

I’m new to hardware development especially this one, k64.
How do I make these adjustments to identify the problem, any tips?
how to check this handler UART0_RX_TX_IRQn ?

I would recommend that you find a UART example in the Freescale example code. That is likely to be a much simpler program to study and learn from. After learning how that works, your learnings can be applied to correct this application.

Sadly, we support many different silicon platforms and cannot be the masters of each one.


The implemented code was based on the freertos uart example, but even so I can’t understand what’s going on.

Buffer status still occurs overlap: kStatus_UART_RxHardwareOverrun

I would need someone who has a better experience than mine with the freertos system

Quite often the silicon vendors provide example code that does not use FreeRTOS. You can use this code to get a better understanding of the UART functionality. It will be easier to debug the FreeRTOS application with this understanding.