Using the Mini-Scanner Flash Loader to Update Firmware

Using a special serial cable and a computer of some sort, you can update the software that runs inside the Mini-Scanner.  (This "embedded" software is often called "firmware" because it is fixed inside the system and takes a bit of effort to change).  You might want to do this to take advantage of a new firmware release that includes additional functionality or fixes some problems.  Here you will find instructions for updating the firmware using the Flash Loader utility included in the Mini-Scanner.

Equipment Required

First, let's go over the things you will need to update the Mini-Scanner firmware.  Take a look at each bullet item and follow the hyperlinks if you need help understanding the item or exploring alternatives.  Then, come back to this page and we'll continue to the firmware update procedure itself.

If you have a serial cable and know how to use it, but you are also using an extension serial cable for extra reach, you should make sure you have the right type of extension.  If you have a computer, but are planning to power it from the car, look out for grounding problems.

Basic Firmware Update Procedure

The basic procedure for firmware update is as follows:

  1. Connect power to the Mini-Scanner.  If you are in the car and the DLC adapter and its cable are connected normally, this is already done.  There is no need to turn the car on at this point.
  2. Connect the serial cable to the Mini-Scanner (here's how) and to a serial port (COM port) on your computer.
  3. Turn on the computer (if it isn't already on) and run the terminal emulator application.  Configure it for the serial port to which you connected the Mini-Scanner in step 2.  Set the serial port for 9600 bit/s, eight data bits, no parity and one stop bit.  Disable flow control.  (I need help after all.)
  4. Hold down the escape (Esc) key (see note), wait a second or two and, while continuing to hold down the escape key, press the On/Reset button of the Mini-Scanner.  This will get you into the Flash Loader and you will see a banner message and then a prompt (">").
  5. To erase the existing firmware in the Mini-Scanner, press 'z'.  You will see the message "erasing" and after a few seconds a new prompt.
  6. Put the Flash Loader in "program" mode by pressing 'p'.  You will see the message "prgm" and a new prompt.
  7. Using the terminal emulator application, send the new firmware file to the Mini-Scanner in plain ASCII text format.  As each record in the file is read, you will see a dot appear.  It may take several minutes to complete the update.  Do not interrupt the update by resetting the Mini-Scanner, unplugging the cable or quitting the terminal emulator application.  When it is finished, a new prompt will appear.
  8. Press 'q' to quit the Flash Loader and run the new firmware.  (If you are not in a car or the car is not turned on, the Mini-Scanner will of course not be able to communicate with it.  Either now or later, re-install the Mini-Scanner in the car or turn the car on and then press the On/Reset button to start the new firmware.)
  9. Disconnect the serial cable (if desired).

Note: In all cases of pressing or holding down a key, it is a key on the computer keyboard to which I am referring.  When I say "you will see", I mean on the computer screen.  You are basically interacting with the computer and terminal emulator program from steps 3 to 8 and need not touch or look at the Mini-Scanner except to press the On/Reset button in step 4.

Below, I will discuss advanced and expert use of the Flash Loader, problems and errors and finally the Flash Loader's principles of operation.  This is not required reading.  You can stop reading this page when you think you have the information you need and only come back if you experience problems.

Advanced Use of the Flash Loader

In addition to updating firmware, you can use the Flash Loader to verify that the firmware in the Mini-Scanner corresponds to a particular file.  This is useful to make absolutely sure that an update worked and also to find out what firmware you are running if you lose track.  Follow the basic procedure, but instead of typing "p" in step 6, type "v" for verify.  You will see the message "vrfy" and a new prompt.  When you send the file using the terminal emulator, dots should appear just as before.  If there is a difference between the file and what is in the Mini-Scanner, the message "error 4" will appear instead of a dot for each record of the file in which there is a mismatch.  To perform a verify operation immediately after a new upload, repeat steps 6 and 7 before proceeding to step 8 but in the second step 6 type "v" instead of "p" as just described.

If a firmware update is interrupted, for example by accidentally resetting the Mini-Scanner or a computer crash, it should be sufficient to simply start again.  Try to be sure to get into the Flash Loader on your first reset attempt (step 4) as otherwise you will run the part of the user program that was loaded.  There is a very, very small chance that this could be harmful to the Mini-Scanner or Flash Loader program.

Expert Use of the Flash Loader

The Flash Loader has three modes of operation, idle, program and verify.  The mode controls what happens to the data read from an input file.  A message, "idle", "prgm" or "vrfy", appears each time the prompt is issued to tell you what mode you are in.  If you hit the enter key, the prompt is repeated, including the mode message.  Other input is not echoed so nothing will happen unless you hit a valid command key.  You start in the idle mode.  Typing "p" puts you in program mode and typing "v" puts you in verify mode.  You can switch between these modes at any time.  After reading in an Intel Hex16 file and detecting the end-of-file record, the Flash Loader returns to idle mode.

If you send a file to the Flash Loader when it is in idle mode, the basic syntax of the file is checked but nothing is programmed or verified.  The safest way to check an unknown file is to upload it in idle mode.  If you get nothing but dots, the file is in Intel Hex16 format and should be safe to program into the Mini-Scanner.

You can upload and program a new file to the Mini-Scanner without erasing the existing program.  This will work if either the new program file is a strict superset of the existing one or if the two files are disjoint.  In the first case, the Flash Loader will simply ignore all the bytes in the new file that have already been programmed in the same place by a previous upload.  In the second case, all locations programmed by the second file are still in the unprogrammed state from a previous erasure.  This way of using the Flash Loader could be useful to add data to tables in the firmware in which space has been reserved for this purpose.

Problems and Errors

Flash Loader Banner and Prompt do not Appear

The Flash Loader pauses only briefly during startup to look for an escape character at the serial port.  If you see only dots in the terminal emulator, your escape is not being detected.  Look for these problems:

If sometimes you get into the Boot Loader and sometimes you don't, there is nothing wrong with trying repeatedly until you get in.

If you see nothing at all in the terminal emulator, not even dots, look for a bad serial port connection or misconfiguration of the terminal emulator.  If you have replaced the firmware in the Mini-Scanner using the debug port, you will have erased the Flash Loader and will need to put it back before you can use it.

I Don't Get Dots in Step 7

If everything seems to be working but when you send the firmware file to the Mini-Scanner in step 7 you don't get dots as each record is processed, your terminal emulator program may be supressing line feed characters.  To test this, start again.  You'll have to stop the file transfer or quit the terminal emulator program.  Once you have the terminal emulator going again, try pressing the escape key to get back to the Flash Loader prompt.  If this does not work, you will have to reset the Mini-Scanner again.  Once at the prompt, hit the Enter key several times.  If the mode announcement and prompt appear each time, see "I Still Don't Get Dots", below.  If nothing happens, the line feeds are not getting through.  Explore the settings of your terminal emulator looking for line end processing options (if you're struggling with HyperTerminal, here's how to set it up, if you've had the sense to use TeraTerm Pro, look here).  Choose line feed or both carriage return and line feed.  Carriage return on its own will not work.

I Still Don't Get Dots

If your terminal emulator is set up to pass line feeds, that is when you hit the Enter key you get the mode announcement and prompt, the next thing to check is that the Mini-Scanner is listening for Intel Hex records.  Go to verify mode and at the computer keyboard, type the following, (remember the final Enter):

After the first line, you should get a dot.  After the second line, you should be back at the idle prompt.  If this test does not work, the Mini-Scanner is probably at fault and may require repair.  If it does work, the problem is with the file you're trying to load or the terminal emulator's file send function.  Make sure you're using the right firmware file, that it has been un-zipped (the file extension should be .hex) and that the file contains lots of separate lines of numbers, some lines quite long, all starting with a colon character.

Get back the attention of the Flash Loader by starting again at step 4 or hitting Escape and Enter so that the prompt reappears.  Make sure your terminal emulator application is working properly.  If you turn on its "local echo" option, you will see the file being sent, but this will obscure the responses of the Flash Loader somewhat.  The last line of data sent from the file should look something like this: :00000001FF.

Windows NT and HyperTerminal have been reported to malfunction in the way we're now discussing.  The only known solution is to forget HyperTerminal and get a decent terminal emulator such as TeraTerm Pro.

I Get Some Dots, Then They Stop

Inspect the firmware file to make sure it's all there.  If somehow part of the file has been chopped off, the firmware update will just stop in the middle.  Look at the last line of the file in a text editor such as Notepad.  It should be the end-of-file record, which looks something like this: :00000001FF.  The 01 in the eighth and ninth positions are the end-of-file record type and must be correct although other characters may be different.  If the file is corrupt, you will need to get another one.  Another possibility is that the file send operation was terminated somehow.  If the terminal emulator program allows you to abort a transfer, did you accidentally do this?

New Program Does Not Run

If, after following the basic update procedure, you get the message "no user program!" when you type "q", the update did not take place.  Look for error messages during the file upload.  If there are only dots (no errors), the most likely cause is that you missed out step 6.

Lots of error 7 Messages

This error means that you are overwriting data that is already in the Mini-Scanner.  A possible cause is that you missed out step 5 in the update procedure.


This section explains the error messages you might see from the Flash Loader.

no user program! - The unit does not contain a user program.  Repeat the basic update procedure.

error 1 - A record in the input file contained a character that is not a hexadecimal digit.  The file is not an Intel Hex file, is not in the correct format or is corrupt.  Obtain a new firmware file.

error 2 - A record in the input file had a bad checksum.  The file is not in the correct format or is corrupt.  Obtain a new firmware file.  Note that an Intel Hex32 file is likely to cause this error.  The Flash Loader only reads Intel Hex16 files.

error 3 - A record in the input file had a bad value in the record type field.  The file is not an Intel Hex file, is not in the correct format or is corrupt.  Obtain a new firmware file.  Note that an Intel Hex32 file is likely to cause this error.  The Flash Loader only reads Intel Hex16 files.

error 4 - A mismatch was detected during a verify operation.  This error is issued for each record containing data that does not match the current Mini-Scanner firmware.  The Mini-Scanner does not contain the same firmware as the selected file.

error 5 - The microcontroller was unable to unlock its programming hardware.  Return the Mini-Scanner for repair.

error 6 - The firmware file contains data to be written to an address reserved by the Flash Loader for its own use.  It has been constructed without proper regard for the rules that allow it to work with the Flash Loader.  Obtain a new firmware file.

error 7 - Data from the firmware file cannot be programmed because it is at an address in the Mini-Scanner memory that is not empty and does not already contain that data.  If you are performing a full update of the firmware, start again and be sure to erase the old firmware first.  If this error recurs, return the Mini-Scanner for repair.

error 8 - The microcontroller failed to write the new firmware into its memory.  Return the Mini-Scanner for repair.

error 9 - The firmware file contains a program that starts at the wrong address or for some other reason is putting bad data at the reset vector.  It has been constructed without proper regard for the rules that allow it to work with the Flash Loader.  Obtain a new firmware file.

error 0A - You aborted a download by pressing the escape key.

Principles of Operation

A technical description of the Flash Loader is available that describes how it operates in some detail and how to build Z8Encore! programs that are compatible with it.

Last edited July 24, 2003.  All material Copyright  2003 Graham Davies.  No liability accepted.