I'm currently working on a project using the nRF52832 as my controller, Segger Embedded Studio version 5.42a as my IDE, and the nRF5 SDK 17.0.2. I started by developing a concurrent central and peripheral switching example project. I've added NUS client and peripheral functionalities and integrated a W25 Winbond external flash memory using SPI, along with the internal RTC. The RTC interrupt priority is 3, and the SPI interrupt priority is 6.
My issue is that when I write data to the external flash memory and then attempt to start the internal RTC within a BLE service event handler, the SPI channel appears busy, and the data is not correctly written to the external flash.
To address this, I implemented a flag system. Inside the BLE service event handlers, I set specific flags when corresponding events occur. In my main loop, I check these flags. If a flag is set, I then perform the operations like writing to/reading from the external flash and setting the date and time in the internal RTC.
This approach works.
My question is: What's likely happening here? Do BLE event handlers have a high interrupt priority? Are peripherals like SPI and RTC excluded from functioning during the execution of these event handlers?