Field Reprogrammability for Flexible Automation Control Applications

In my post before, I have analyzed a handful of rechargeable battery both old and new in an attempt to gain practical information as to what happen to them over time. The observation is made possible only by what I call, “A stable measurement platform” based on a 68HC908QB8 CPU from NXP (in the old days, it was Freescale). As time has passed, the measurement platform is entering its production phase (as ADIO-100. It is actually a sister product to another HC908 machine, “BI-K11 Morse Keyer for PS/2 Keyboard and Paddle” shown side-by-side on that website). The measurement board is an ideal candidate for bringing IOT to an experimenter’s desk. While it is quite capable in conveying the measurement results and commands to the host PC, following the tradition that has been in my corner of industry, it is inevitable that the board will require field reprogrammability. This way, the board is malleable and can be shaped into any measurement or automation role that the designer wishes. With proper interface, it can be made present on the internet as an IOT device without a host, or you can keep it as a traditional DAQ and I/O board and let it talk to a PC host. Flexibility, along with a stable platform, will make this board an excellent candidate for multitude of applications.


The ADIO-100 board schematic with its HC908QB8 CPU is shown above. The board is designed so you can re-task it into any application you want by downloading/reflashing your custom code. The RS-232 connection can be seen at CN-3 connector. As you can see, the board itself is a pretty simple board. However, its versatility is endless, with Analog-to-Digital Conversion pins (available on PTA0 and PTA1), as well as various timer pins, the board packs a formidable punch when combined with field reprogrammability


Field reprogrammability (in this article, we will use a particular example of ADIO-100 board with its HC908QB8 microcontroller, but the general idea is for any system) will enable the user to configure the software inside the board to perform any task. The original, of fundamental use, of the board, is to serve as DAQ (data acquisition) board along with some relays and digital input/output ports. In basic usage, with RS-232, the board will allow a host PC to get ADC (Analog to Digital Conversion) reading, turn relays on and off, or get some 0 – 5V TTL input and output interface. Field reprogrammability, will allow the user to change the software in the board CPU, and make it into a mini PLC (Programmable Logic Controller) and perform some specific automation task. The possibilities are limitless as to what the board can be configure to. The limiting factor may be related to the voltage range or the speed of CPU and the interfaces .


To make it ‘user friendly’ (i.e. easier to remember), I will name field reprogrammability software for ADIO-100 board as In-Circuit Flash Eprom Reprogramming (“ICFER”) software. Why ICFER? Because the name sounds similar to the venerable IVFER (“In-Vehicle Flash Eprom Reprogramming”) software of Ford Motor Company, Dearborn, Michigan, in which this software pays its homage to. IVFER software has enabled easy reconfiguration/reflashing of millions of Ford vehicles, in its attempt to maintain quality and compliance to OBD-II.


So, what does ICFER do? Like any good field reprogramming software (cough, cough, no reference to any vehicle manufacturer), ICFER will have to have an initiation protocol, to ensure the operation of the application software and to prevent it from inadvertent execution of ICFER bootstrap software. The proposed initation protocol is very simple:

Embedded Target Host PC
Sends ‘>’ prompt upon device reset. Followed by a 5-ms wait for response. If no response, target resumes normal operation.
Responds with an ‘@’
Sends an 8-bit interrogation seed value ‘XX’
Responds with ‘YY’ answer key = 1’s complement of XX)
Target is ready, sends ‘=’

This initiation communication is run at 19.2 kbps with 8N1 in RS-232 protocol. All the steps above are taken to ensure that the initation protocol is not accidently engaged. All things must be in place in order to engage ICFER: 19.2 kbps, 8N1, prompt, seed, key, etc. This is all to ensure that in the field, under normal condition, the CPU will execute the application (user’s) software, not the bootloader (ICFER).

The following is the list of functions supported if ICFER protocol is engaged. Commands can be given after the ‘=’ prompt. Send the packet as is, there is no need to terminate command with carriage return (‘\r’). All values are to be sent in hexadecimal values, not in their ASCII representations.


AA AA is 16-bit address
XX – data bytes to program (16 bytes)

CS – packet checksum including 10

20 AA AA CS Data dump: Will show 8 bytes of data

AA AA is 16-byte address

CS – packet checksum including 20

30 AA AA CS Erase Flash Page at Address AA AA (A page consists of 64 consecutive bytes starting from addresses $XX00, $XX40, $XX80, or $XXC0)

AA AA is 16-byte address

CS – packet checksum including 30

E0 CS Display software version
F0 AA AA EE EE CS Computes byte checksum starting from address AA AA ending at EE EE

CS – packet checksum including F0

FF CS Exit, return to user program at E400

Memory Map

If there are many people working on a project (like in the old Ford days), here is the one thing that people are waiting for: The memory map. Memory map allows you to plan how you are going to use the board, as it tells you the space you have and where to put different things in different places. As both the designer of the hardware and software, I can be the czar of memory map: Defining where things go in different locations in the memory space.

The following is the memory map for the user to configure his/her code with the ADIO-100 board and the ICFER software. More generally, this memory map can be used for any HC908QB CPU with the ICFER software. Please note not to go beyond the limits as overlapping code will clobber flash bytes and render them into random number. User interrupt table basically mimics that of the CPU, only moved into address FDC0. The ICFER code itself will sit in the area of DE00 to E3FF.

0000 – 003F Direct Page Registers
0040 – 013F RAM 256 bytes
DE00 – E3FF Reserved ICFER Flash Memory
E400 – FDBF User Flash / Program Area (6.5 kB)
FDC0 – FDFF User Interrupt Table
FE00 – FFCF Various Flash/Registers
FD00 – FFFF Interrupt Vectors

In turn, the memory map completes the list of information needed by a user, to field-reprogram either the ADIO-100 board or any HC908QB8 CPU with the ICFER software. A software application,, has been created to utilize the ICFER software. These software files are available for download by an experimenter. While the is available as a source code, the ICFER file is in executable form (S19 format).

The memory map states that you need to have an image of the CPU interrupts at address FDC0 to FDFF. You will need to write your code according to this example. This code is taken from the ADIO-100 default software (compiled using SDCC).


If you write your own code for the ADIO-100 code, and reflash it using ICFER, you can turn it into a mini PLC for example. You can make it an independent system, running autonomously without a PC host. The possibilities are endless as to what you can ask the HC908QB8 CPU to perform.


With the explanation above, we have discussed the reasoning for field reprogrammability. We also have discussed the component for the protocol that we named as ICFER (In-Circuit Flash Eprom Reprogramming) software: There is the initialization protocol as well as the function protocols themselves (erase, program, checksum, etc). With ICFER, a user can shape any application software in the field, allowing the user to either fine-tune the application in the field to meet changing environment, maintain quality (like the case in the automotive industry), or re-task an old system for a new application. In short, the ability will greatly enhance the economic feasibility of a system.

The software and its host PC application is available for download here.

I claim the copyright of ICFER software, if anyone wishes to use it for commercial applications, he/she is welcome to contact me for permission.



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s