command for shutdown teensy

Status
Not open for further replies.

danixdj

Well-known member
Which command can i use for shutdown teensy 3.2 board?

I'm thinking to a timeout code for shutdown after a long inactivity time..

Thank u
 
Search for the snooze library. It should allow you to put the Teensy into a hibernate mode with low power consumption, but also to wake it up again if needed.
 
Snooze library is too old i think, there are the examples that they can not compile :)
There is a simple command of snooze for the hibernate without wakeup option?
 
I need software solution, there are more features in my project and i want to shutdown after a timeout without use...

and you mean shut-down FOREVER without wakeup by external event, only by power-toggle?

You could try this
Code:
/********************* go to deep sleep *********************/
#define SMC_PMPROT_AVLLS_MASK   0x2u
#define SMC_PMCTRL_STOPM_MASK   0x7u
#define SCB_SCR_SLEEPDEEP_MASK  0x4u

// see SMC section (e.g. p 339 of K66) 
#define VLLS3 0x3	// RAM retained I/O states held
#define VLLS2 0x2	// RAM partially retained
#define VLLS1 0x1	// I/O states help
#define VLLS0 0x0	// all stop

#define VLLS_MODE VLLS0
void gotoSleep(void)
{  
//	/* Make sure clock monitor is off so we don't get spurious reset */
//   MCG_C6 &= ~MCG_C6_CME0;
   //
   /* Write to PMPROT to allow all possible power modes */
   SMC_PMPROT = SMC_PMPROT_AVLLS_MASK;
   /* Set the STOPM field to 0b100 for VLLSx mode */
   SMC_PMCTRL &= ~SMC_PMCTRL_STOPM_MASK;
   SMC_PMCTRL |= SMC_PMCTRL_STOPM(0x4); // VLLSx

   SMC_VLLSCTRL =  SMC_VLLSCTRL_VLLSM(VLLS_MODE);
   /*wait for write to complete to SMC before stopping core */
   (void) SMC_PMCTRL;

   SYST_CSR &= ~SYST_CSR_TICKINT;      // disable systick timer interrupt
   SCB_SCR |= SCB_SCR_SLEEPDEEP_MASK;  // Set the SLEEPDEEP bit to enable deep sleep mode (STOP)
       asm volatile( "wfi" );  // WFI instruction will start entry into STOP mode
   // will never return, but call ResetHandler() in mk20dx128.c
}

This is part of my hibernate routines
If you want a wakeup, you have to program it first before calling gotoSleep()
 
Last edited:
Snooze library is too old i think, there are the examples that they can not compile :)
There is a simple command of snooze for the hibernate without wakeup option?
Its absolutely not to old, I'm working on it right now for better USB operation. Did you download the latest version? As far as turning the Teensy off, you need some external circuitry to truly turn it off, i.e., cut power but if you want to go to a low power mode you just set it up for pin wakeup and then do not connect anything to that pin. I'm wondering why you want a project that never wakes up?
 
I need software solution, there are more features in my project and i want to shutdown after a timeout without use...

Just in case it wasn't clear, there is a pin (OFF) on the external power switch that if you send a pulse, it will cut power to the unit until the button is pushed on the switch (or the switch itself is power cycled). So you would be able to have the chip turn itself off. However, if you need to wake up again due to an event, you would want to look into hibernate instead.
 
Status
Not open for further replies.
Back
Top