FreeRTOS Support Archive
The FreeRTOS support forum is used to obtain active support directly from Real
Time Engineers Ltd. In return for using our top quality software and services for
free, we request you play fair and do your bit to help others too! Sign up
to receive notifications of new support topics then help where you can.
This is a read only archive of threads posted to the FreeRTOS support forum.
The archive is updated every week, so will not always contain the very latest posts.
Use these archive pages to search previous posts. Use the Live FreeRTOS Forum
link to reply to a post, or start a new support thread.
[FreeRTOS Home] [Live FreeRTOS Forum] [FAQ] [Archive Top] [January 2017 Threads] SAMD21 tickless implementation fixed by sync before sleep?Posted by cajjed on January 6, 2017 I have implemented tickless on my samd21 chip based off the ASF tickless.c.
My sleep will wake up after 8 ms instead of about 1000 ms on occasion and think that it has sleeped for the entire duration. If I add a timer/counter sync then the erroneous wake up goes away. Any insight on why?
~~~
while (tcissyncing(&tc45)) {
/* Wait for sync */
}
system_sleep();
~~~
I am thinking this is probably more of a samd21 question so I have cross posted it (http://community.atmel.com/forum/samd21-tc-sync-fixes-short-sleep). However, I wanted to ask here as well.
SAMD21 tickless implementation fixed by sync before sleep?Posted by heinbali01 on January 6, 2017 Is this timer tc45 dedicated for the Tickless Idle sleep?
If so, can't you set it (initialise it) to wake up the CPU after a given period of time? When called, FreeRTOS will advise you how many ticks it wants to be idle (at most).
A second remark: if you're using 'Tickless Idle' to save energy, you should better try to sleep much longer periods of time, like 30 seconds or more.
SAMD21 tickless implementation fixed by sync before sleep?Posted by cajjed on January 6, 2017 tc45 is the freeRTOS system tick, which fires the interrupt every millisecond (every 32 counts of the 32 kHz external oscillator). For Tickless idle, the timer/counter is switched to be the sleep timer and sleeps as much as xEpectedIdleTime dictates. In my test case I have it waking every second to toggle a test pin and output debug data. In my actual system the sleep times will be on the scale of 20 seconds.
The oddity is that for some reason the timer/counter wakes very quickly and thinks it has fired the interrupt indicating that it has matched. Adding the sync fixes the problem. Just trying to understand why, concerned it it just a bandaid and will show up again down the road.
SAMD21 tickless implementation fixed by sync before sleep?Posted by edwards3 on January 6, 2017 I dont know what the timer sync does but if the function exists maybe you are meant to use it. Check the hardware ref manual.
SAMD21 tickless implementation fixed by sync before sleep?Posted by cajjed on January 7, 2017 The sync just waits until the hardware module has synched to the bus. You call this before writing or reading the timer/counter and so forth. Just don't know why checking it before sleep will fix an error where the timer/counter wakes up after 8 ms instead of 1000 ms.
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.
|