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

Power fail

Posted by ady001 on May 3, 2016

When my application detects a power fail I'd like to 'kill' the RTOS ( stop all tasks ) so that 100% micro processing resource is available for PF Code. Probably there is no graceful way for code execution to reach PF Code ? I need to execute PF Code directly following execution of code at a certain point within the low priority task that is fully responsible for non volatile storage access ( I'd like to 'kill' the RTOS from this task ).

/* Finally start the scheduler. */
vTaskStartScheduler();

/* PF Code: ( all tasks and RTOS are now 'dead' )
/* Save all my data to non volatile storage */
/* Force a micro reset */

/* Will only reach here if there is insufficient heap available to start
the scheduler. */
return 0;

Power fail

Posted by rtel on May 3, 2016

Which architecture are you running on? Few ports provide an "end scheduling" function as there is nothing to return to. For example the Cortex-M port re-uses the stack that was used by main().

However, why not perform this processing from any task - or even a high priority task that runs in response to a power fail event? The task can enter a critical section to stop RTOS interrupts interfering with your post power fail processing.


Power fail

Posted by ady001 on May 4, 2016

I'll use a critical section as you suggest within my PIC24 architecture.

I was just hoping to exit RTOS gracefully rather than reset the micro from within a task i.e. Pre RTOS tasks ( hardware initialization etc. ) RTOS starts Post RTOS tasks ( save power fail data, reset micro )


[ 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