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


vTaskDelay and vTaskDelayUntil not working

Posted by mcufan on April 29, 2013

I have retargeted the LPC2106 GCC demo for my LPC2138 MCU based on the Rowley 2138 demo.
Everything seems to work fine except for vTaskDelay and vTaskDelayUntil. It seems that whenever I call any of these it just stucks there forever. I have not disabled the interrupts. Unfortunately I don't have access to a debugger, so I am only relying on LEDs for now. I enable a LED then call vTaskDelay or vTaskDelayUntil, then it will never reach the code part to disable the LED. Do you have any idea what can cause such behavior?
By the way if I replace vTaskDelay with an own crappy delay function (like counting to 0xFFFFF) the code works as expected.

RE: vTaskDelay and vTaskDelayUntil not working

Posted by Richard on April 29, 2013
I would guess you have not installed the tick interrupt handler correctly - but unless you can connect a debugger it is pure speculation.

See the special note to Cortex-M users in FAQ 1 on the following page:


RE: vTaskDelay and vTaskDelayUntil not working

Posted by mcufan on April 29, 2013
Hi richardbarry,

I understand what you mean. But how does it work for 2106 then? It uses the same GCC/ARM7_LPC2000/port.c as my project, and it does not define these interrupt handlers in its FreeRTOSconfig.h you mention on the FAQ page. Since I don't have an LPC2106 I have not tried that demo without modification, but I can see it uses vTaskDelay, and it works.
Anyways I will try that and see if it works. Thanks!


RE: vTaskDelay and vTaskDelayUntil not working

Posted by Richard on April 29, 2013
Sorry - my mistake - you are correct that the page I directed you to is relevant only to microcontrollers with Cortex-M cores, whereas you are using an ARM7 core.

The 2106 needs vPortYieldProcessor() to be installed on the SWI interrupt vector to manage taskYIELD() calls, and the IRQ vector to autovector to the correct interrupt for timer ticks. On the 2106 that is done using a vector table something like the following in the startup code (assuming you have not changed the timer configuration in the 2106 port layer):

 b     _start        /* reset handler */
ldr pc, _undf /* undefined handler */
ldr pc, _swi /* SWI handler */
ldr pc, _pabt /* program abort handler */
ldr pc, _dabt /* data abort handler */
nop /* reserved */
ldr pc, [pc,#-0xFF0] /* IRQ set to read VIC directly */
ldr pc, _fiq /* FIQ handler */

_undf: .word __undf /* undefined */
_swi: .word vPortYieldProcessor /* FreeRTOS Yield. */
_pabt: .word __pabt /* program abort */
_dabt: .word __dabt /* data abort */
_fiq: .word __fiq /* FIQ */

Ensure the tick and yield handler entry points are compiled to ARM instructions (as opposed to THUMB instructions).


RE: vTaskDelay and vTaskDelayUntil not working

Posted by mcufan on May 2, 2013
Thank you Richard. I think the problem was with the serialISR routines. When I rewrote it to use UART1 instead of UART0 I must have missed something and probably it kept the whole MCU blocked before the scheduler could even start.
I started everything again from the LPC2106 example and everything works correctly now.

[ 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