nrfx_event_to_bitpos() and nrfx_bitpos_to_event() functions don't work for the nRF54L radio. Alternatives?

I was developing with the nRF54L15DK, creating a Radio driver to do Proprietary 2.4GHz communication.  In the driver, I use nrfx_event_to_bitpos() and nrfx_bitpos_to_event() to calculate interrupt masks given NRF_RADIO_EVENT_X enumeration values, and I was running into issues with that approach.  

It looks like the nrfx_common.h file assumes an offset of 0x100, but the nRF54L15 Radio peripheral has an offset of 0x200 for the event registers.  

NRF_STATIC_INLINE uint32_t nrfx_bitpos_to_event(uint32_t bit)
{
    static const uint32_t event_reg_offset = 0x100u;
    return event_reg_offset + (bit * sizeof(uint32_t));
}

NRF_STATIC_INLINE uint32_t nrfx_event_to_bitpos(uint32_t event)
{
    static const uint32_t event_reg_offset = 0x100u;
    return (event - event_reg_offset) / sizeof(uint32_t);
}

Is there an alternative NRFX supported function for this conversion that I am missing?

Parents Reply
  • Thank you for the reply, but this NRFY helper contains the same issue as the nrfx_event_to_bitpos() function.  The events for the nRF54-series RADIO start at 0x200!

    #define NRFY_EVENT_TO_INT_BITPOS(event) ((((uint32_t)(event)) - 0x100) >> 2)

    In the meantime, while this bug still exists in NCS, I will use the following code to allow for correct RADIO functionality with both the nRF52 and nRF54 series.

    #if defined(NRF54L_SERIES)
    #define RADIO_EVENT_TO_INT_BITPOS                  (((event) - 0x200u) / sizeof(uint32_t))
    #define RADIO_EVENT_TO_INT_BITMASK                 (BIT(RADIO_EVENT_TO_INT_BITPOS))
    #else
    #define RADIO_EVENT_TO_INT_BITPOS                  (NRFY_EVENT_TO_INT_BITPOS(event))
    #define RADIO_EVENT_TO_INT_BITMASK                 (NRFY_EVENT_TO_INT_BITMASK(event))
    #endif

    Thanks,

    Cory

Children
No Data
Related