New January 12, 2001 - Tutorials are moving
All the tutorials are now at http://www.systronix.com/tutor/top.htm
(These old pages will be left for a while until all the new tutorials are complete)

Restoring an erased TINI
(Applies to Beta 2.2, details with 3.0 will be slightly different)


Disclaimer:
This tutorial is here as a service to our customers. These tutorials deal with complex issues and products which change frequently. We are only human (and hopefully humane too). There are almost certainly typographical or other errors here, as in any published text. These pages and the data therein are provided as a free service with no warranty that they are error-free or will be suitable for your needs. We will do our best to be accurate and correct but in no case is Systronix responsible for incidental or consequential damages which may result from any inadvertent errors. Please report suspected errors or typos to us via email.


Caution: accidental erasures of TINI's boot bank are very rare.
This may not be your problem.

Caution: don't assume the boot bank is erased just because your new or old TINI doesn't appear to work. It is VERY difficult to erase the boot bank by accident. The only way I'm aware of is to have TINI not in a proper socket board, and have CE0 and RCE0 not properly connected, and then power it up and down while TINI is running.

If TINI is in a proper socket board it is virtually impossible to accidentally erase flash bank 0.

Don't follow the instructions here unless you are certain you really need to. This process must be followed precisely or you could wind up accidentally erasing a good TINI.

I'll say it again - this is a "user beware" procedure and should not be attempted unless you are sure you know what you are doing. If you make a mistake you could erase the boot loader in a good TINI. If you accidentally erase TINI's boot loader and you have only one TINI, and do not have the special equipment and chips mentioned here, you will really be stuck. Systronix is not set up to restore your TINI, test it, etc.


Assuming you really DO have a TINI with an erased boot bank:

This means you have managed to erase TINI's boot loader in flash bank 0. Now TINI can't even start up. Don't panic. I managed to do this and recover. It does take some special effort.

It doesn't matter if there is other code in the TINI -- if the boot sector code is damaged or missing, it can't start.

(Special thanks to Jeff Owens for walking me through this the first time.)


What you need to restore a completely erased TINI

  1. First of all, you need an undamaged TINI. The serial port must work, and there must be no other damage to the processor, memory, and so forth. This process won't fix a TINI which has been run over by a truck, or damaged or destroyed by a lightning strike.
  2. You need a sockets board with an external boot device. The Systronix STEP and STEP+ are such boards with a socket for AMD or Atmel 29F or Atmel 49F family flash in a PLCC32 package. The Dallas Socket Plus board has pads for a 29F series flash device, but it must be soldered on. These detailed instructions do not apply to the Socket Plus board, although the general philosophy does. The 29F and 49F families are not programming-compatible. If you use a hard-to-obtain 29F device, then TINI can clone its own boot loader into the external flash. If you use a readily available 49F part, TINI cannot clone it and you need a device programmer to get a good copy of the loader into the flash part. Obviously, you must do this while you have at least one operating TINI with a good copy of a boot loader in it, or a friend who can email you a hex dump of his loader, or you can get it from this web site here.
  3. You need a way to load good loader code in the external flash device. This can be accomplished with either a known good TINI with an intact loader, a copy of the loader HEX file and a device which can program a flash chip, or a pre-programmed flash chip. More on these options in a moment.
  4. You need a little tool to help get a PLCC32 chip out of its socket. These are available at many electronics part stores.


What is the TINI Boot Loader?

TINI's boot loader resides in flash bank 0. It's the lowest-level code of TINI, has almost nothing to do with Java, and gives TINI enough smarts to start up and accept HEX files. If the boot loader is erased, TINI is like a newborn infant. Cute, but not very useful. Like an infant, it will need some care and feeding to become more interesting.

Fortunately, the programmers at Dallas considered this and provided firmware help. Dallas also provides a reference hardware design.

The Systronix STEP and STEP+ include an external boot flash socket and a jumper to enable it.

We copied the design and logic provided by Dallas, and made a couple of changes. At the time we designed the STEP board, some flash components were on allocation with 52 week lead times. We picked a flash device which was not on allocation - the Atmel AT49F010 or 040. You will need a 55 nsec version. Either one will fit in the socket, and since the loader occupies only a small portion of the device, either one has far more memory than needed in this case.

You can also use a 29F040 or 29F010 55 nsec part. In this case TINI can clone itself into the flash part with the 'm' command, described later.

We also put our boot flash device in a socket so that you can easily change it, swap devices with others, or program it in an external device programmer.

 


How the boot loader boots, and loader source code and HEX file

For the really curious, boot loader source code is available, along with some documentation.

The boot loader is located in flash bank 0 starting at address 0. All 8051s (including the 80C390 used in TINI) must start execution at location 0, the so-called "boot vector". Typically the instruction located here is a jump over the interrupt vector table which is also in low memory, starting at 03H.

Soon after the loader boots up, it copies itself into the internal RAM of the C390 and executes out of there. A reset or power cycle will wipe out this internal code and cause the controller to again execute at the boot vector in low memory.

The easiest way to get a copy of the loader HEX code is with a dump from a known good TINI. If you don't have a good TINI, here's a copy of the loader HEX code for loader version 082499, which works through TINI Beta 2.2, but may not be suitable for later versions.


More about 29F and 49F flash parts

TINI's loader exists in a 29F flash device. If we had designed the STEP board to use a 29F part in a socket, it would be easy to erase and clone TINI's loader without any other tools, since the TINI loader knows how to access 29F devices. 29F and 49F devices use a different algorithm for erasure and programming. 29F and 49F PLCC devices are pin-compatible.


How to get a copy of the TINI loader into the external flash device

As mentioned above, there are several options. Here's how to use each of them.We assume you are using a Systronix STEP board.

You have a known good TINI with intact loader and you are using a 49F flash device.

In this case you are going to 'clone' TINI's loader into an external flash device.

Remove the external flash enable jumper. Connect a PC with almost any serial communication program to STEP COM0, at 115200 baud, 8/N/1. Apply power and send TINI a carriage return to enter the boot loader in TINI. You must send TINI a carriage return (enter key) within a couple of seconds after a reset or it will continue out of the boot loader and run whatever application (such as slush) it contains. Also the loader needs the carriage return in order to autobaud.

Set your communications program to capture to a file. At the loader prompt type

B0

D 0 FFF

This will dump the loader to your screen and also to your capture file. Close the file capture, and save the file, calling it something like "loader.hex". Open the file in a simple ascii text editor such as notepad. Delete the "D 0 FFF" at the top of the file. All you want is clean ascii text of the HEX file, no word wrap, no fonts or other word processing stuff. The lines in the hex file should look something like this:

:1000000002009002010003000000000201000B004A
:1000100000000002010013000000000201001B00AC
:1000200000000002010023000000000201002B007C
:1000300000000002010033000000000201003B004C
:1000400000000002010043000000000201004B001C
:1000500000000002010053000000000201005B00EC
:100060000000000201006B000000000201006B00B4
:1000700000000002010073000000000201007B008C
:10008000000000FFFFFFFFFFFFFFFFFFFFFFFFFF7D
:10009000C2AFC2B575815075985A75C05AD2DF7516

{ lots of other hex lines}

:100FC000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF31
:100FD000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF21
:100FE000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF11
:100FF000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF01
:00000001FF

The FFs at the end are blank flash locations. The loader has to fit in the 4 KByte internal memory of TINI, and the range we dumped (0 to FFF hexadecimal) is 4095 decimal.

Now program the hex file you saved into an Atmel AT49F010 or 040 device, 55 nsec or faster, PLCC32 package. You'll need a device programmer capable of doing this.

Power off STEP. Insert the programmed device into the external flash socket on STEP. Install the external flash enable jumper on STEP. Now TINI can access external flash. Apply power and you should see the loader prompt, only this time it's coming from the external boot device.

Check that the code in bank zero looks OK. Type
B0
D 0 FF
to dump bank 0 locations 0 through FF. You should see something like this, the same code that was in the HEX file you captured. Notice the first eight lines of the file have a lot of zeros and sections of code such as "02 010003". This is an LJMP to location 010003. This is a 24-bit flat memory mode instruction, since the address is three bytes. These addresses ending in 03, 0B, 13, 1B, 23, 2B, etc are the interrupt vector table. Here it consists of jumps to routines located in a similar table starting at memory location 010000.
 
As an aside, the boot vector is "02 0090", a jump to address 90H. This is a 16-bit address since after reset the C390 controller is not in 24-bit flat address mode and the three bytes of code available in the reset vector aren't enough to set that mode and jump somewhere.
 
 
Continue on to the next section about restoring a TINI with erased boot sector.

You have a known good TINI with intact loader and you are using a 29F flash device.

In this case you are going to 'clone' TINI's loader into an external flash device, using the flash algorithms in TINI itself. I have not done this myself (but intend to soon, as soon as we can get some 29F parts).

Remove power from STEP. Insert a 55 nsec 29F040 or 29F010 PLCC32 flash device into the external flash socket of STEP. Remove the external flash enable jumper. Connect a PC with almost any serial communication program to STEP COM0, at 115200 baud, 8/N/1. Apply power and send TINI a carriage return to enter the boot loader in TINI. You must send TINI a carriage return (enter key) within a couple of seconds after a reset or it will continue out of the boot loader and run whatever application (such as slush) it contains. Also the loader needs the carriage return in order to autobaud. Now TINI has booted and is running out of the C390's internal RAM. Don't remove power or reset TINI until the following procedure is completed - ( if this happens just start at the top of this section and reboot from TINI's on-board flash.)

Install the external flash enable jumper. Now the loader running in TINI's internal RAM can access the external flash device.

Type these commands to unlock the boot sector and clone a copy of the TINI boot loader into the external device flash sector 0:


B0
T3
You sure? Y
Z0
You sure? Y
M

'B0' sets the bank to 0, 'T3' unlocks it, 'Z0' erases it, then 'M' copies the loader from the 80C390 internal memory into the external flash device's sector 0.

That's it. Now with the external flash enable jumper installed, you can reset TINI and it will boot up the code in the external flash device.

You have a flash chip, external programmer, and a copy of the loader HEX file.
 
In this case you program the flash chip with the loader hex file, then plug it into the flash socket.
a pre-programmed flash chip with the TINI boot loader. You can make one of these ahead of time and store it, or get one from a friend who can use one of the two methods above. You can get a copy of the loader HEX code for loader version 082499 by clicking the hyperlink.

You have a pre-programmed flash chip with the TINI boot loader.
 
You can make one of these ahead of time and store it, or get one from a friend who can use one of the two methods above.

 


Restoring an erased TINI in a STEP board

Remove power from STEP. Install the "Ext Flash Enable" jumper. Install an 29F or 49F010 (128 KBytes) or 040 (512 KBytes) in the PLCC32 socket location U1. We are assuming this device contains a copy of the TINI loader, as created above.

If you are using Hyperterminal or other communications program which does not allow DTR control, remove the "DTR Reset Enable" jumper. Connect a program such as JavaKit or Hyperterminal to STEP COM0 (Primary RS232). Set up communications for 115200, 8/N/1. Plug in the STEP power cube. Hit the enter key. You should see the Dallas loader prompt, something like:


TINI loader 08-24-99 09:34 Copyright (C) 1999 Dallas Semiconductor. All rights reserved.

Now you can restore the boot loader on the TINI module. Do not cause TINI to reset or cycle the STEP power until this process is complete! When the TINI loader boots up, it loads itself into the internal memory of the DS80C390. So now, with the STEP board still powered, remove the "Ext Flash Enable" jumper. This disables the external flash device and instead maps TINI's o board flash into low memory (but TINI is still executing out of internal RAM). Hit the enter key and you should still see a TINI loader prompt. If you are curious, you can type


B0
D 0 FF


to see what is in the TINI loader boot sector (see the explanation above).

Type these commands to unlock the boot sector and install a fresh copy of the TINI boot loader into the TINI flash sector 0:


B0
T3
You sure? Y
Z0
You sure? Y
M

'B0' sets the bank to 0, 'T3' unlocks it, 'Z0' erases it, then 'M' copies the loader from the 80C390 internal memory into TINI's flash sector 0.


Now press the reset button on STEP, press the enter key, and TINI should boot out of it's newly restored internal loader. You should see the same loader prompt you saw when booting out of external flash. The external flash enable jumper is off, so you are executing out of TINI's restored boot loader!


 

End of Section

Quick Start Home