This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Contiki contikimac.c:powercycle() disables interrupts

Other Parts Discussed in Thread: CC2650

I am building an application on a CC2650 under Contiki which needs to run at low power when not operational, then work as a real-time system with no power cycling, while it is operaitonal.  Powercycle() busy-waits at RTC0 interrupt time, completely blocking interrupts for a few milliseconds or more, once every 120 milliseconds or so, and, with network traffic, busy-waiting for much longer than even that.  I assume that this behavior is associated with radio power cycling, which is not something I need during operation anyway, so I would like to just disable this behavior during operation, in the hope of recovering full interrupt response.

If I prevent calls to powercycle(), I do get the response I want, but the network stops working.  After several attempts at minor modification, I have not found a way to get both network operation and solid interrupt response.  In an effort to avoid more research on the matter, I would like to know if anyone knows of a straightforward way to keep powercycle() from busy-waiting and blocking interrupts, without breaking network operation.

Thanks!

  • I have done some further research, and I believe I have found the problem. In cpu/cc26xx-cc13xx/rf-core/ieee-mode.c, in check_rat_overflow() and transmit(), the state of the ARM PRIMASK bit is read into a variable named "interrupts_enabled", and interrupts are later enabled if this variable is true. PRIMASK is true if interrupts are disabled, not enabled, so the PRIMASK state is complemented by this algorithm, causing interrupts to be disabled in the background, and probably causing other problems as well.

    I changed "interrupts_enabled" to "interrupts_disabled" and enabled interrupts when "interrupts_disabled" was false, as is done elsewhere in the code. The result was that interrupts were no longer disabled in the background. I now have good interrupt response time for my real-time needs. I suggest that TI review this change, and if they find it acceptable, please incorporate it into Contiki, however that is done.
  • I suggest you to send a comit request from Contiki Github.
  • I had a look in the code, and there has been significant revision to that part of the code in a PR 1779 merged 16. July. This does indeed seems to touch upon at least the variable you mention, I suggest having a look at the latest in master, e.g.: https://github.com/contiki-os/contiki/blob/master/cpu/cc26xx-cc13xx/rf-core/ieee-mode.c#L766

    If your issue is still present, as YK say, I would strongly recommend to make Pull Request or raise an issue on the Contiki Github so that the platform maintainers can have a look.