Hello,
is there any HW control of sleep mode enable/disable in Kinetis K MCUs? I can see SMC->PMPROT register, but it is writable only once after reset.
Using a variable, setting it true or false and then checking before sleep mode entry is not an option as there is a need to disable sleep mode when an asynchronous (interrupt) event occurs.
已解决! 转到解答。
Hi Martin,
Thanks for the clarification! Kinetis devices execute the "WFI" instruction to enter low power modes, but WFI is a conditional instruction, so you may define a macro for this instruction with a condition, and change the condition to FAIL in the ISR which happens right before this intruction, so that this instruction does not execute at all in such case. Please kindly refer to the following for more details.
Hope that helps,
Have a great day,
Kan
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hello,
sorry not to be more specific.
Yes I want to disable sleep mode in ISR which can occur just before sleep mode entry instruction. I think only HW based sleep mode disable can handle this.
Hi Martin,
Thanks for the clarification! Kinetis devices execute the "WFI" instruction to enter low power modes, but WFI is a conditional instruction, so you may define a macro for this instruction with a condition, and change the condition to FAIL in the ISR which happens right before this intruction, so that this instruction does not execute at all in such case. Please kindly refer to the following for more details.
Hope that helps,
Have a great day,
Kan
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hi,
I am not quite understand what you really would like to do? Why "here is a need to disable sleep mode when an asynchronous (interrupt) event occurs."? If more information provide, it will much helpful.