Hi.
While I am using LPUART_RTOS_Receive, I`ve got Error code 1309 (kStatus_LPUART_RxHardwareOverrun), It means that ev value from xEventGroupWaitBits is RTOS_LPUART_HARDWARE_BUFFER_OVERRUN
Of cource, It is very rare case, 4~6 times in 12hours test
Saying the circumstance,
I.MX RT 1020 EVK board
1. Baudrate, 19200 bps
lpuart_rtos_config_t lp2_rt_config = {
.base = LPUART2,
.srcclk = 80000000UL,
.baudrate = 19200,
.parity = kLPUART_ParityDisabled,
.stopbits = kLPUART_OneStopBit,
.buffer = g_UART2rxRingBuffer, // RingBuffer size 512.
.buffer_size = sizeof(g_UART2rxRingBuffer),
.rx_timeout_constant_ms = 1,
.rx_timeout_multiplier_ms = 1,
.tx_timeout_constant_ms = 20,
.tx_timeout_multiplier_ms = 1,
};
2. FreeRTOSConfig.h
#define configUSE_PREEMPTION 1
#define configCPU_CLOCK_HZ (SystemCoreClock) // maybe 500Mhz ??
#define configTICK_RATE_HZ ((TickType_t)1000) // 1 tick, 1ms
#define configUSE_TIME_SLICING 1 // Around 10 tasks having same priority, exist.
3. When I call this function,
// timeout value first byte100ms, next byte 3ms
LPUART_RTOS_SetRxTimeout(m_hSerial, timeout, 1);
// I receive data by one Byte , Byte by Byte, using while (~~), about 30~ 40byte variant Length.
int lpuart_result = LPUART_RTOS_Receive(m_hSerial, (unsigned char*)buffer, 1, &n);
For solving this overrun Error, What am I supposed to do ?
As I think, Is this problem from the Speed of moving data from UART buffer to Ring buffer ?
So.
1. Do I need to change configTICK_RATE_HZ value ??
2. Before calling LPUART_RTOS_Receive, Do I have to set priority of This Task, Higher ?
OfCourse, when Exit LPUART_RTOS_Receive, restore priority value of that task.
3. or... change something arguement from FreeRTOS ??
4. change code?? RX interrupt handler code ? LPUART interrupt priority ?(using NVIC set priority)
Please advice to me