While debugging the NCS 54L15 ESB module, I observed some anomalies when measuring the radio interrupt signal. For example, after the RADIO READY event is generated, it should immediately trigger the RADIO IRQ handler. However, I measured a delay of approximately 16 microseconds between the READY signal generation and the entry into the RADIO IRQ handler. A similar delay also exists between the DISABLE signal and the RADIO IRQ handler entry. Why is this happening?(Measurement method: Using DPPI and PPIB to connect the RADIO event publish signal to GPIO task A. Immediately upon entering the RADIO IRQ handler, another pin B is set high, and the time difference between the two pins is measured.)
The following is part of my configuration:
//about gpiote
void gpiote_init(uint32_t port, uint32_t pin, uint32_t gpiote_ch)
{
NRF_GPIOTE20->CONFIG[gpiote_ch] = 3 << 0 | pin << 4 | port << 9 | 1 << 16 | 0 << 20;
}
void evt_ppi_init()
{
//ready
nrf_radio_publish_set(NRF_RADIO, NRF_RADIO_EVENT_READY, 12);
NRF_DPPIC10->CHENSET = 1 << 12;
NRF_P1->PIN_CNF[12] = 1 << 8 | 1 << 10;
gpiote_init(1, 12, 3);
NRF_GPIOTE20->SUBSCRIBE_SET[3] = 1 << 31 | 12;
NRF_DPPIC20->CHENSET = 1 << 12;
NRF_PPIB11->SUBSCRIBE_SEND[12] = 1 << 31 | 12;
NRF_PPIB21->PUBLISH_RECEIVE[12] = 1 << 31 | 12;
//disable
nrf_radio_publish_set(NRF_RADIO, NRF_RADIO_EVENT_DISABLED, 11);
NRF_DPPIC10->CHENSET = 1 << 11;
NRF_P1->PIN_CNF[9] = 1 << 8 | 1 << 10;
gpiote_init(1, 9, 2);
NRF_GPIOTE20->SUBSCRIBE_SET[2] = 1 << 31 | 11;
NRF_DPPIC20->CHENSET = 1 << 11;
NRF_PPIB11->SUBSCRIBE_SEND[11] = 1 << 31 | 11;
NRF_PPIB21->PUBLISH_RECEIVE[11] = 1 << 31 | 11;
NRF_P1->PIN_CNF[13] = 1 << 8 | 1 << 10;
gpiote_init(1, 13, 1);
}
//about radio irq
static void radio_irq_handler(void)
{
NRF_GPIOTE20->TASKS_SET[1] = 1;
if (nrf_radio_int_enable_check(NRF_RADIO, NRF_RADIO_INT_READY_MASK) &&
nrf_radio_event_check(NRF_RADIO, NRF_RADIO_EVENT_READY)) {
nrf_radio_event_clear(NRF_RADIO, NRF_RADIO_EVENT_READY);
LOG_INF("ready");
}
if (nrf_radio_int_enable_check(NRF_RADIO, NRF_RADIO_INT_DISABLED_MASK) &&
nrf_radio_event_check(NRF_RADIO, NRF_RADIO_EVENT_DISABLED)) {
nrf_radio_event_clear(NRF_RADIO, NRF_RADIO_EVENT_DISABLED);
radio_LL_fsm(LL_EVT_DISABLE);
nrf_radio_event_clear(NRF_RADIO, ESB_RADIO_EVENT_END);
}
NRF_GPIOTE20->TASKS_CLR[3] = 1;
NRF_GPIOTE20->TASKS_CLR[2] = 1;
NRF_GPIOTE20->TASKS_CLR[1] = 1;
}
.....
{
......
#if IS_ENABLED(CONFIG_ESB_DYNAMIC_INTERRUPTS)
/* Ensure IRQs are disabled before attaching. */
esb_irq_disable();
ARM_IRQ_DIRECT_DYNAMIC_CONNECT(ESB_RADIO_IRQ_NUMBER, CONFIG_ESB_RADIO_IRQ_PRIORITY,
0, reschedule);
ARM_IRQ_DIRECT_DYNAMIC_CONNECT(ESB_EVT_IRQ_NUMBER, CONFIG_ESB_EVENT_IRQ_PRIORITY,
0, reschedule);
ARM_IRQ_DIRECT_DYNAMIC_CONNECT(ESB_TIMER_IRQ, CONFIG_ESB_EVENT_IRQ_PRIORITY,
0, reschedule);
irq_connect_dynamic(ESB_RADIO_IRQ_NUMBER, CONFIG_ESB_RADIO_IRQ_PRIORITY,
radio_dynamic_irq_handler, NULL, 0);
irq_connect_dynamic(ESB_EVT_IRQ_NUMBER, CONFIG_ESB_EVENT_IRQ_PRIORITY,
evt_dynamic_irq_handler, NULL, 0);
irq_connect_dynamic(ESB_TIMER_IRQ, CONFIG_ESB_EVENT_IRQ_PRIORITY,
timer_dynamic_irq_handler, NULL, 0);
#else /* !IS_ENABLED(CONFIG_ESB_DYNAMIC_INTERRUPTS) */
IRQ_DIRECT_CONNECT(ESB_RADIO_IRQ_NUMBER, CONFIG_ESB_RADIO_IRQ_PRIORITY,
esb_radio_direct_irq_handler, 0);
IRQ_DIRECT_CONNECT(ESB_EVT_IRQ_NUMBER, CONFIG_ESB_EVENT_IRQ_PRIORITY,
esb_evt_direct_irq_handler, 0);
IRQ_DIRECT_CONNECT(ESB_TIMER_IRQ, CONFIG_ESB_EVENT_IRQ_PRIORITY,
ESB_TIMER_IRQ_HANDLER, 0);
#endif /* IS_ENABLED(CONFIG_ESB_DYNAMIC_INTERRUPTS) */
irq_enable(ESB_RADIO_IRQ_NUMBER);
irq_enable(ESB_EVT_IRQ_NUMBER);
if (IS_ENABLED(ESB_EVT_USING_EGU)) {
nrf_egu_int_enable(ESB_EGU, ESB_EGU_EVT_INT);
}
irq_enable(ESB_TIMER_IRQ);
esb_state = ESB_STATE_IDLE;
esb_initialized = true;
if (nrf52_errata_182()) {
/* Check if the device is an nRF52832 Rev. 2. */
/* Workaround for nRF52832 rev 2 errata 182 */
*(volatile uint32_t *)0x4000173C |= (1 << 10);
}
}
//autoconf.h
.....
.....
#define CONFIG_ESB_RADIO_IRQ_PRIORITY 1
#define CONFIG_ESB_EVENT_IRQ_PRIORITY 2
My question is: Is this a known hardware issue, or is the RADIO IRQ being delayed by the Zephyr system scheduling, or enter sleep?
