Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem


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 ]    [ Privacy ]    [ Sitemap ]    [ ]


Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.

Latest News

NXP tweet showing LPC5500 (ARMv8-M Cortex-M33) running FreeRTOS.

Meet Richard Barry and learn about running FreeRTOS on RISC-V at FOSDEM 2019

Version 10.1.1 of the FreeRTOS kernel is available for immediate download. MIT licensed.

View a recording of the "OTA Update Security and Reliability" webinar, presented by TI and AWS.


Careers

FreeRTOS and other embedded software careers at AWS.



FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Espressif ESP32

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Renesas

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

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

OpenRTOS and SafeRTOS

Xilinx Microblaze and Zynq partner