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
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 ads by
Signing UpStep 1: Software Tools
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
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.










































Visit Our Store »
Go Pro Today »




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
Thanks for the information on installing/running FreeRTOS. That is my next project for this board, I just need to think up an application.
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
Im learning STM32 with a discovery kit and i hope learn how to use FreeRTOS with this projet... but setp by step.
Thanks again!!
Thanks for the comments.
There is more info on my web too. Have a look at: ph-elec.com
Thanks,
Jim
Just ordered 2.
$10.34 each currently at Arrow
Shipping and tax was $9.40 though
Thanks,
Jim
think i gotta keep an eye and hope its chepest wen i can order one if i think its good for buying X3
Note, the price has been $12 bucks at Mouser for many months.
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
When the board first came out ST advertised it at $10 USD.
Good luck,
Jim
http://www.st.com/internet/evalboard/product/250863.jsp