How to shutdown from 3s power key button press?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to shutdown from 3s power key button press?

Jump to solution
1,020 Views
Gamka
Contributor III

I am using imxrt1064 with MCUXpresso. I would like to turn off the device after user has pressed power button for 3 seconds. Is there a way to accomplish this?

The "Dumb" PMIC mode allows me to set Max timeout to 5 secs, 10 sec or 15 secs, but I need to set it to 3 secs. With debounce I can get an interrupt that the button has been pressed for 500ms (or more), but I would need to know if the button is still being pressed after 3 secs (to shutdown). Is there a register to check this? Or any other way to implement 3 secs shutdown?

I understand, that I could wire the button to some GPIO, but is there any way to accomplish this without modifications to my hardware?

Labels (1)
Tags (2)
0 Kudos
1 Solution
1,006 Views
Gamka
Contributor III

I found the register myself. It is in HPSR bit 6. Now I can start a timer, when getting (0 ms) debounce. When the timer fires, I will check if the button is still being pressed. And if I get a debounce, while timer is running, I will just restart the timer.

Btw, it would be nice, if imxRT1064 reference manual "Chapter 13.5. ONOFF (Button)" could have a mention about this register as well (and other button related SNVS HP registers).

View solution in original post

0 Kudos
2 Replies
1,002 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi @Gamka 

   Thanks for your updated information and your effort.

  Yes, you can use the SNVS_HP or LP.

   If your question is solved, please help to mark the correct answer.

Any new issues in the future, welcome to create the new question post, thanks.

 

Best Regards,

kerry

0 Kudos
1,007 Views
Gamka
Contributor III

I found the register myself. It is in HPSR bit 6. Now I can start a timer, when getting (0 ms) debounce. When the timer fires, I will check if the button is still being pressed. And if I get a debounce, while timer is running, I will just restart the timer.

Btw, it would be nice, if imxRT1064 reference manual "Chapter 13.5. ONOFF (Button)" could have a mention about this register as well (and other button related SNVS HP registers).

0 Kudos