Go Down

Topic: Update of FreeRTOS for new 1.05 malloc (Read 871 times) previous topic - next topic

fat16lib

I have posted a new version of FreeRTOS as FreeRTOS20130521.zip http://code.google.com/p/rtoslibs/downloads/list.

This version is compatible with the new malloc in Arduino 1.05.

http://www.freertos.org/

Quote

FreeRTOS is a very popular RTOS from Real Time Engineers Ltd.

The FreeRTOS_AVR library supports AVR Arduinos. The FreeRTOS_ARM library supports the Due Arduino, and Teensy 3.0.

FreeRTOS Features:

    Large and growing user base and community.
    Free RTOS kernel - preemptive, cooperative and hybrid configuration options.
    Designed to be small, simple and easy to use.
    Queues, binary semaphores, counting semaphores, recursive semaphores and mutexes.
    Mutexes with priority inheritance.
    Tutorial books and training to educate engineers.

wilhem

Hi
Thank you very much for your updates.
I have a question regarding the library: since I m using the library on Arduino 2009 I realized that the following code (from your example frBlink.ino)
Code: [Select]
     
// Sleep for 200 milliseconds.
vTaskDelay((200L * configTICK_RATE_HZ) / 1000L);


doesn t exactly create a delay of 200 ms, but even more.

I looked in the file FreeRTOSConfig.h where all definitions are and discovered that:
Code: [Select]

#define configTICK_RATE_HZ ( ( portTickType ) (F_CPU/16384L))


Does it refer to another processor? Or is it compatible with Arduino (Atmega 328P)?!?

Thank you very much
Bye

fat16lib

#2
Jun 09, 2013, 04:39 am Last Edit: Jun 09, 2013, 04:24 pm by fat16lib Reason: 1
The tick is every 1024 microseconds on a 16 MHz CPU.  The delay will be 195 ticks or 199.68 ms.

Edit: 

The Arduino AVR core sets the timer 0 prescale factor to 64. Timer 0 overflows at the frequency of F_CPU/16384L.

The tick for FreeRTOS and millis() happens every 1000000*16384/F_CPU microseconds.

Note that millis() doses not advance every millisecond.  For a 16 MHz cpu millis() advances every 1024 microseconds.  The counter for millis() advances by two every 41 or 42 ticks.

Here is the code for the timer 0 overflow that occasionally bumps m by an extra count:
Code: [Select]

m += MILLIS_INC;
f += FRACT_INC;
if (f >= FRACT_MAX) {
f -= FRACT_MAX;
m += 1;
}

Go Up