Hi mjg8t,
I am sorry, but I found maybe this issue is a code issue, you should not define the "count" variable in a normal way like "volatile uint8_t count;" because waking up from VLLSx mode always follows the system reset processor, so the "count" always gets initialized if you put it in that way, you have to define a pointer to some address in SRAM, where other vars never touch it (this can be achieved by modifying the link file, for example, you may exclude this position out of the memory map), and read the content from where the pointer is referring to, modify the content, and restore it. so that you may find the value incremented each time the device wakes up from VLLS3 mode.
Here I attached my test code, which is based on the demo of power_mode_switch_frdmk22f, locating in SDK_2.1_FRDM-K22F\boards\frdmk22f\demo_apps\power_mode_switch\kds. For quicker response, I didn't modify the link file, just make the pointer refer to 0x20000300, where the SRAM is retained even under VLLS2 mode. You may search 0x20000300 to find out the code I added for test.
To avoid 0x20000300 be initialized by the main application every system reset, I got it initialized to zero when the device enter STOP mode, it is just for a cleaner view for reset counter, you may ignore this if you don't care about the value out of reset.
Please kindly refer to the attachment for details.
Hope that helps,
Have a great day,
Kan
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------