Quality RTOS & Embedded Software

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


Hard fault - Sometimes

Posted by joe_her on June 5, 2016

I have an extremely difficult to catch hard fault. I suspect it happens somewhere during initialization, as if the system starts running it will run for days with no issues. However, once in a while, a hard fault happens after reset. I set a break point at the hard fault interrupt, and I can see that the call stack is empty, only shows "void f() ",

Can the FreeRTOS+ Trace be used to find out what is going on? My ARM assembly knowledge is very low.

Thanks for any help...


Hard fault - Sometimes

Posted by rtel on June 5, 2016

I suspect it happens somewhere during initialization

FreeRTOS will leave interrupts disabled as soon as you start to call FreeRTOS API functions. That is done to ensure interrupts do not execute until after the scheduler has started, in case an interrupt service routine attempts to use the FreeRTOS API, and the API function called attempts a context switch (which would not make sense before any tasks were running).

If you are hitting a hard fault before the scheduler is started, could it be that something you are doing during initialisation is enabling interrupts?

Can you put a break point in your ISRs, or simply set a variable that can be inspected from the hard fault handler to see if any ISRs have executed, to see if this is the case?


Hard fault - Sometimes

Posted by joe_her on June 6, 2016

I will set a counting variable on each interrupt entry, and will check. Thanks.

Hard fault - Sometimes

Posted by joe_her on June 6, 2016

Can't believe did this, but I forgot to call one xEventGroupCreate() ...

I wonder how it worked at all sometimes.


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

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

Latest News

Version 10.1.0 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.


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


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