This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

BLE Soft Device + SPI

Hi,

I've noticed that when using SPI without a Soft Device or BLE function calls, the SPI peripheral is easy to control and operates correctly.

This nice operation stops when we try to put in the Soft Device + BLE API calls. I have cut+pasted code from a non-BLE project--for which SPI works--to one with BLE, and SPI no longer works. In fact, I wind up in the hardfault handler.

Any advice on any conflicts to be aware of, or how to treat SPI with BLE added in, would be much appreciated.

Thanks, Jamie

Parents
  • I think that Hailang is correct. As you can see in the section he refers to, the PPI is restricted when the softdevice is enabled, so if you access it directly, this will cause a HardFault.

    The default implementation of twi_hw_master.c uses the PPI interface directly (i.e. writes to NRF_PPI-registers), and as you have discovered, this will cause a HardFault if the softdevice is enabled. If you use the TWI with the softdevice enabled, you should make sure to change this to use the softdevice API instead.

    Please note that this API will function only when the softdevice is enabled, so make sure to also do any TWI initalization after sd_softdevice_enable().

Reply
  • I think that Hailang is correct. As you can see in the section he refers to, the PPI is restricted when the softdevice is enabled, so if you access it directly, this will cause a HardFault.

    The default implementation of twi_hw_master.c uses the PPI interface directly (i.e. writes to NRF_PPI-registers), and as you have discovered, this will cause a HardFault if the softdevice is enabled. If you use the TWI with the softdevice enabled, you should make sure to change this to use the softdevice API instead.

    Please note that this API will function only when the softdevice is enabled, so make sure to also do any TWI initalization after sd_softdevice_enable().

Children
No Data
Related