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

problem with nRF52832 BLE + SPI + FreeRTOS

Hi everybody.

I encountered issues with the formentioned setup. In my project I'm using latest SDK 13.1, softdevice S132 v.4.0.2. I'm compiling the project with latest GCC.

I have two tasks:

  • LCD driver communicating over SPI
  • BLE task configured as a Central

If I enable only one of them, the device is operational. It is either able to scan for peripherals and connect to them, or if the LCD task is enabled, it refreshes the display every second.

The issues show up when I have both tasks running. Most of the times I end up in softdevice_fault_handler with no additional information. This doesn't happen either if I comment out the scan_start function, or if I comment out SPI transactions in the LCD driver.

I suspect that busy-polling function (nrf_drv_spi_transfer) is causing the issues. The IRQ priority for SPI is the lowest possible: 7. Is this function OK to work with FreeRTOS and softdevice stack?

Are there any precautions I need to take to get it working? Is there a good way to debug such issues?

Thanks, Matt

Related