Using FreeRTOS Semaphores in Arduino IDE

by Phillip Stevens

  • 13,425 views
  • 8 comments
  • 24 respects

Using FreeRTOS multi-tasking in Arduino

by Phillip Stevens

  • 125,351 views
  • 43 comments
  • 123 respects


Replicated projects 0

 Phillip Stevens hasn't replicated any projects yet.

Respected projects 0

 Phillip Stevens hasn't respected any projects yet.
  • Using FreeRTOS multi-tasking in Arduino 3 months ago

    Yes. I agree that the best way to get accurate timing is with an output ping-pong and an oscilloscope. I've used this method previously to measure the time taken in an interrupt (where there was a limited time budget).

    Any other method substantially disturbs the system, and specifically in this project the Watchdog Timer used to drive the FreeRTOS scheduler only has an inaccurate 15ms cycle, so trying to measure anything less than (say) half a second is going to be quite inaccurate.

    The code example you sent (in email) looks like it will be done in 5 ms or so. The time it will take to execute will be constant and the same with and without the scheduler. Unless the scheduler interrupts the task, and then you'll get quite a different (much longer) time probably in excess of 15ms before the task is scheduled to run again.

  • Using FreeRTOS multi-tasking in Arduino 5 months ago

    Massimo actually suggested this step when licensing was converted to MIT, but vitriol ensued. Nothing was done.

    https://groups.google.com/a/arduino.cc/forum/m/#!topic/developers/JdLZ2Mk6aEY

  • Using FreeRTOS multi-tasking in Arduino 5 months ago

    I have successfully ported an Arduino mega program to the FreeRTOS environment. Lots of grief with the standard SD code and String functions. I think that anything using the primitive malloc() functions has problems once scheduling has started.

    Yes. I'd agree with you that Arduino is quite loose with malloc() calls, and that this leads to issues when running on FreeRTOS. Ideally, use the FreeRTOS tools for memory allocation.

    Is there a method to periodically invoke a task at a specified interval?

    Tasks need to keep running. i.e. they are not typically re-invoked periodically. However, the vTaskDelay() function can be used to put a task to sleep for a specific period, and therefore be re-invoked as needed. A sleeping task doesn't use CPU resource.

    It is also possible to launch a task, as a child task. But this is a rather "heavy weight" method of getting the action to occur at a specified interval.

    How does one maintain 2 sets of libraries?- one for Arduino, 1 for FreeRtos.

    In separate directories. The Arduino IDE doesn't support build options for libraries, unfortunately.

    Is there a tutorial on configuring FreeRTOS? I need MSec task switching.

    Yes. There are plenty on the freertos.org web site. vTaskDelayUntil() is your msec timer.

    Is the primitive Arduino millisecond still alive and accurate?

    Yes, they are alive, but won't be accurate because they will be halted when their invoking task is not active. Best not to use them.

Add projectSign up / Login