2021-06-18 08:53 PM
I'm having issues with the BlueNRG multifunction timers when using the sleep low power mode (SLEEPMODE_WAKETIMER). I've stripped down my project to create a minimal reproducible example which is described below.
A virtual timer is being used to periodically awaken from low power mode on a BlueNRG-2. Once awaken, the virtual timer is started again and a multifunction timer is started as well. A flag is set when the multifunction timer interrupts. That flag is checked by a blocking while loop. A routine is run once the flag is set. Following that routine the multifunction timer is stopped and low power mode is entered again using the BlueNRG_Sleep function. An output is set when the multifunction timer is started and reset when the timer interrupt occurs.
This works fine when the low power mode is CPU-Halt mode (SLEEPMODE_CPU_HALT) as shown in the attached capture. When the low power mode is sleep mode (SLEEPMODE_WAKETIMER) the MFT interrupt never occurs. The programs execution is stuck in the blocking loop, the routine doesn't occur, and low power mode isn't entered again. Any ideas or suggestions regarding the underlying cause of this issue or potential work arounds? I believe there's some issue with awakening from the BlueNRG_InternalSleep functions.
Attached are the user source and include files demonstrating this problem. It is run on a BlueNRG-2 development board with the supporting BlueNRG-1_2 DK files.