Instructables

Realtime OS / LCD on $12 Discovery Board

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
zapper0672 years ago
Then if we increase the RAM...
zapper0672 years ago
Is it possible to use i386 and run windows xp embedded on it?
jimk3038 (author)  zapper0672 years ago
Nope, with only 128k of flash space there is no way. I have no idea what xp would need but 128k is way too small. Even my first IBM PC back in the 80's had a hard drive with 20Megs of space. That 20Meg drive is over 150 times bigger that 128k on this micro.
jimk3038 (author) 3 years ago
I'm amazed this instructible is not more popular!

First, the instructibles folks sat on it for a couple days. Then, once they decided to publish it they did so with a bunch of others. That push my instructible off the first page quickly. Plus, for some reason, they also failed to rate it in the "editor's picks". With no star rating this instructible was doomed to poor ratings.

I also sent an email to Hack-a-Day trying to get them to pick it up. Nope.

Well, maybe it's just to technical for most folks.

It's not that I'm ticked off - I just thought this was really good stuff and I'm disappointed it got buried so quickly.

I don't get it,
Jim
Layout jimk30383 years ago
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.
jimk3038 (author)  Layout3 years ago
Thanks for the kind words.

Yep, adding FreeRTOS on top of the STM32 board makes for an awesome combination.

Guess we'll just have to crank out some great projects to show the way.

Good luck,
Jim
sebita_19823 years ago
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!!
jimk3038 (author)  sebita_19823 years ago

Thanks for the comments.

There is more info on my web too.  Have a look at: ph-elec.com

Thanks,
Jim
Bongmaster3 years ago
just looked at mouser and that board apparently costs $14
jimk3038 (author)  Bongmaster3 years ago
Strange, I just look the part up at Mouser and they have it for $11.85 USD. The part number at Mouser is: 511-STM32VLDISCOVERY. Is this the same part number you used?

Thanks,
Jim
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
jimk3038 (author)  Bongmaster3 years ago
Very strange, still shows $11.85 for me. I wonder if Mouser has a higher price because your from Norway. If true, that just stinks.

Note, the price has been $12 bucks at Mouser for many months.
most strange :/
jimk3038 (author)  Bongmaster3 years ago
Here is a link to a web page at ST. The page lists all the distributors, world wide. Hope this helps.

http://www.st.com/internet/evalboard/product/250863.jsp

thanks i'll see wat it says for me
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
jimk3038 (author)  Bongmaster3 years ago
The worst part is, ST (who makes the board) is head quartered in Geneva, Switzerland. Your board, from Mouser, probably would cross the Atlantic twice. There must be another distributor in Europe you can use.

When the board first came out ST advertised it at $10 USD.

Good luck,
Jim

R-3 years ago
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
Pro

Get More Out of Instructables

Already have an Account?

close

PDF Downloads
As a Pro member, you will gain access to download any Instructable in the PDF format. You also have the ability to customize your PDF download.

Upgrade to Pro today!