Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Bug in nrf_libuarte_async.c

There is a bug in the nrf_libuarte_async.c file :

    PPI_CH_SETUP(m_ppi_channels[PPI_CH_RXRDY_CLEAR],
                 nrf_uarte_event_address_get(UART_DRV_UARTE, NRF_UARTE_EVENT_RXDRDY),
                 nrfx_timer_task_address_get(&m_timer, NRF_TIMER_TASK_START),
                 nrfx_timer_task_address_get(&m_timer, NRF_TIMER_TASK_CLEAR));

The first argument to the macro is "m_ppi_channels[PPI_CH_RXRDY_CLEAR]". The macro itself is defined as:

#define PPI_CH_SETUP(_ch, _evt, _tsk, _fork)                            \
    ret = nrfx_ppi_channel_assign(m_ppi_channels[_ch], _evt, _tsk);     \
    if (ret != NRF_SUCCESS)                                             \
    {                                                                   \
        return NRF_ERROR_INTERNAL;                                      \
    }                                                                   \
    if (_fork)                                                          \
    {                                                                   \
        ret = nrfx_ppi_channel_fork_assign(m_ppi_channels[_ch], _fork); \
        if (ret != NRF_SUCCESS)                                         \
        {                                                               \
            return NRF_ERROR_INTERNAL;                                  \
        }                                                               \
    }

As you can see, the macro uses "m_ppi_channels[_ch]" instead of just "_ch", which expands to the invalid "m_ppi_channels[m_ppi_channels[PPI_CH_RXRDY_CLEAR]]" expression

Related