Hi,
The code you posted above is the same that processor expert writes for the Cpu_SetOperationMode(DOM_STOP,NULL,NULL) but if your code is working better for you you can use it instead. The method Cpu_SetOperationMode only clears the LLWU flags and set the appropriate registers to enter VLLS modes. The post in the MCUOnEclipse blog is really good an give you some hints and tips to have lower current.
I did a project to enter to VLLS2 mode and found some strange behavior of the LLWU when using MQX lite. I recommend you the next tests:
- Ensure that the LLWU interrupt is enabled, this will create an event called Cpu_OnLLSWakeUpINT in the Events.c file. This method is a callback that is called when the LLWU interrupt is serviced. You can see the LLWU interrupt in the Cpu.c file with the name Cpu_INT_LLWInterrupt. You can see that the LLWU is being enabled in the PE_low_level_init in the Cpu.c file with something like this NVICISER0 |= NVIC_ISER_SETENA(IRQ number in hex);

Write a code inside the Cpu_OnLLSWakeUpINT callback to check if the LLWU interrupt is being services and know if the device is being waken up. When the reset occurs the LLWU ISR is the first think called after the global interrupts are enabled. This is to check if the LLWU ISR is serviced. You can turn on a led there with something like this:
SIM_SCGC5 |= SIM_SCGC5_PORTC_MASK;
PORTC_PCR8 = PORT_PCR_MUX(0x01);
GPIOC_PDDR |= 1<<8;
GPIOC_PSOR |= 1<<8;
You need to configure the clock because are not configured at this point.
:smileyalert: Remember that is you are debugging when entering VLLS mode the debug will be disconnected. Because of this the recommended procedure is to disconnect and connect again the board to ensure it is not trying to restart the communication.
Let me know your results.
Hope this information can help you
Best Regards,
Adrian Sanchez Cano
Technical Support Engineer
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------