This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Seeking for a Race Condiction

Hello,

while implementing a BLE link layer, I’ve stumbled over a race condition, where I have a problem to find the cause. Maybe someone of you have an idea, on how to further investigate this.

The software utilizes the timer0 and the radio hardware. Basically it sets up a timer by setting CC[0] and enables channel 21 of the pre-programmed PPI channels. That channel connects the EVENTS_COMAPARE[0], with the TASK_RXEN of the radio, so that the radio starts to receive. In addition CC[1] is set to a timeout value that is used to disable the radio in combination with an other pre-programmed PPI channel (channel 22). So, in case of a received datagram or in case of a timeout, the radio EVENTS_DISABLED is triggered.

Before I setup the interrupt, I disable the radio interrupts, clear the interrupt flags, then enable the interrupts.

This works fine so far, but once in while (within a few minutes), the interrupt handler is not called. When I use a debugger to inspect the timer and the radio, I see that for the radio, the EVENTS_DISABLED is set and that the interrupt is enabled (INTENSET = 16), but from the state of the software, I can see that the interrupt handler was not called.

What can cause such a situation?

Thank you for any help, tipps, feedback, recommendation, etc.

Kind regards,

Torsten

here is the source (starting at line 309-428): github.com/.../nrf51.cpp

This is the output from the debugger:

(gdb) p *this
$1 = {callbacks_ = @0x20000934, timeout_ = false, received_ = false, evt_timeout_ = false, end_evt_ = false, 
  static connection_event_type_base = 100, state_ = bluetoe::nrf51_details::scheduled_radio_base::evt_wait_connect, 
  anchor_offset_ = {usec_ = 610977239}, receive_buffer_ = {buffer = 0x20000991 <server+93> "\r", size = 29}, empty_receive_ = "\000"}
(gdb) p *nrf_timer
$2 = {TASKS_START = 0, TASKS_STOP = 0, TASKS_COUNT = 0, TASKS_CLEAR = 0, TASKS_SHUTDOWN = 0, RESERVED0 = {0 <repeats 11 times>}, 
  TASKS_CAPTURE = {0, 0, 0, 0}, RESERVED1 = {0 <repeats 60 times>}, EVENTS_COMPARE = {1, 1, 0, 0}, RESERVED2 = {
    0 <repeats 44 times>}, SHORTS = 0, RESERVED3 = {0 <repeats 64 times>}, INTENSET = 0, INTENCLR = 0, RESERVED4 = {
    0 <repeats 126 times>}, MODE = 0, BITMODE = 3, RESERVED5 = 0, PRESCALER = 4, RESERVED6 = {0 <repeats 11 times>}, CC = {
    610989595, 610990745, 610989819, 14925125}, RESERVED7 = {0 <repeats 429 times>, 4294967292, 4294967292, 4294967292, 
    0 <repeats 250 times>, 1}, POWER = 1}
(gdb) p *nrf_radio
$3 = {TASKS_TXEN = 0, TASKS_RXEN = 0, TASKS_START = 0, TASKS_STOP = 0, TASKS_DISABLE = 0, TASKS_RSSISTART = 0, TASKS_RSSISTOP = 0, 
  TASKS_BCSTART = 0, TASKS_BCSTOP = 0, RESERVED0 = {0 <repeats 55 times>}, EVENTS_READY = 1, EVENTS_ADDRESS = 1, EVENTS_PAYLOAD = 1, 
  EVENTS_END = 1, EVENTS_DISABLED = 1, EVENTS_DEVMATCH = 0, EVENTS_DEVMISS = 1, EVENTS_RSSIEND = 0, RESERVED1 = {1, 1}, 
  EVENTS_BCMATCH = 0, RESERVED2 = {0 <repeats 53 times>}, SHORTS = 3, RESERVED3 = {0 <repeats 64 times>}, INTENSET = 16, 
  INTENCLR = 16, RESERVED4 = {0 <repeats 61 times>}, CRCSTATUS = 1, CD = 1, RXMATCH = 0, RXCRC = 2231456, DAI = 0, RESERVED5 = {0, 
    2, 0, 6, 0 <repeats 56 times>}, PACKETPTR = 536873361, FREQUENCY = 76, TXPOWER = 0, MODE = 3, PCNF0 = 264, PCNF1 = 33751069, 
  BASE0 = 2595609600, BASE1 = 0, PREFIX0 = 175, PREFIX1 = 0, TXADDRESS = 0, RXADDRESSES = 1, CRCCNF = 259, CRCPOLY = 1627, 
  CRCINIT = 8872094, TEST = 0, TIFS = 150, RSSISAMPLE = 0, RESERVED6 = 0, STATE = 0, DATAWHITEIV = 99, RESERVED7 = {0, 255}, 
  BCC = 0, RESERVED8 = {0 <repeats 39 times>}, DAB = {0, 0, 0, 0, 0, 0, 0, 0}, DAP = {0, 0, 0, 0, 0, 0, 0, 0}, DACNF = 0, 
  RESERVED9 = {0, 0, 0, 0, 0, 0, 0, 1, 0 <repeats 39 times>, 1, 0, 1, 5, 0, 0, 0, 0, 0}, OVERRIDE0 = 2097174016, 
  OVERRIDE1 = 1543503952, OVERRIDE2 = 1745782788, OVERRIDE3 = 7496740, OVERRIDE4 = 2186232382, RESERVED10 = {0 <repeats 307 times>, 
    4294967292, 0 <repeats 252 times>, 1}, POWER = 1}
Parents Reply Children
No Data
Related