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


STM32 HardFaultException After certain period

Posted by irvind 83 on January 20, 2011

Currently I am using STM32 Cortex M3, compiler IAR 4.x & FreeRTOS v6.1.0.

I have a firmware that send some data through GSM module to PC.

Before I start implement FreeRTOS, everything worked properly.

After I implement FreeRTOS to my code, I facing HardFaultException problem after sending certain bytes of string. I try debug and narrow down the posibility so I have only 1 task running.

I found that if I send a long string which mean more bytes in 1 message, then it crash earlier. If I reduce the string size that I am sending per message, then it take longer time to crash.

Could anyone please guide me on this? If I need to clear any buffer etc? But this firmware running without RTOS and it work properly. I also tried to put enter critical before I do and strcpy or memcpy, I thought interrupt might causing this problem but still the same problem. I really run out of idea. So please give me a hand on this.

Thank you so much.

RE: STM32 HardFaultException After certain period

Posted by MEdwards on January 20, 2011
To save Richard the trouble. Have you read number three of this faq?

RE: STM32 HardFaultException After certain period

Posted by irvind 83 on January 21, 2011
yes. I read the FAQ before and also I bought their e-bbok. But I can't find my problem related to any of the FAQ.

By the way, I found that it not caused by create string etc. It caused by the stack size I assigned to the task, before I post the previous thread. I set my task stack as 2048. Then today I tried to increase higher stack size to 3072 just in case overflow check failed to trigger. But it go worst, it crashed faster than before. So I reduced my stack size to 1024, and it could run longer than before. But it still enter hardfaultexception at the end. Anyone have any idea that could solve this?


RE: STM32 HardFaultException After certain period

Posted by irvind 83 on January 21, 2011
Problem solved.

Just in case anyone having this problem, I wrote down my problem and solution here hope it could help other.

When using FreeRTOS, instead of using malloc, we are using pvPortMalloc(). But I forgot to use vPortFree to free all memory which I am still using free function. So it crash when memory only alloc but not freed.

[ 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