Quality RTOS & Embedded Software

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


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

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

Latest News

FreeRTOS v10.2.1 is available for immediate download. MIT licensed, includes 64-bit RISC-V, NXP Cortex-M33 demo & Nuvoton Cortex-M23 demo.

NXP tweet showing LPC5500 (ARMv8-M Cortex-M33) running FreeRTOS.

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

Cadence Tensilica Cortes

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