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).
The OS we're going to use is called FreeRTOS and their web address is listed next.
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:
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:
For the RSS feed, add a "live" bookmark to: