Quality RTOS & Embedded Software

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




Loading

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.

Regards.

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) Amazon Web Services, Inc. or its affiliates. All rights reserved.

Latest News

FreeRTOS kernel V10 is available for immediate download. Now MIT licensed.


FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

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