SAMD20 wakeup from sleep period

Go To Last Post
6 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

 

Having a bit of trouble with using the ASF4 TC peripheral driver I call "TIMER" to wakeup a SAMD20 at the interval I want.

 

I am using Atmel START web-based software configuration tool (AtmelStudio 7) on a SAMD20 device.  Within my configuration I setup peripherals called SLEEP_MANAGER, CALENDAR, and TIMER.   I want to wake-up the MCU from deep sleep with TIMER because I want to program different time interval as needed...I may want to sleep the MCU up to 1 week or more.  Here is an overview of my configuration:

 

  1. OSC32K drives GCLK1 divided down to 1.024kHz (1K enabled, 32kHz output enabled)
  2. GCLK1 drives TIMER which I divided again by 1024 within the driver settings to give 1Hz clock. 
  3. Length of one timer tick is set to 1024 micro seconds.   How is timer tick utilized?
  4. 'Run in Standby' is set for TIMER and associated clocks (GCLK1 & OSC32K).
  5. I set my TIMER task in main.c configuration function to an interval of 10 and mode REPEAT with a callback function

 

With this configuration the MCU awakes every 1 second.  At the 10 second mark per the interval, the callback function is called, this process then repeats.  I increase the interval to 100, 1000 or more and the MCU stills wakes every 1 second (call back fires according to the interval).  I want to wake the MCU at my timer interval not at 1 second and not just call the callback function.  Yet that does not appear to the behavior of this driver.  The abstraction of Atmel START make is somewhat difficult to see what is going on "under the hood", especially when it comes to how TIMER fires its interrupts.  Has anyone had experience with using the web-base tool to properly configure the TC peripheral driver to behave in the way I am seeking?   Here is a capture of the driver configuration within the web-based tool.

 

 

Last Edited: Mon. Dec 2, 2019 - 12:18 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

bump

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I do not use or recommend atmel start, so I can not help with atmel start.

 

Trampas

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Unfortunately I began this project with Atmel START and I don't have the luxury of starting over.  Nevertheless, I think I found a solution.  As I mentioned before, a "timer task" as defined by the ASF4 TIMER driver appears to NOT wake-up the MCU while in standby.  What does wake-up the MCU is the "timer ticks."  In my configuration, its every 1 second.  Whatever value I put in "Length of one time tick in uS" (keeping all other setting the same i.e. 1Hz clock, standby selected), its correlates to MCU wake-up time.  I don't pretend to know much more how this driver works but these are the results I am getting.  For example, I enter a value of 10000 uS, MCU wakes up every 10 second, 60000 uS, MCU wakes up every 60 seconds.   I use this timer for only waking up the MCU from sleep.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Interrupts wake up processor.  So you have to configure the timer interrupt to trigger at the correct time. 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I understand interrupts wake up the processor.  What wasnt clear from the START configuration is how to generate that interrupt.  I assumed it could come from a task interval but I learned it does not.