cancel
Showing results for 
Search instead for 
Did you mean: 

Demo: FreeRTOS on STM32F4 Discovery

Posted on January 08, 2012 at 22:58

For all

interested, I developed a free demo download.  The demo is a simple project which can be dropped into TrueSTUDIO.  Within a few minutes you should be able to have a full blown preemptive real-time operating system up and running on the Discovery board!

The demo uses some code from Thomas Kindler who sorted out how to get FreeRTOS running on the STM32F4 (this was no small matter when you add a FPU into the mix).

Here is a link to Thomas's work:

https://github.com/thomask77/FreeRTOS_ARM_CM4F

My FreeRTOS demo does the following:

  • Runs several tasks in parallel using a SysTick of 1000Hz.

  • USART2 is used in a debug task to send status message from any task simply by calling vDebugPrintf().

    • Source code for a super simple printf function is provided to format nice debug messages.

    • A FreeRTOS queue is used to buffer the debug messages.  The debug task removes the characters and sends them out the uart port.

    • No uart interrupts are used in the debug task (didn't want to get in the way of the main tasks).

    • The debug task is run at a low OS priority.

  • TIM4 is setup to output a PWM single into the four LEDs around the MEMS motion sensor.

    • A simple function call provides a way to quickly and easily set the LED illumination levels for any of the four LEDs.

  • One task reads the MEMS motion sensor every 15ms, averages the results, and updates the four LEDs around the sensor.

    • The amount the board is tilted (as measured by the MEMS motion sensor) determines the LED brightness.

    • The LED

      illumination

      fades nice and smooth as the board is tilted.

My hope is that this demo provides a quick and easy way to get started with the STM32F4 Discovery board. 

Here are the links where you can find the code to download:

http://ph-elec.com/archives/stm32f4-freertos/

http://ph-elec.com/archives/freertos-demo-and-truestudio/

#keil-uvision #freertos #freertos #stm32f4 #stm32f4 #freertos
2 REPLIES 2
nospam
Associate II
Posted on January 08, 2012 at 23:18

Excellent.

I would be really grateful if you could post your code up to the FreeRTOS Interactive site, where more people will be able to find it.  There is an ST specific forum:

http://interactive.freertos.org/forums/135228-stmicroelectronics

Other links that may be of interest to viewers of your post...

TrueStudio demo for the value line discovery board:

http://www.freertos.org/FreeRTOS-for-Cortex-M3-STM32-STM32F100-Discovery.html

IAR demo for the STM32F407

http://www.freertos.org/FreeRTOS-for-STM32F4xx-Cortex-M4F-IAR.html

Regards,

Richard (FreeRTOS)

brunobruno9
Associate
Posted on March 14, 2012 at 17:56

just got Jim's demo working under Keil's uVision (v4.23).

I attached the customized files including uVision project files for those interested.

Just open the project file, rebuild and debug - enjoy 🙂

As a side note:

I took ''stm32f4_discovery_audio_codec.c'' out of the project as it generated errors and I didn't use it anyway - it's still in the Utilities folder if you need it.

________________

Attachments :

STM32F4-FreeRTOS-Demo_Keil.7z : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006Hzzk&d=%2Fa%2F0X0000000bSp%2FRLD4KrbAIym5iXjg85PWAuqq_crRKuaCb1HSdNuce54&asPdf=false