3 Simple Ways to
Share What You Make

With Instructables you can share what you make with the world — and tap into an ever-growing community of creative experts.

PhotosPhotos

Share one or more photos of a project, recipe, or whatever you've made, quickly and easily.

Step by StepStep-By-Step

Share your step-by-step photos with text instructions of what you made so others can do it too!

VideoVideo

Share your how-to video. You'll need your embed code from a video site such as YouTube.

Realtime OS / LCD on $12 Discovery Board

Realtime OS / LCD on $12 Discovery Board
«
  • Floating_LCD.JPG
  • STM32-Discovery.jpg

One day I had a college professor getting ready to teach us students a powerful mathematical trick in EE101 - mesh circuit analysis I think.  Before he got started he said, "Today, my students, I give you a BIG gun."  It got our attention and I remember the quote, but sadly, I'd be hard pressed to do mesh analysis today.

Today, my Instructible readers, I give you BIG guns!


For all you hardcore hot-shot embedded software programmers, time to step up to the next level by learning how to use an embedded realtime OS on your next project.  Not only do you get a priority based preemptive realtime OS, you also get all the goodies that go along with a realtime embedded OS like:  Tasks, Queues, binary semaphores, counting semaphores, recursive semaphores and mutexes for communication and synchronization between tasks, or between tasks and interrupts.  Gives me goose-bumps just thinking about it!  All this software power comes by way of FreeRTOS which has been around a long time.

Oh, and the hardware we're gonna run this on makes my head spin.  We're not talking little a Pic or Atmel micro.  No, no, we're gonna run this OS on a new 24MHz 32 Bit ARM® Cortex™-M3 from ST Micro.  The folks at ST Micro have made a development board, called the STM32 VL Discovery (VL is short for value line), available for $12 dollars!  They are probably selling the board at a loss.  For comparison, this board is about 1/3 the cost of a standard Arduino board.

The 24MHz STM32F100RBT6B micro that is used on the Discovery board is probably the slowest they sell.  Most of these chips run much faster!  However, the chip itself is not overly expensive - Digi-Key carriers the chip for $3.50 on orders over 100 pieces.  For $3.50 you get 128k flash and 8k RAM - no EEPROM needed since the micro can write to its own flash.

Below are the specs right off Mouser's web page for the STM32F100RBT6B chip:
  • Core:                                              ARM Cortex M3
  • Data Bus Width:                             32 bit
  • Program Memory Type:                 Flash
  • Program Memory Size:                  128 KB
  • Data RAM Size:                              8 KB
  • Interface Type:                                I2C, SPI, USART
  • Maximum Clock Frequency:            24 MHz
  • Number of Programmable I/Os:       51
  • Number of Timers:                          6
  • Operating Supply Voltage:              2 V to 3.6 V
  • Maximum Operating Temperature:  + 85 C
  • Package / Case:                               LQFP-64
  • 3rd Party Development Tools:          EWARM, EWARM-BL, MDK-ARM, RL-ARM, ULINK2
  • Development Tools By Supplier:      STM32100B-EVAL
  • Minimum Operating Temperature:    - 40 C
  • On-Chip ADC:                                  12 bit, 16 Channel
  • On-Chip DAC:                                  12 bit, 2 Channel
     
Just in case you think the ARM is not good for small projects, I did another search on Digi-Key and turned up an even less expensive ARM chip from NXP.  The NXP micro (Digi-Key part number 568-5142-ND) is another ARM Cortex-M0 chip.  However, the NXP chip runs at 50MHz (I'm getting more goose-bumps again), has 8k of flash / 2k of RAM, 28 IO on 32 pins, I²C, SPI, USART for (drum roll please) $1.46 @ 100pcs.  I love Moore's Law in action.

Learning this stuff has real application in the job market too.  Jabbering on about your latest Arduino project is not going to get much attention in an interview with an employer.  However, explaining how you solved a priority inversion problem on a embedded realtime OS will!  Trust me, I've interviewed / hired lots of embedded programmers over the years as a former Motorola employee.

Here is a link to purchase the STM32 Discovery for $12 bucks from Mouser.  Buy two just in case - the shipping cost is crazy so you might as well get two.  Oh, and the LCD in the picture also comes from Mouser ($12.50 each).

http://www.mouser.com/stm32discovery/

The OS we're going to use is called FreeRTOS and their web address is listed next.

http://www.freertos.org/

Don't worry, you can use this OS in your commercial product without exposing your source code.  The OS uses a modified GPL license and is also royalty free.  For a complete breakdown of the license terms here is another link: 

http://www.freertos.org/index.html?http://www.freertos.org/a00114.html

The FreeRTOS realtime OS has been around for a long time and is very stable.  The OS has been ported to 26 different architectures and is very well documented.  I first used FreeRTOS on a product for GM.  My code, coupled with FreeRTOS, is running around in 10's of thousands of vehicles.  In those days, I used FreeRTOS on a Freescale Star12 chip (much less powerful).  I truly believe using FreeRTOS on that project saved my bacon.

Having the OS able to run on 26 different architectures, as I said before, does not mean your tied to a specific piece of hardware.  I like freedom of choice.  If you really want to dive in, I would suggest purchasing the book "Using the FreeRTOS Real Time Kernel - a Practical Guide".  The eBook version is only $25 bucks - buying the book helps the development of FreeRTOS too.  You can easily find the book at FreeRTOS.org.  Note, I have no financial interest in either FreeRTOS or ST - I just like both.

To keep up on future developments I'm working on you can always link to my RSS feed from my web site.  I try to post intermediate steps before I gather enough stuff together for an instructible.  My web site (Powerhouse Electronics) address is listed next:

ph-elec.com

For the RSS feed, add a "live" bookmark to:

www.ph-elec.com/rss.xml

 
Remove these adsRemove these ads by Signing Up
 

Step 1Software Tools

Software Tools
«
  • Screenshot.png
  • Screenshot-1.png

Getting a good build / debug environment setup seem to be more than half the battle.  This is really key in the long term.  Having a serious debugger is often overlooked when deciding on hardware.  Many of the low-end micros don't even have a debugger.  This forces the programmer to use printf statements and pin toggling to debug code. 

Anyway, seems like there are three choices when it comes to an IDE to program and debug the STM32 Discovery board.  I think all these IDE's are based on the Eclipse code base. The contenders are:
  • Atollic, LiteTrueSTUDIO
  • IAR, Embedded Workbench® for ARM
  • Keil, MDK-ARMTM
Each has limitations in terms of capabilities.  Only Atollic has unlimited code size and unlimited license duration.  Therefore, based on unlimited code size, I started developing with Atollic.  I've since learned, only one break point is allowed, there is a nasty pop-up ad that forces you to click "OK" after THREE seconds wait.  That nag ad comes up A LOT.  And strangely, it's almost impossible to change build settings without hacking XML code.  Still, once setup and running, I've had good luck with TrueSTUDIO.  Oh, and I got a quote on the "Pro" version from Atollic - the truly unlimited Pro version goes for $2,500 bucks.  To bad there is not a student version.  I would be willing to pay $100 bucks to get rid of that stupid nag ad!  Come on Atollic!  There must be a middle ground.

I'm not sure about IAR or Keil, but Atollic does not run on Linux.  Nor does it run under Wine, I'm told.  However, it does just fine running on Linux inside a VMWare virtual WinXP machine.  The screen-shot below shows WinXP running in a window with Atollic running inside that.  Total build time is 20 seconds after a "clean".  Not too bad.  Well, I guess it goes without saying, but I hear Atollic also runs OK on Windows too.  If you must.

The second screen-shot below shows the debugger in action.  The debugger inside the Atollic IDE works very well.  Everything works as you would expect.  There are also some video's that Atollic has made that show how to use the debugger to the fullest.  I've watched the videos twice already and will probably watch them yet again.  There is nothing more precious to an embedded software programmer than a powerful debugger!

Atollic makes downloading and installing TrueSTUDIO easy.  After you register they automatically email you a license key within a minute.  The windows installer is easy to use and quick.  The first time the software is run it will ask you for a "Workspace" location.  This is simply a directory where all your source code is located.  Note, there is also an easy way to switch to another workspace too.

« Previous StepDownload PDFView All StepsNext Step »
18 comments
Aug 6, 2011. 3:18 AMzapper067 says:
Then if we increase the RAM...
Aug 5, 2011. 6:54 AMzapper067 says:
Is it possible to use i386 and run windows xp embedded on it?
Jun 27, 2011. 1:49 PMLayout says:
I'm amazed the STM32 Discovery boards are not more popular. I have the same problem with my instructables; I think that once people see they are not based on an Arduino they simply put them in the "too hard" basket.

Thanks for the information on installing/running FreeRTOS. That is my next project for this board, I just need to think up an application.
Jun 16, 2011. 2:28 PMsebita_1982 says:
Men you are GREAT !!!!

Im learning STM32 with a discovery kit and i hope learn how to use FreeRTOS with this projet... but setp by step.

Thanks again!!
May 2, 2011. 5:21 AMR- says:
Thanks for the info, I want to try one of these.

Just ordered 2.
$10.34 each currently at Arrow
Shipping and tax was $9.40 though
Apr 30, 2011. 2:28 PMBongmaster says:
just looked at mouser and that board apparently costs $14
May 1, 2011. 2:00 AMBongmaster says:
yups same part, i just looked and its now $13.13
think i gotta keep an eye and hope its chepest wen i can order one if i think its good for buying X3
May 1, 2011. 11:36 AMBongmaster says:
in the checkout its got:

MERCHANDISE TOTAL:

$13.13
Delivery Charge:
$30.00
Order Total:

$43.13

thats a hell of alot for postage :/ totally put me off there
doesnt work out cheap at all
May 1, 2011. 11:07 AMBongmaster says:
most strange :/
May 2, 2011. 7:19 AMBongmaster says:
thanks i'll see wat it says for me

Pro

Get More Out of Instructables

Already have an Account?

close

All Steps Viewing
View all steps of an Instructable on the same page when you're a Pro Member.

Upgrade to Pro today!
54
Followers
16
Author:jimk3038(www.ph-elec.com)
Founder of Powerhouse Electronics. For more info goto: www.ph-elec.com