Quality RTOS & Embedded Software

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


Loading

STM32 F101CProgram goes to HardFaultException

Posted by baranov on August 26, 2010
Hello All.
I'm trying to run FreeRtos on STM32F101C8. I have 2 simple tasks:

static void vLCDTask( void *pvParameters )
{
(void)(*pvParameters);

for(;;)
{
GPIOB->ODR &= 0x03FF;
vTaskDelay(1);
}
}


static void vLSDTask( void *pvParameters )
{
(void)(*pvParameters);

for(;;)
{
GPIOB->ODR |= 0xFC00;
vTaskDelay(1);
}
}

I debug with IAR jtag emulator and see that each of them is executed only once. After that program goes to HardFault Exception. If I add one more task - it goes through 3 tasks. If I replace xTaskDelay by TaskYield() it works good. I use IAR 5.41 compiler.
Thanks

RE: STM32 F101CProgram goes to HardFaultException

Posted by Dave on August 27, 2010
Is there a standard demo application you can try? Are you running into mutual exclusion having two tasks attempting to access the same port so rapidly?

RE: STM32 F101CProgram goes to HardFaultException

Posted by https://www.google.com/accounts on August 27, 2010
Unfortunately I have only a board with STM32F101C8 and standard demo is designed for STM32F101F103. So, I simplified standard demo reducing it to these small tasks, modified linker script file stm32f10x_flash.icf and changed value f the CPU clock frequency to 24MHz. The 1ms delay seems to be large enough to provide access to port, isn't it? I initially tried vTaskDelay(1000).
Maybe there is a reference to STM32F101C8 FreeRtos example somewhere?

RE: STM32 F101CProgram goes to HardFaultException

Posted by Dave on August 27, 2010

> Unfortunately I have only a board with STM32F101C8 and standard demo
> is designed for STM32F101F103. So, I simplified standard demo
> reducing it to these small tasks, modified linker script file
> stm32f10x_flash.icf and changed value f the CPU clock
> frequency to 24MHz.

You are doing the right things, but did you start with the project for the standard demo you mention, or create a new project?


> The 1ms delay seems to be large enough to
> provide access to port, isn't it?

I doubt this is the source of your problem, but it is worth looking at. The delay period does not provide mutual exclusion, if a tick interrupt occurs between reading the current port value and writing the new one then you have a problem. I don't think it would make it crash though. Look at the partest.c files in the FreeRTOS/Demo directory to see how they do port access.

RE: STM32 F101CProgram goes to HardFaultException

Posted by baranov on August 27, 2010
I downloaded demo project and modified it deleting everything except LED blinking. After that I customized LED ports to my board ports and pins. Preliminary I wrote a separate simple program to test board LEDs switching.
Thanks, I'll look at partest.c

RE: STM32 F101CProgram goes to HardFaultException

Posted by baranov on August 30, 2010
Well, I replaced LED blinking with a++ and b++ operations, where a and b are two long globals. I still have Hard Fault Exception but I noticed that the system works about two second before it catches it. Can it be something with bus timing?


[ 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