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


Power Failure recovery - PIC24F target

Posted by on November 9, 2012
Target microcontroller is PIC24F256GB210 and FreeRTOS is 7.2.0. Currently developing the application using explorer 16 development board.
Our project has a power fail recovery scenario, where in we check the power failure using an external interrupt and leave behind a cookie if power fails. On every reset we check for this cookie, if set then we go into power fail recovery mode and the application has to start again from its last known state. I would like to know if there is any help guide or manuals or demo projects in freertos that can help me on what to do on the freertos kernel for this scenario? Thanks.

RE: Power Failure recovery - PIC24F target

Posted by Richard on November 9, 2012
In a word....no.

The stat of the system has several components:

1) The value of the CPU registers.
2) The value of the RAM - which holds the stack and register values for each task.
3) The value of the program counter.

If any of these change, and you cannot recover them, then you cannot get back to the exact same state.


RE: Power Failure recovery - PIC24F target

Posted by Richard Damon on November 11, 2012
The PIC24 family has a reset status register to tell you the reason for the reset, and you could thus detect that you didn't have a "power fail" but something less serious that perhaps some of the ram data might be recoverable (assuming you make sure the startup routine doesn't kill their values by marking them properly.

You will not be able to just pickup where you stopped, as not enough information will be saved/preserved.

YOUR application will need to save the data needed to restart your application "in the middle", as this is extremely application specific. If you really want to handle going through a power-down, you will need some form of non-volitile memory in the system to keep updated with the state to restart at.

[ 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