Pages: [1]   Go Down
Author Topic: Update of FreeRTOS for new 1.05 malloc  (Read 757 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Edison Member
*
Karma: 63
Posts: 1599
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 40
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
     
// 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:
#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
Logged

0
Offline Offline
Edison Member
*
Karma: 63
Posts: 1599
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
m += MILLIS_INC;
f += FRACT_INC;
if (f >= FRACT_MAX) {
f -= FRACT_MAX;
m += 1;
}
« Last Edit: June 09, 2013, 09:24:52 am by fat16lib » Logged

Pages: [1]   Go Up
Jump to: