This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Possible bug in libuarte (nrf_libuarte_async.c)

Hello

Our application runs over nRF52840 + SDK16 + freeRTOS. While integrating libuarte library with our application we found an issue whereby if nrf_libuarte_async_init() is called with p_config->int_prio = 6 then this functions returns NRF_ERROR_INVALID_PARAM because of the condition below:

ret_code_t nrf_libuarte_async_init(const nrf_libuarte_async_t * const p_libuarte,
                                        nrf_libuarte_async_config_t const * p_config,
                                        nrf_libuarte_async_evt_handler_t evt_handler,
                                        void * context)
{
    ret_code_t ret;

    if (p_config->int_prio == APP_IRQ_PRIORITY_LOWEST ||
        ((p_libuarte->p_app_timer && NRF_LIBUARTE_ASYNC_WITH_APP_TIMER) &&
         (p_config->int_prio > APP_TIMER_CONFIG_IRQ_PRIORITY))) {           // [8Power] Change here from ">=" to ">"
        NRF_LOG_ERROR("Too low priority. Lowest possible priority is %d", APP_IRQ_PRIORITY_LOW);
        return NRF_ERROR_INVALID_PARAM;
    }
    
    ...
    ...
}

We think that the check (p_config->int_prio >= APP_TIMER_CONFIG_IRQ_PRIORITY) is wrong and should be replaced with (p_config->int_prio > APP_TIMER_CONFIG_IRQ_PRIORITY) since priority of 6 should be acceptable in a system with Softdevice enabled.

Please share your thoughts.

Kind regards

Shrey

Related