Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Real time embedded FreeRTOS mailing list 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem TCP & FAT Training




Loading

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.


[ Back to the top ]    [ About FreeRTOS ]    [ Sitemap ]    [ ]




Copyright (C) 2004-2010 Richard Barry. Copyright (C) 2010-2016 Real Time Engineers Ltd.
Any and all data, files, source code, html content and documentation included in the FreeRTOSTM distribution or available on this site are the exclusive property of Real Time Engineers Ltd.. See the files license.txt (included in the distribution) and this copyright notice for more information. FreeRTOSTM and FreeRTOS.orgTM are trade marks of Real Time Engineers Ltd.

Latest News:

FreeRTOS V9.0.0 is now available for download.


Free TCP/IP and file system demos for the RTOS


Sponsored Links

⇓ Now With No Code Size Limit! ⇓
⇑ Free Download Without Registering ⇑


FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Renesas Electronics Gold Alliance RTOS Partner.jpg

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Atmel RTOS partner supporting ARM Cortex-M3 and AVR32 microcontrollers

STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0

Xilinx Microblaze and Zynq partner

Silicon Labs low power RTOS partner

Altera RTOS partner for Nios II and Cortex-A9 SoC

Freescale Alliance RTOS Member supporting ARM and ColdFire microcontrollers

Infineon ARM Cortex-M microcontrollers

Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers

Cypress RTOS partner supporting ARM Cortex-M3

Fujitsu RTOS partner supporting ARM Cortex-M3 and FM3

Microsemi (previously Actel) RTOS partner supporting ARM Cortex-M3

Atollic Partner

IAR Partner

Keil ARM Partner

Embedded Artists