MJB logo

Resources for embedded micro-controller firmware development

Simple real-time multi-tasking kernels
Support function libraries and Low-level I/O drivers for...

AT91SAM7S (ARM) | ATmega-XX (AVR) | 68HC12 / MC9S12 | AT89C5131

USB Test & Measurement Class device firmware design...

USBTMC/USB488 Reference Design (AT91SAM7S )

Your feedback, comments and enquiries are welcome... send email to:


BERT: "Basic Embedded Real-Time" (OS) 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, MC9S12, etc). BERT is freeware and is distributed as a suite of C source code modules.
Download BERT 'HC12 here (150KB zip file)


ALERT: "A Low-End Embedded Real-Time" system

"ALERT" is a tiny micro-controller operating system, designed to reduce processor and memory overheads to a minimum. It is ideally suited to 8051 core processors, but may be ported to other 8-bit microcontoller families, e.g. PIC, AVR, 6805. The code has been designed to get a small embedded application up and running with minimum effort.

Example firmware based on ALERT is presented here for the Atmel AT89C5131 USB micro-controller (8051 core). The code incorporates a "host command interface" (HCI) with resident "debug monitor" and a suite of API functions to support various MCU resources, including on-chip UART, SPI, EEPROM and USB device controller. The HCI is accessible via the UART or USB port.

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

More details - ALERT overview

Download ALERT_5131_v3.3
(This is a generic version of ALERT having no particular application.)

For a complete practical example application based on ALERT, see the author's development project:
The "7-uP" Alarm-clock /Time-switch.
C source code package free to download.
The main circuit board is an ideal ALERT development platform and would suit many other applications.

ALERT firmware also runs on Atmel's AT89STK-05 Evaluation Board and Futurlec's "USB Development Board" (www.futurlec.com).


AT91SAM7S (ARM7) Example Firmware

This "SAM7 Debug Monitor" is a complete firmware application comprising target-resident debugging facilities and peripheral I/O API function library. 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-ARM tools.

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)


ATmega (AVR) Example Code with Debug Monitor

ATmega16 -- for AVR Studio + WinAVR (GCC-AVR tools)

This example C code makes a good starting point for the development of application firmware for the ATmega16 and similar AVR MCUs. It includes a debug command set which utilises the serial port (UART). A target-resident debug facility is particularly useful if you don't have access to a JTAG ICE debugging tool. This firmware was developed using WinAVR under AVR Studio 4.

Download 'AVROS' ATmega16 Debug Monitor

ATmega128 -- for IAR Compiler

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. This firmware was developed using the IAR toolchain.

Download ATmega128 Debug Monitor here (20KB zip file)


ATmega16 - AVR Training Kit

This is a documentation package which describes the assembly and usage of a micro-controller "training kit" intended for students learning AVR programming. The doc pack includes example AVR assembly-language programs (source code).
The kit is designed around a pre-built micro-controller development board based on the ATmega16 AVR processor. The board is available from
Futurlec. With the addition of an LCD panel and 16-button keypad, plus a few sundry components, a complete ATmega-AVR training setup can be assembled at low cost.
[
More information]

Note: The AVR Training Kit (hardware) is not available from this site. The Kit is assembled from parts obtained from various electronics suppliers. A parts list with suggested suppliers (for delivery in Australia) is included in the doc package.

Download ATmega16 Training Kit (doc package)


Introduction to USBTMC - the USB Test & Measurement Class

For many applications, the Test & Measurement Class (USBTMC) has distinct advantages over other USB device classes.
Although targetted towards instrumentation, as a replacement for the obsolete "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 and maintain host-side (PC) driver software. Your PC application software communicates with USBTMC devices via a standard API function library. The API library provides I/O functions designed to facilitate transfer data to and from VISA-compliant USBTMC devices. The API standard is known as "VISA" (Virtual Instrument Software Architecture).

The VISA API is supported and maintained by both National Instruments and Agilent Technologies. VISA API library packages are free downloads -- refer to company websites.

The VISA API executable (DLL) incorporates USBTMC and USB488 host driver software. The driver detects and adapts itself automatically to each unique TMC/488 device connected. Both the NI and Agilent VISA packages come with an interactive test utility which may be used to verify that a TMC/488 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 Windows, Mac OS and Linux. For a Windows host, application software can be developed in Visual Basic or Visual C/C++. National Instruments' LabVIEW software also supports USBTMC devices. Third-party devices (i.e. not manufactured by NI or Agilent) using a VISA-compliant USBTMC-488 interface are easier to get talking with LabVIEW than devices using other comm's interfaces.

Design your Test & Measurement instrument with a VISA-compliant USBTMC-488 interface, preferably using the IEEE488.2 command/response message syntax, to get the following benefits:

  • Avoid the need to develop and maintain USB device driver software for the host computer
  • Choice of host computer development environments for your instrument application software...
    e.g. NI LabVIEW, Microsoft Visual Studio (VB, C/C++), etc
  • Use an existing standard API function library (VISA) -- freely available
  • USBTMC/USB488 Reference Design, with source code, available now from MJB (see below)

USBTMC/USB488 Device Firmware Stack and Reference Design

Now available to commercial product developers...

A USBTMC Reference Design meeting the following objectives:

  • USBTMC stack 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 syntax
  • Implements a minimal IEEE-compliant status reporting mechanism
  • Implements the USB488 standard remote/local (RL) state machine

Initial target platform is Atmel AT91SAM7-xxx (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 annotation is of professional quality.

More info on the USBTMC Reference Design

A licence must be purchased to use the USBTMC firmware stack in a commercial product development.
For licensing details, send email to the address below.
Please include your country, city, company name, web address, job title, and the hardware platform you plan to use.


* 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" obtained from this site.

Last updated: October 2012