LPUART_RTOS_Receive Error Question

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

LPUART_RTOS_Receive Error Question

Jump to solution
972 Views
Seongyon_Jeong
Contributor III

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

              

 

0 Kudos
Reply
1 Solution
941 Views
nxf77486
NXP TechSupport
NXP TechSupport

Hello,

 

Thank you in advance for contacting NXP support.

In this case can you please help me with some extra details.

  • Q1: In the meantime is not necessary to modify the configTICK_RATE_HZ.
  • Q2: For this it would be really helpful if you can send me the task creation for the LPUART_RTOS_Receive task. This in order to understand how is this been configured and the current priority.
  • Q3: For this first approach it is not necessary to implement a change on the FreeRTOS.
  • Q4: Its is important to have an interrupt handler to manage and clean the reception flags. Also I will appreciate if you can send me the configuration of this interruption.

Also I will recommend for this case to give a look into our RT1020 SDK examples we have an LPUART_freeRTOS included that can be useful as a reference.

 

Please let me know this information.

View solution in original post

0 Kudos
Reply
2 Replies
885 Views
Seongyon_Jeong
Contributor III

I am sorry ,  I can not send the code.  right now. I don`t have authority, 

From, answer of Q2,   I found  improvement point,  so  I am doing  this  job , test.

thank you for the answer,  If I need more help,  I will upload question  more detaily  , as  new topic

0 Kudos
Reply
942 Views
nxf77486
NXP TechSupport
NXP TechSupport

Hello,

 

Thank you in advance for contacting NXP support.

In this case can you please help me with some extra details.

  • Q1: In the meantime is not necessary to modify the configTICK_RATE_HZ.
  • Q2: For this it would be really helpful if you can send me the task creation for the LPUART_RTOS_Receive task. This in order to understand how is this been configured and the current priority.
  • Q3: For this first approach it is not necessary to implement a change on the FreeRTOS.
  • Q4: Its is important to have an interrupt handler to manage and clean the reception flags. Also I will appreciate if you can send me the configuration of this interruption.

Also I will recommend for this case to give a look into our RT1020 SDK examples we have an LPUART_freeRTOS included that can be useful as a reference.

 

Please let me know this information.

0 Kudos
Reply