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


vTaskDelayUntil on 16bit Microchip dsPIC33EV128GM104 doesn't work with 16bit ticks

Posted by mmr42 on June 15, 2016

Hi, the code I use is based on the example code reduced to the minimum: 2 tasks that make 2 LEDs blink. The task using vTaskDelay(100) works as expected but the task using vTaskDelayUntil( &xLastWakeTime, xDelayMyTaskms) shows an unpredictable behaviour with 16bit ticks. With 32bit ticks also vTaskDelayUntil works on my system. The last time I used FreeRTOS on a similar uC before was with FreeRTOS7.x and i believe that it worked that days. But FreeRTOS tasks.c changed a lot in between. Did anyone else try the 16bit ticks with FreeRTOS9 on a 16bit uC?

Hardware:  Microchip dsPIC33EV128GM104

Software:  MPLAB X IDE v3.30  XC16 (v1.26) compiler  FreeRTOS 9.0

FreeRTOSConfig.h ~~~

define configUSE16BIT_TICKS            1


Bug description:  vTaskDelay(100); // works as expected  vTaskDelayUntil( &xLastWakeTime, xDelayMyTaskms); // unpredictable behaviour



define configUSE16BIT_TICKS            0


-> Everything is ok.

Task: ~~~ static void ledTask( void pvParameters ) {     TickTypet xLastWakeTime;     const TickTypet xDelayMyTaskms = pdMSTOTICKS(100);         int ledStatus = 0;         / Remove compiler warnings. */     ( void ) pvParameters;

    /* Initialise xLastExecutionTime so the first call to vTaskDelayUntil()     works correctly. */     xLastWakeTime = xTaskGetTickCount();         for( ;; ) {         vTaskDelayUntil( &xLastWakeTime, xDelayMyTaskms);                 //vTaskDelay(pdMSTOTICKS(500) );                 if (ledStatus) {             LED1 = 0;             ledStatus = 0;         }         else {             LED1 = 1;             ledStatus = 1;         }     } } ~~~

Regards  Michael  

vTaskDelayUntil on 16bit Microchip dsPIC33EV128GM104 doesn't work with 16bit ticks

Posted by rtel on June 16, 2016

For some reason my reply to your post created a new thread, rather than replying here. This was my reply:

Can you confirm that: 1) Your configTICKRATEHZ value is valid for using with pdMSTOTICKS (it is 1000 or less). 2) The calculation pdMSTOTICKS( 100 ) gives the expected value in both cases, and is not over/under flowing in one case.


alternate (3015 bytes)

[ 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