NRF52832 FreeRTOS+UARTE not worked

Hi everyone:

I want to use UARTE on my FreeRTOS, but when I used the example(examples/peripheral/libuarte) in rtos, something went wrong.

First of all, I tested the example, and it looks like good. When I send slowly, the uart log is here.

and when I send quickly(every 4ms), the uart log is that.

But when I use the UARTE in FreeRTOS, It looks OK when sending slowly, but when I send it every 4ms(I need this frequency), the result is here.

I don't know what's wrong.

Best regards, 

Lurn

Parents
  • Hi Lurn,

    There is not much to go on here. Can you elaborate a bit more? How exactly do you doing things in your implementation, and what exactly happens in the failing case? And what is the difference between the failing case (with FreeRTOS) and without it?

    Generally FreeRTOS does not interfere directly with UART, but it is tempting to think that there could be some issue with priorities, perhaps the application now is doing more or for some reason is not able to service UART related interrupts fast enough, but I don't know enough of your application to be more specific.

  • Sorry for my unclear description.

    I use the example uarte code in FreeRTOS, just modify here

        nrf_libuarte_async_config_t nrf_libuarte_async_config = {
                .tx_pin     = TX_PIN_NUMBER,
                .rx_pin     = RX_PIN_NUMBER,
                .baudrate   = NRF_UARTE_BAUDRATE_921600,
                .parity     = NRF_UARTE_PARITY_EXCLUDED,
                .hwfc       = NRF_UARTE_HWFC_DISABLED,
                .timeout_us = 2,
                .int_prio   = APP_IRQ_PRIORITY_HIGH,
                .pullup_rx  = 1
        };

    I change the int_prio from APP_IRQ_PRIORITY_LOW to APP_IRQ_PRIORITY_HIGH.

    the question is when I use FreeRTOS,when I'm done sending the data, I should receive the data immediately, the log should like that,  (the ->◇ is send data, <- Diamonds is receive data).

    But now, I get a wrong state, I only receive some data after I send it several times

    BR,

    Lurn

  • ok, I will share you my main.c, sdk_config and uart.c

    it looks like a bit of a mess, because I delete some another tasks things.

    /**
     * Copyright (c) 2015 - 2021, Nordic Semiconductor ASA
     *
     * All rights reserved.
     *
     * Redistribution and use in source and binary forms, with or without modification,
     * are permitted provided that the following conditions are met:
     *
     * 1. Redistributions of source code must retain the above copyright notice, this
     *    list of conditions and the following disclaimer.
     *
     * 2. Redistributions in binary form, except as embedded into a Nordic
     *    Semiconductor ASA integrated circuit in a product or a software update for
     *    such product, must reproduce the above copyright notice, this list of
     *    conditions and the following disclaimer in the documentation and/or other
     *    materials provided with the distribution.
     *
     * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
     *    contributors may be used to endorse or promote products derived from this
     *    software without specific prior written permission.
     *
     * 4. This software, with or without modification, must only be used with a
     *    Nordic Semiconductor ASA integrated circuit.
     *
     * 5. Any software provided in binary form under this license must not be reverse
     *    engineered, decompiled, modified and/or disassembled.
     *
     * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
     * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
     * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
     * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
     * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
     * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     *
     */
    /** @file
     * @defgroup blinky_example_main main.c
     * @{
     * @ingroup blinky_example_freertos
     *
     * @brief Blinky FreeRTOS Example Application main file.
     *
     * This file contains the source code for a sample application using FreeRTOS to blink LEDs.
     *
     */
    
    #include <stdbool.h>
    #include <stdint.h>
    
    #include "FreeRTOS.h"
    #include "task.h"
    #include "timers.h"
    #include "bsp.h"
    #include "nordic_common.h"
    #include "nrf_drv_clock.h"
    #include "sdk_errors.h"
    #include "app_error.h"
    #include "thread.h"
    #include "nrf_power.h"
    #include "nrf_pwr_mgmt.h"
    #include "nrf_delay.h"
    
    
    #if LEDS_NUMBER <= 2
    #error "Board is not equipped with enough amount of LEDs"
    #endif
    
    #define TASK_DELAY        200           /**< Task delay. Delays a LED0 task for 200 ms */
    #define TIMER_PERIOD      1000          /**< Timer period. LED1 timer will expire after 1000 ms */
    
    #define BOOTLOADER_DFU_GPREGRET_MASK            (0xF8)      /**< Mask for GPGPREGRET bits used for the magic pattern written to GPREGRET register to signal between main app and DFU. */
    #define BOOTLOADER_DFU_GPREGRET                 (0xB0)      /**< Magic pattern written to GPREGRET register to signal between main app and DFU. The 3 lower bits are assumed to be used for signalling purposes.*/
    #define BOOTLOADER_DFU_START_BIT_MASK           (0x01)      /**< Bit mask to signal from main application to enter DFU mode using a buttonless service. */
    #define BOOTLOADER_DFU_START    (BOOTLOADER_DFU_GPREGRET | BOOTLOADER_DFU_START_BIT_MASK)      /**< Magic number to signal that bootloader should enter DFU mode because of signal from Buttonless DFU in main app.*/
    
    
    static void clocks_start( void )
    {
        NRF_CLOCK->EVENTS_HFCLKSTARTED = 0;
        NRF_CLOCK->TASKS_HFCLKSTART = 1;
    
        while (NRF_CLOCK->EVENTS_HFCLKSTARTED == 0);
    }
    
    #if 1
    static void enter_dfu(void)
    {
        uint8_t old_gpregret = nrf_power_gpregret_get();
        SEGGER_RTT_printf(0, "get the old_gpregret = %d", old_gpregret);
            nrf_delay_ms(5);
        uint8_t new_gpregret = old_gpregret & BOOTLOADER_DFU_START;
        SEGGER_RTT_printf(0, "new_gpregret = %d", new_gpregret);
            nrf_delay_ms(5);
        uint8_t temp = 0;
    
        nrf_power_gpregret_set(BOOTLOADER_DFU_START);
        while((temp & BOOTLOADER_DFU_START) != BOOTLOADER_DFU_START)
        {
            temp = nrf_power_gpregret_get();
            SEGGER_RTT_printf(0, "temp = %d", temp);
            nrf_delay_ms(5);
        }
        nrf_pwr_mgmt_shutdown(NRF_PWR_MGMT_SHUTDOWN_GOTO_DFU);
        SEGGER_RTT_printf(0, "nrf_pwr_mgmt_shutdown NRF_PWR_MGMT_SHUTDOWN_GOTO_DFU and system reset.");
            nrf_delay_ms(5);
        NVIC_SystemReset();
    }
    #endif
    
    int main(void)
    {
        ret_code_t err_code;
        SEGGER_RTT_printf(0, "Start application.");
            nrf_delay_ms(5);
        /* Initialize clock driver for better time accuracy in FREERTOS */
        err_code = nrf_drv_clock_init();
        APP_ERROR_CHECK(err_code);
        clocks_start();
        /* Configure LED-pins as outputs */
        bsp_board_init(BSP_INIT_LEDS);
    
        // enter_dfu();
    
        thread_main();
    
        /* Activate deep sleep mode */
        SCB->SCR |= SCB_SCR_SLEEPDEEP_Msk;
    
        /* Start FreeRTOS scheduler. */
        vTaskStartScheduler();
    
        while (true)
        {
            /* FreeRTOS should not be here... FreeRTOS goes back to the start of stack
             * in vTaskStartScheduler function. */
        }
    }
    
    /**
     *@}
     **/
    

    6648.sdk_config.h

    /**
     * Copyright (c) 2014 - 2021, Nordic Semiconductor ASA
     *
     * All rights reserved.
     *
     * Redistribution and use in source and binary forms, with or without modification,
     * are permitted provided that the following conditions are met:
     *
     * 1. Redistributions of source code must retain the above copyright notice, this
     *    list of conditions and the following disclaimer.
     *
     * 2. Redistributions in binary form, except as embedded into a Nordic
     *    Semiconductor ASA integrated circuit in a product or a software update for
     *    such product, must reproduce the above copyright notice, this list of
     *    conditions and the following disclaimer in the documentation and/or other
     *    materials provided with the distribution.
     *
     * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
     *    contributors may be used to endorse or promote products derived from this
     *    software without specific prior written permission.
     *
     * 4. This software, with or without modification, must only be used with a
     *    Nordic Semiconductor ASA integrated circuit.
     *
     * 5. Any software provided in binary form under this license must not be reverse
     *    engineered, decompiled, modified and/or disassembled.
     *
     * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
     * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
     * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
     * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
     * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
     * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     *
     */
    /** @file
     * @defgroup uart_example_main main.c
     * @{
     * @ingroup uart_example
     * @brief UART Example Application main file.
     *
     * This file contains the source code for a sample application using UART.
     *
     */
    
    #include "thread.h"
    
    #include <stdbool.h>
    #include <stdint.h>
    #include <stdio.h>
    #include "app_uart.h"
    #include "app_error.h"
    #include "nrf_delay.h"
    #include "nrf.h"
    #include "bsp.h"
    #if defined (UART_PRESENT)
    #include "nrf_uart.h"
    #endif
    #if defined (UARTE_PRESENT)
    #include "nrf_uarte.h"
    #endif
    #include "uart.h"
    #include "nrf_drv_clock.h"
    #include "esb.h"
    #include "pairing_cmd.h"
    
    
    #define UART_PRINTF( ... )  SEGGER_RTT_printf(0, __VA_ARGS__)
    
    
    uint32_t app_timer_cnt_get(void)
    {
        return xTaskGetTickCount();
    }
    
    uint32_t app_timer_cnt_diff_compute(uint32_t ticks_to,
                                        uint32_t ticks_from)
    {
        return ((ticks_to - ticks_from) & RTC_COUNTER_COUNTER_Msk);
    }
    
    uint8_t data_array[UART_RX_BUF_SIZE];
    static uint8_t index = 0;
    static uint8_t flag = 0;
    
    #include "nrf_libuarte_async.h"
    #include <bsp.h>
    #include "nrf_queue.h"
    
    NRF_LIBUARTE_ASYNC_DEFINE(libuarte, 0, 0, 0, NRF_LIBUARTE_PERIPHERAL_NOT_USED, 255, 3);
    
    static uint8_t text[] = "UART example started.\r\n Loopback:\r\n";
    static uint8_t text_size = sizeof(text);
    static volatile bool m_loopback_phase;
    
    typedef struct {
        uint8_t * p_data;
        uint32_t length;
    } buffer_t;
    
    NRF_QUEUE_DEF(buffer_t, m_buf_queue, 10, NRF_QUEUE_MODE_NO_OVERFLOW);
    
    void uart_event_handler(void * context, nrf_libuarte_async_evt_t * p_evt)
    {
        nrf_libuarte_async_t * p_libuarte = (nrf_libuarte_async_t *)context;
        ret_code_t ret;
    
        switch (p_evt->type)
        {
            case NRF_LIBUARTE_ASYNC_EVT_ERROR:
                bsp_board_led_invert(0);
                break;
            case NRF_LIBUARTE_ASYNC_EVT_RX_DATA:
                ret = nrf_libuarte_async_tx(p_libuarte,p_evt->data.rxtx.p_data, p_evt->data.rxtx.length);
                buffer_t buf = {
                    .p_data = p_evt->data.rxtx.p_data,
                    .length = p_evt->data.rxtx.length,
                };
                if (ret == NRF_ERROR_BUSY)
                {
    
                    ret = nrf_queue_push(&m_buf_queue, &buf);
                    APP_ERROR_CHECK(ret);
                }
                else
                {
                    APP_ERROR_CHECK(ret);
                }
                m_loopback_phase = true;
                uart_cmd_set(buf.p_data, buf.length);
                // memcpy(data_array, buf.p_data, buf.length);
                // flag = 1;
                break;
            case NRF_LIBUARTE_ASYNC_EVT_TX_DONE:
                if (m_loopback_phase)
                {
                    nrf_libuarte_async_rx_free(p_libuarte, p_evt->data.rxtx.p_data, p_evt->data.rxtx.length);
                    if (!nrf_queue_is_empty(&m_buf_queue))
                    {
                        buffer_t buf;
                        ret = nrf_queue_pop(&m_buf_queue, &buf);
                        APP_ERROR_CHECK(ret);
                        UNUSED_RETURN_VALUE(nrf_libuarte_async_tx(p_libuarte, buf.p_data, buf.length));
                    }
                }
                break;
            default:
                break;
        }
    }
    
    void uart_init()
    {
        uint8_t err_code;
        nrf_libuarte_async_config_t nrf_libuarte_async_config = {
                .tx_pin     = TX_PIN_NUMBER,
                .rx_pin     = RX_PIN_NUMBER,
                .baudrate   = NRF_UARTE_BAUDRATE_921600,
                .parity     = NRF_UARTE_PARITY_EXCLUDED,
                .hwfc       = NRF_UARTE_HWFC_DISABLED,
                .timeout_us = 0,
                .int_prio   = APP_IRQ_PRIORITY_HIGH,
                .pullup_rx  = 1
        };
    
        err_code = nrf_libuarte_async_init(&libuarte, &nrf_libuarte_async_config, uart_event_handler, (void *)&libuarte);
        UART_PRINTF("nrf_libuarte_async_init err_code = %d.", err_code);
        APP_ERROR_CHECK(err_code);
    
        nrf_libuarte_async_enable(&libuarte);
    
        // err_code = nrf_libuarte_async_tx(&libuarte, text, text_size);
        // UART_PRINTF("nrf_libuarte_async_tx err_code = %d.", err_code);
        // APP_ERROR_CHECK(err_code);
    }
    
    #endif
    
    /**
     * @brief Function for main application entry.
     */
    void uart_main(void)
    {
    	#if 0
        while (flag)
        {
            UART_PRINTF("data_array = %s", data_array);
            memset(&data_array, 0, UART_RX_BUF_SIZE);
            flag = 0;
        }
    	#endif
    }
    
    /** @} */
    

    /* FreeRTOS hearder */
    #include "thread.h"
    #include "uart.h"
    #include "nrf_delay.h"
    
    /**************************** task handler ********************************/
    /* 
     * create task handler
     * if operate self , value can be NULL。
     * 
     */
    // static TaskHandle_t AppTaskCreate_Handle;
    
    TaskHandle_t RunTimeStats_Task_Handle;
    TaskHandle_t Uart_Task_Handle;
    
    /********************************** core handler *********************************/
    /*
     * sem,queue,event,timer...
     * 
     */
    
    
    /******************************* Global variable ************************************/
    /*
     * Global variable
     */
    
    /******************************* Macro Define ***************************************/
    /*
     * Macro Define
     */
    /*
    ****************************************************************************
    *                              task name
    *****************************************************************************
    */
    #define RunTimeStatsTaskName                             "RunTimeStatsTask"
    #define Uart_TaskName                                    "Uart_Task"
    
    /*
    ****************************************************************************
    *                               size
    *****************************************************************************
    */
    #define RunTimeStatsTaskSize                                      ( 128 )
    #define Uart_TaskSize                                             ( 1024 )
    
    /*
    ****************************************************************************
    *                               prio
    *****************************************************************************
    */
    /*
    MAX prio in FreeRTOS
    
    #define configMAX_PRIORITIES                                                      ( 7 )
    */
    
    #define RunTimeStatsTaskPrio                                      ( 3 )
    #define Uart_TaskPrio                                             ( 5 )
    
    /*
    *****************************************************************************
    *                              handler
    *****************************************************************************
    */
    
    extern TaskHandle_t RunTimeStats_Task_Handle;                        // Run state
    extern TaskHandle_t Uart_Task_Handle;                                // Uart
    
    /*
    *************************************************************************
    *                             Funtion
    *************************************************************************
    
     /**********************************************************************
      * @ Fun  : RunTimeStatsTask
      * @ param   :   
      * @ retval  : null
      ********************************************************************/
    
    void RunTimeStatsTask(void)
    {
        while(1)
        {
            int val;
            SEGGER_RTT_printf(0, "TaskName\t\t\t\tPrio\t\t\t\tStackSize");
            val = uxTaskGetStackHighWaterMark(Uart_Task_Handle);
            SEGGER_RTT_printf(0, "%s\t\t\t\t%d\t\t\t\t%d", Uart_TaskName, Uart_TaskPrio, val);
            vTaskDelay(10000);
        }
    }
    
    /**********************************************************************
      * @ Fun  : Uart_task test
      * @ param   :   
      * @ retval  : null
      ********************************************************************/
    void Uart_Task(void* parameter)
    {
        uart_init();
    
        while(1)
        {
            uart_main();
            vTaskDelay(2);
        }
    }
    
    /*****************************************************************
      * @brief  HardWare_init
      * @param  null
      * @retval null
      * @note   init all hardware
      ****************************************************************/
    void HardWare_init(void)
    {
    
    }
    
    /*****************************************************************
      * @brief  main
      * @param  null
      * @retval null
      * @note   thread manager main
      ****************************************************************/
    int thread_main(void)
    {
        BaseType_t xReturn = pdPASS;
        int size = 0;
    
        HardWare_init();
    
        taskENTER_CRITICAL();
    
        xReturn = xTaskCreate((TaskFunction_t )Uart_Task,                 // enter fun
                            (const char*    )Uart_TaskName,               // name
                            (uint16_t       )Uart_TaskSize,               // size
                            (void*          )NULL,                        // enter param
                            (UBaseType_t    )Uart_TaskPrio,               // prio
                            (TaskHandle_t*  )&Uart_Task_Handle);          // task handle 
    
        SEGGER_RTT_printf(0, " xTaskCreate Uart_Task = %d\r\n", xReturn);
        if(pdPASS == xReturn)
            SEGGER_RTT_printf(0, "Uart_Task Create Done!\r\n");
    
        size = xPortGetFreeHeapSize();
        SEGGER_RTT_printf(0, "heap size = %d\r\n", size);
    
        taskEXIT_CRITICAL();
        if(pdPASS != xReturn)
            return -1;
        return pdPASS;
    }
    
    

    BR,

    Lurn

  • Maybe I've entered a misunderstanding, my device need receive 32bytes data per 4ms, and process it.

    So, for my test, I shouldn't print it by UART after receive data, because TX also spend time?

    I modified the way to print the log (it will be display by RTT now),but it still many wrong formats.

    logs like that, I send 32B data (ZZZ.....for test), Sometimes it is split into two parts

    Can you see something wrong with my code?
    The location I modified is here, maybe this modification is not appropriate.
    void uart_event_handler(void * context, nrf_libuarte_async_evt_t * p_evt)
    {
        ....
    
        switch (p_evt->type)
        {
            ...
            
            case NRF_LIBUARTE_ASYNC_EVT_RX_DATA:
                // ret = nrf_libuarte_async_tx(p_libuarte,p_evt->data.rxtx.p_data, p_evt->data.rxtx.length);
                ret = 0;
                buffer_t buf = {
                    .p_data = p_evt->data.rxtx.p_data,
                    .length = p_evt->data.rxtx.length,
                };
                if (ret == NRF_ERROR_BUSY)
                {
    
                    ret = nrf_queue_push(&m_buf_queue, &buf);
                    APP_ERROR_CHECK(ret);
                }
                else
                {
                    APP_ERROR_CHECK(ret);
                }
                m_loopback_phase = true;
                memcpy(data_array, buf.p_data, buf.length);
                flag = 1;
                nrf_libuarte_async_rx_free(p_libuarte, p_evt->data.rxtx.p_data, p_evt->data.rxtx.length);
                break;
            
            ...
            
                break;
        }
    }
    BR,
    Lurn
  • you can see the application in examples/peripheral/blinky_freertos/pca10040/blank/arm5_no_packs.

    I removed a lot of things that were not related to UART. So, maybe it looks like a bit of a mess.
    BR,
    Lurn
  • maybe you need to modify the start address, because in another ticket I need program MBR, so I modify it to 0X1000.

  • Hi Einar,

    Did you find anything in my application?

    I can't find the reason for this question.

    BR,

    Lurn

Reply Children
  • Hi Lurn,

    I have not tested your application on my end, but I have had a closer look, and the UART related code seems good to me.

    The screenshot you showed where many Z characters were received seems to indicate that there is no data loss, though - only that you got two events for what I assume conceptually was one transaction? You will get data when there is a timeout (packet boundary) or when the Rx buffer is full. What happens if you adjust the timeout here in your uart_init() function?

    Einar

  • I modify the timeout to 10 or 100 or 1000, it looks like same..

    timeout is 100us in this logs.

     

  • here is no data loss, though - only that you got two events for what I assume conceptually was one transaction

    Yes, I think so, the data is not lost, just became two parts.

    You will get data when there is a timeout (packet boundary) or when the Rx buffer is full.

    I think it's really about Rx buffer, cause when I change the buffer size from 256 to 64 the data was be split earlier.

    NRF_LIBUARTE_ASYNC_DEFINE(libuarte, 0, 0, 0, NRF_LIBUARTE_PERIPHERAL_NOT_USED, 64, 3);

    But, the rx buffer was cleared everytime I received data.

    I used that nrf_libuarte_async_rx_free(p_libuarte, p_evt->data.rxtx.p_data, p_evt->data.rxtx.length);

    Do you have any other solution?

    And I have another question that I need a frequency of 500 times per second, but when I test the application,I don't think it can reach this frequency. Because I get the logs in 9 second, it just 260 times data. Also I will check the sender frequency, and I hope you can give me some suggestions.

    BR,

    Lurn

  • After my test, Here is 3 questions.

    I send 32 bytes, the data head is A5 C5, and print 34 bytes so the last two data should be 0.

    (uint8_t data_array[256] = {0};)

    1. When the sender sending data slowly, about 25 times per second, logs looks like that.

    After receiving several pieces of data, one of it was split into two parts

    2. When the sender sending data quickly, (250 times per second), data will be lost, Only 30 pieces of data are received per second.

    3. When the sender sending data quickly, (250 times per second), logs looks like that.

    There is an exception in the data format,

    Hope you can give me some suggestions.

    BR,

    Lurn

  • Hi Lurn,

    I am not able to pinpoint what is happening in your application. However, as we have discussed before, you get the Rx events either for timeout (interpreted as a packet boundary) or a full buffer. This means that you are not guaranteed to only get events for a packet boundary, and if that is something you need, you need an additional layer of "filtering" to handle that.

    It is difficult to know what happens in your application. It could be that data is not handled in a timely manner because there are too much delays / CPU usage of other parts. Do you see the same issue if you comment out most of the other code/threads, so that you are only receiving UART data? If not, then that would point to this being related. And if so you may need to consider optimizing other parts in order to resolve this issue.

    Einar

Related