Multiple UART on NRF52833 with FreeRTOS

Hello Everybody,

I have an advance project where I'm using FreeRTOS in a nrf52833. Now I want to use 2 UARTs through the libUARTE library. 

I saw a similar post where somebody attempted the same:  Multiple UART on NRF52833 

Unfortunately from the post is not clear how to get pass the linker problem:

.\_build\nrf52833_xxaa.axf: Error: L6218E: Undefined symbol app_timer_cnt_diff_compute (referred from nrf_libuarte_async.o).
.\_build\nrf52833_xxaa.axf: Error: L6218E: Undefined symbol app_timer_cnt_get (referred from nrf_libuarte_async.o).

The main problem seems to be that FreeRTOS defines the same functions as appTimer2, and so far I haven't seen a single example code where somebody manages to get FreeRTOS running and the libUARTE with 2 UARTs at the same time?

Can somebody help me?

Parents Reply
  • Not sure why the app_timer_freertos.c chose to exclude to implement these functions, but you can easily add them as below

    uint32_t app_timer_cnt_get(void)
    {
        return xTaskGetTickCount();
    }
    
    #define MAX_RTC_COUNTER_VAL 0x00FFFFFF /**< Maximum value of the RTC counter. */
    uint32_t app_timer_cnt_diff_compute(uint32_t   ticks_to,
                                        uint32_t   ticks_from)
    {
        return ((ticks_to - ticks_from) & MAX_RTC_COUNTER_VAL);
    }

Children
  • Hello Susheel,

    thanks for the code, that solved the issue and I finally manage to get at least 1 UART running. Although I had to work my way in some functions, e.g.:

    1. To initialize the UART I had to change the priority of the interrupt from  APP_IRQ_PRIORITY_LOW toAPP_IRQ_PRIORITY_LOW_MID  

                nrf_libuarte_async_config = {

                .tx_pin     = BL_GNSS_RX,
                .rx_pin     = BL_GNSS_TX,
                .baudrate   = NRF_UARTE_BAUDRATE_9600,
                .parity     = NRF_UARTE_PARITY_EXCLUDED,
                .hwfc       = NRF_UARTE_HWFC_DISABLED,
                .timeout_us = 100,
                .int_prio   = APP_IRQ_PRIORITY_LOW_MID};
    2. For some reason I cannot use the instance of timer0 in the initialization, so I had to use timer1: 

                 NRF_LIBUARTE_ASYNC_DEFINE(libuarte,  0, 1, 1, NRF_LIBUARTE_PERIPHERAL_NOT_USED, 255, 3);

    I still haven't manage to get the transmiter working, but at least there is some progress done, so I'll verify your answer because it solved the problem with the linker error. I'll keep you posted when I manage to get the transmitter working.

Related