Quality RTOS & Embedded Software

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


lpc3131 Context switch issue

Posted by thompsonian on October 31, 2013

FreeRTOS 7.5.3 NXP lpc3131

Apologies if this is a known problem and I haven't dug in far enough. I have a board modeled on the ea3131 but running with a slightly different XTAL. The board normally runs with some non-RTOS code but I want to play with the uIP stack on it and hence am trying to get FreeRTOS running.

If I have a single task created and start the scheduler all seems well. The task runs, I get print out on the serial port, xTickCount increments nicely, LEDs seem to flash at the correct rate. However, if I create two tasks before starting the scheduler, I get xTickCount = 1 and end up in vApplicationStackOverflowHook. Looking at the stacks, they don't appear corrupted or too large.

There appears to be something wrong in how the interrupts handle the context switching. Has anyone seen anything like this before?

I'm running in Preemptive mode.

lpc3131 Context switch issue

Posted by richardbarry on November 1, 2013

In the scenario where you are able to successfully have one task running - what priority is the task? If it is the idle priority (0) then does the idle task run too? If you are creating the task above the idle priority then try running it at the idle priority - you will then effectively have two tasks running that should time slice. Does that work?


lpc3131 Context switch issue

Posted by thompsonian on November 18, 2013

So this ended up being a bad processor that eventually failed, forcing me onto another development board that works fine!

So I'm now running multiple tasks but I do have a question about system and supervisor mode. Before turning on the scheduler, I'm in supervisor mode and calls to the NXP supplied gpio routines work and cause an LED to flash. Tasks run in system mode and I have a task which does the same gpio call as in supervisor mode but the LED does not flash. I don't get any unprivileged traps, all of the tasks run. System mode is a privileged mode so why doesn't the call work?

lpc3131 Context switch issue

Posted by richardbarry on November 18, 2013

Other than the stack used, there is little difference between System mode and Supervisor mode, so I doubt that is the cause of the change in behaviour. Can you step through the LED toggle function to see what happens?


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

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

Latest News

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

Meet Richard Barry and learn about running FreeRTOS on RISC-V at FOSDEM 2019

Version 10.1.1 of the FreeRTOS kernel is available for immediate download. MIT licensed.

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

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