NRF52_DK BLE and Interrupts.

08 Nov 2017

Hi, Is it possible to work with hardware interrupts and BLE using the nrf52832? I read somewhere that that the BLE stack has priority on this chip. If not, perhaps someone can recommend a different chip. I'm trying to read a rotary encoder using the QEI library which works well but I cannot make it work when BLE is connected. I'm using the MIDI-BLE library found here. It is hard to debug so I'm using the led on the board and seems that no signal is read.



Thank you for your help/comments.

21 Dec 2017


I've been working with mbed on the nRF52 for a while now. It is totally possible to use interrupts with the soft device enabled. You should read the softdevice S132 V2.0 specification (available from Nordic here). That should give you a better idea of what chip resources the softdevice/bluetooth stack requires and how to avoid stepping on them.

The interrupts you use need to be a certain priority so the softdevice can service the BLE stack when it needs to. The specification will mention that.

Debugging is another caveat of using the softdevice. When your program hits a breakpoint, the real-time requirement of the softdevice is violated and it will hardfault when you continue execution. If you want to step through your program after a breakpoint, you can set the PRIMASK register to 1 and that will prevent any interrupts from happening and you can step through code without the softdevice hard faulting. Keep in mind you will have to reset the device to resume normal operation...

Can you post any sample code?