Resources for embedded micro-controller firmware development

Simple real-time multi-tasking kernels
Support function libraries and Low-level I/O drivers
On-chip peripheral support for...
AT91SAM7S (ARM) | ATmega128 (AVR) | AT89C5131 (8051) | 68HC12

USB developer resources
Atmel AT89C5131 | AT91SAM7S (ARM) | Maxim MAX3420E
USBTMC/USB488 Reference Design

Your comments and enquiries are welcome.


BERT: "Basic Embedded Real-Time" (operating system) for micro-controllers

There's a lot of embedded RTOS's around and they all have their pros and cons. The "cons" are mostly related to licence requirements (i.e. expense) and/or unnecessary complexity (i.e. unwanted overheads on MCU speed and memory).
Commercial RTOS's are overkill for the majority of micro-controller applications, whereas BERT may be a good compromise.
The code is designed to be easily portable to a variety of different processors. Hardware-platform dependencies are (mostly) confined to a separate I/O driver module, intended to be modified or replaced to suit the target platform.
BERT includes a full-featured command-line user interface (CLI) with resident debug monitor facilities, plus a control-surface user interface, and generic support for EEPROM data storage.
BERT provides a simple tried-and-proven framework upon which to build an embedded application.
For more details, see BERT Overview

An example firmware application based on BERT is customised for the Motorola/Freescale 'HC12 processor family (68HC12, HCS12, etc). BERT is freeware and is distributed as a suite of C source code modules.
Download BERT 'HC12 here (150KB zip file)


ALERT: "A Light Embedded Real-Time OS" for Low-End Micro-controllers

ALERT is a smaller operating system, designed to reduce processor and memory overheads to a bare minimum. It is ideally suited to 8051 core micro-controllers and others having limited on-chip SRAM or flash PROM capacity (e.g. AVR, PIC, 6805).
The code has been designed to get a small embedded application up and running with minimum effort.
ALERT provides a simpler tried-and-proven framework upon which to build a small embedded application.
For more details, see ALERT overview

ALERT operating system for AT89C5131

An example firmware application based on ALERT is customised for the Atmel AT89C5131 USB micro-controller. The code incorporates a command-line user interface (CLI) with resident "debug monitor" and a suite of OS functions to support various MCU resources, including on-chip UART, SPI, EEPROM and USB device controller. The CLI is accessible via the UART or USB port.

The USB device "stack" uses the Communications Device Class (CDC), implementing a "virtual UART" function library designed for USB-to-Serial converter applications. Windows (2000/XP) incorporates a USB CDC driver, so the host PC application software can communicate with the device via a "Virtual COM port". HyperTerminal may be used for testing.

The sample firmware runs on Atmel's AT89STK-05 Evaluation Board and Futurlec's USB Development Board (us$35)
(
www.futurlec.com). If you have the time and practical skills, you can build your own development board... example schematics are included in the download package.

!!! New release: ALERT_C5131 v3.0 (with extended peripheral support) ...more details

Keep checking this page for ALERT C5131 firmware updates. Development plans include support for a 4-digit 7-segment LED display, serial dataflash (SD) memory and MP3 decoder chip..

Download ALERT C5131 v3.0 (270kB zip file)

ALERT Development Board with AT89C5131 Micro-controller


AT91SAM7S (ARM) Example Firmware

This "SAM7 Debug Monitor" is a complete firmware application comprising target-resident debugging facilities and example peripheral drivers. It runs on Atmel's AT91SAM7S-EK evaluation board and compatible hardware platforms. The firmware provides a basic framework upon which to develop user applications. The firmware is built using the free GCC tools.

NEW!!! Release v2.2 with USB CDC function library

The USB CDC "Virtual UART" library (developed by MJB) is well structured, richly annotated, and much simpler than Atmel's example "USB framework" code. A Windows host driver file is included. Students of electronics technology and I.T. will find this firmware helpful to implement a USB CDC project.

For details, see Guide to MJB's SAM7 Debug Monitor (with GNU/GCC Build Notes)

Download AT91SAM7S Debug Monitor v2.2 here (150KB zip file)


ATmega128 (AVR) Debug Monitor

This AVR Debug Monitor is a complete stand-alone program with a full-featured command-line user interface (CLI), similar to that provided in the 'BERT' operating system. The monitor makes a good starting point for the development of application firmware for the ATmega128 and similar AVR processors. A target-resident debug facility is particularly useful if you don't have access to a JTAG ICE debugging tool.

Download ATmega128 Debug Monitor here (20KB zip file)


ATmega128 (AVR) Bootloader Design Note

The Design Note provides essential information for the development of bootloader code to suit the ATmega128 and similar AVR processors. Included in the resource pack are source files and a customized XLINK linker command file.

Download ATmega128 Bootloader Design Pack here (20KB zip file)


USB Developer Resources

Introduction to USB

A very good introduction for novices can be found at... http://www.usbmadesimple.co.uk/

USB is not overly complicated at the device end, once you get your brain around the process of "enumeration" (i.e. standard "device requests" on the Control Endpoint, as described in Chapter 9 of the USB2.0 Specification). The major difficulty with USB, for developers, is to produce the host-side (Windows or Linux) driver software. Windows has "built-in" drivers for some USB device "classes", e.g. HID, CDC, MSD (Mass Storage), Audio, Video, etc, but there is no "general purpose" class. And you still have to create a "driver information file" (*.inf), which can be hard to get right!

About USB Communications Device Class (USB-CDC)

Using a relatively simple driver information file (*.inf), the communications device class (CDC) allows your device to talk to the host PC via a "virtual COM port". This means that your USB device appears to your PC application software as a serial ("RS232") device, just like a physical COM port, but faster. This is probably the simplest method to implement a fast USB connection. You can use Hyper-Terminal to test your device, if the Bulk-In/Out data is encoded as printable ASCII chars. This is the scheme I chose to use for my AT89C5131 and AT91SAM7S example firmware.

Note: The maximum data transfer rate using USB CDC with a "virtual COM port" is about 1Mbit/sec. (This is a Windows driver limitation, not a USB limitation.)

About USB Test & Measurement Class (USB-TMC)

For many applications, the Test & Measurement Class (USBTMC) has distinct advantages over other USB device classes. In fact, its only shortfall is the absence of isochronous transfers which, for the majority of applications, won't be a concern. Although targetted towards instrumentation, as a replacement for the ageing "GPIB" (IEEE488 bus), the USBTMC protocol is very generalized and well suited to a broad range of applications requiring fast Bulk In and Bulk Out data transfer.

Perhaps the most compelling reason to use USBTMC is that you don't need to develop host-side driver software or driver information (.inf) scripts. Your host PC application software communicates with USBTMC devices via a third-party 'application program interface' (API). The API provides a library of standardized I/O functions designed to facilitate transfer data to and from compliant USBTMC devices. One such standard is "VISA" (Virtual Instrument Software Architecture).

A VISA API library is available from either National Instruments or Agilent Technologies. (These are free downloads -- refer to company websites.) The VISA API incorporates USBTMC host driver software. The driver detects and adapts itself automatically to each unique TMC device connected. Both the NI and Agilent VISA packages come with an interactive test utility which may be used to verify that a TMC device is communicating correctly with the host controller.

The VISA API library is provided in the form of a linkable object code file (DLL). These are available for both Windows and Linux. For a Windows host, application software can be developed in Visual Basic or Visual C/C++. National Instruments' LabView software also supports VISA-compliant USBTMC devices.


USBTMC/USB488 Reference Design

Now available from MJB... a USBTMC device firmware stack meeting the following objectives:

  • Complies fully with the USBTMC/USB488 Specifications (Rev 1.0, 2003)
  • Implements all standard USBTMC/USB488 Class Requests
  • Conforms to VISA (Virtual Instrument Software Architecture) host requirements
  • Provides a small example command set based on the IEEE488.2 message protocol
  • Implements a minimal IEEE-compliant status reporting mechanism
  • Implements the USB488 standard remote/local (RL) state machine

Initial target platform is Atmel AT91SAM7S (ARM7) with on-chip USB peripheral. The example "application layer" and USBTMC "class layers" (source modules) have been designed to be independent of hardware platform, so the code can be more easily ported to other platforms. The source code and supporting documentation is of professional quality.

Calling for expressions of interest from professional developers...

If you are interested in my USBTMC Reference Design (source code and documentation), please contact me for details.
This is not freeware! Licences to use the package may be purchased with or without technical support.


Recommended Windows Utilities for USB Testing & Debugging

Microsoft USBView - USB Connection Viewer

USBView is a free utility from Microsoft which displays the USB connection tree and shows any USB devices connected, together with their configuration data (descriptors).  This is very useful for diagnosing USB enumeration problems, with or without the device driver installed on the host PC.  USBView runs under Windows 98, ME, 2000 and XP.
To obtain USBView, Google with "Microsoft USBView download"

USB Monitor from HHD Software Co.

USB Monitor is a Windows application that logs USB data transfers between the host and selected device(s). This is an excellent piece of software, well worth the small price asked (under us$40 for the 'lite' version). There's a trial version too.
To obtain USB Monitor, Google with "HHD software USB monitor"


Maxim MAX3420E USB Peripheral Controller

The MAX3420E is is a very well designed device. It uses a fast SPI connection to the micro-controller instead of a parallel bus. The chip has automatic recovery from bus errors. The register set is devoid of unnecessary complexity, which makes it a breeze to develop driver firmware. The chip is well supported with documentation available from Maxim's website. The datasheet is clear and comprehensive. The FAQ file demystifies and explains aspects of USB which novices often find intimidating.

Maxim's sample driver firmware gives you the essential "bare bones" requirements to get the device to enumerate. I have developed a more generalised firmware library which may be more easily customized to a particular application. The library provides essential "Chapter 9" (enumeration and standard device request) support, plus generic functions for endpoint read and write, status checking, etc. Although the library was developed for the USBTMC/USB488 class, it is easily adaptable to other classes using Bulk-In and Bulk-Out for data transfer, for example CDC. (If there is sufficient demand, I will develop a CDC "Virtual UART" library for the MAX3420E. Meanwhile, you could use the CDC library from ALERT c5131 as a framework. -- MJB.)

Download MJB's MAX3420E USB device firmware library


* Disclaimer *

Source code and other "intellectual property" offered as free downloads on this website are original works of M. J. Bauer, except where acknowledged to the contrary. Otherwise, any resemblance to prior art originated or developed by others is purely coincidental, or due to derivation from similar works or well-established art in the public domain. The author does not accept liability for any adverse consequence of the use of "intellectual property" copied from this site.

Last updated: Sept. 2008