Quality RTOS & Embedded Software

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




Loading

vListInsert() hang during multi-threaded stress scenarios on STM32F446

Posted by rksheth on March 22, 2016

I'm running FreeRTOS 8.2.1 on an STM32F446 MCU. Compiler: gcc-arm-none-eabi-4_9-2015q3

I'm aware that there are some common causes of this issue; I've investigated them but have not found any fundamental issues so far. I tend to see this issue crop up when I've got 5+ threads actively blocking and releasing each other on their respective queues. There are some timer ISRs also giving to semaphores and queues. All of this logic contained within these tasks is tested to be stable when running alone - it's only when I put it all together that I start seeing these issues. I see it crop up most often in a thread that makes heavy use of a USART peripheral.

Here are the root causes that I've investigated, based on the comment in list.c above the hang location:

1) Stack Overflow I've enabled stack protection to level 2. To double check, I got the pointer to the top of the current Task's stack from pxCurrentTCB after a hang and then examined memory around there. I see the 0xa5a5a5 striping at the top. I'm also using a 1024 bytes of stack for my threads, and tried increasing it to 2048 to see if it made the hang go away - no luck.

2) Incorrect Interrupt Priority Assignment I changed all interrupt priorities and subpriorities to 0xff with the exception of the systick handler, which is still at 0. I'm using NVIC priority grouping 4. To ensure I'm not forgetting to configure a priority for an interrupt that's being enabled, I grep'd for every call of HALNVICSetPriority() and HALNVICEnableIRQ() to ensure that they're always used together.

3) Calling an API function from an ISR I checked all my interrupt handlers, and they are indeed using the FromISR functions for queue/semaphore 'gives'.

4) Using Uninitialized Queues or Semaphores All threads operate normally for some amount of time before the hang happens, and I explicitly initialize all queues/semaphores in one location before the scheduler is started.

If anyone can see a glaring flaw in my debug/thought process or has suggestions on how to proceed, I would appreciate it greatly. I've been banging my head at this for a few days now.

Thanks!


vListInsert() hang during multi-threaded stress scenarios on STM32F446

Posted by rtel on March 22, 2016

I changed all interrupt priorities and subpriorities to 0xff with the exception of the systick handler, which is still at 0

This MUST be the lowest possible priority, you have it set to the highest possible.


[ Back to the top ]    [ About FreeRTOS ]    [ Sitemap ]    [ ]




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

Latest News

FreeRTOS kernel V10 is available for immediate download. Now MIT licensed.


FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

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