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

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 ]    [ 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