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


Crashing in ulPortSetInterruptMask within xPortSysTickHandler (Attempting new port for STM32F107)

Posted by dibosco on May 18, 2016

I've spent a lot of time fruitlessly trying to get USB going on the very old STM32F107 port for Rowley Crossworks that we've been using for a couple of years with uIP. Then we tried generating a FreeRTOS project from STM's Cube to get the USB going, but although that kind of worked, if you plugged and unplugged, then replugged the USB cable it crashed. I spent some time on this and just couldn't fathom it.

So, finally today I decided to create a new FreeRTOS Project with Rowley Crossworks, use the latest STM libraries and import an run to complete project that works with USB as a CDC class just fine.

Everything seemed to be going well, I got an LED flash task going and I was happy, until I tried sending what was coming in on the virtual com port to a queue rather than just echoing it back within the interrupt. I'm now chasing my tail trying to stop it getting hard fault handler errors all the time.

I found that my two threads (USB thread to handle what was put in the CDC queue within the USB interrupt and an LED flash thread) were not getting called more than once. I then wondered whether the timer tick wasn't set up properly, compared interrupt vectors in my old F107 project and realised that vectors were indeed not set up. I imported the startup.s file and modified the vectors to be the same as the old F107 FreeRTOS project, but now I am just getting crashes all the time, no matter what I try. I've had it crash at SVCHandler and now after tinkering a bit more I'm just crashing all the time in xPortSysTickHandler() when it calls ulPortSetInterruptMask(). As soon as I step into the asmvolatile line that is in the ulPortSetInterruptMask function, I get a hard fault exception.

I suspect this isn't really enough to help me track this down, but thought it was worth a try. I'm running the project on the STM3210C-EVAL for what it's worth.

If anyone has any pointers or needs any more information to try to track this down I'd be most grateful.



Crashing in ulPortSetInterruptMask within xPortSysTickHandler (Attempting new port for STM32F107)

Posted by dibosco on May 18, 2016

For the moment, I've recreated from scratch the basic bare bones FreeRTOS with just the LED flash and it's working. I've put it into Mercurial this time so can always roll back to here. I'll add the USB and see whether I get back to this same stage.

I'd forgotten I'd added the three lines:


define vPortSVCHandler SVC_Handler
define xPortPendSVHandler PendSV_Handler
define xPortSysTickHandler SysTick_Handler


To FreeRTOSConfig.h and that it can't have been a timer tick issue because the LED Flash thread was originally working fine.

I may be back for advice if I keep struggling when adding the queue in the USB code hinders me.


[ 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