meta data for this page
  •  

nrf_queue race from IRQ

When SD_ENABLED macros for critical section doesn't disable all IRQs. Especially RADIO_IRQ. For more see critical sections.

So RADIO IRQ can interrupt main loop code or any other lower level IRQ where NRF's queue is used and also execute code where NRF's queue is used. Example call stack:

#0  nrf_queue_generic_pop (
    p_queue=p_queue@entry=0x75620 <m_radio_tx_payload_queue>, 
    p_element=p_element@entry=0x2000a094 <ctx+40>, 
    just_peek=just_peek@entry=false)
    at ../../3rdParty/nrf5-sdk/components/libraries/queue/nrf_queue.c:240
#1  0x000595dc in radio_tx_payload_queue_pop (p_element=0x2000a094 <ctx+40>)
    at ../../src/module/radio/radio_comm_user.c:85
#2  prepare_to_tx () at ../../src/module/radio/radio_comm_user.c:209
#3  process_tx_queue () at ../../src/module/radio/radio_comm_user.c:237
#4  radio_comm_user_prepare_tx_data (user_data=0x20009ee3 <packet_buf+19>)
    at ../../src/module/radio/radio_comm_user.c:268
#6  0x00057c3c in radio_tx_data_prepare ()
#8  radio_rx_disable_handle () at ../../src/module/radio/radio_rx.c:348
 
#9  <signal handler called>
 
#10 0x0005d9e6 in memcpy ()
#11 0x00029340 in nrf_queue_push (
    p_queue=p_queue@entry=0x75620 <m_radio_tx_payload_queue>, 
    p_element=0x2003fea8, p_element@entry=0x2003fea0)
    at ../../3rdParty/nrf5-sdk/components/libraries/queue/nrf_queue.c:205
#12 0x0005949a in radio_tx_payload_queue_push (p_element=0x2003fea0)
    at ../../src/module/radio/radio_comm_user.c:85
#13 radio_comm_user_push (p=p@entry=0x2003fea8)
    at ../../src/module/radio/radio_comm_user.c:122
...
#17 0x0002900e in app_sched_execute ()
    at ../../3rdParty/nrf5-sdk/components/libraries/scheduler/app_scheduler.c:280
#18 0x00055b58 in scheduler_execute () at ../../src/sys/scheduler.c:35
#19 0x000273a8 in main () at src/main.c:134