NEC 78KOS MCU Programmer



Sp78f.gif 78K0S_dongle.jpg Screenshot.png

This is a programmer for NEC 78KOS KY1+ MCU's. It can program the following chips:-

  • µPD78F9210 (1k Flash)
  • µPD78F9211 (2k Flash)
  • µPD78F9212 (4k Flash)
The circuit uses only standard electronic parts which are readily available, and sensible substitutions should work fine. It can be connected directly to your PC's RS232 serial port (if it has one) or via a USB to Serial adapter.

Power is supplied to the programmer externally. This permits in-circuit programming. For example, when reprogramming the Turnigy Servo Reverser I supplied it with power from a 4.8V battery through the servo lead. This is dropped down to 3.3V via the reverser's onboard regulator, which powers both the MCU and the programmer.

How It Works

Transistors T1~T3 convert RS232 serial port voltages to TTL. Serial port signals are used as follows:-

RTS OFF: Resets the target MCU

RTS ON: Releases RESET and activates the 8MHz oscillator

DTR ON: Forces MCU clock high

DTR OFF: Forces MCU clock low (when RESET is active) or sends 8MHz clock to the MCU

TD: Sends serial data to the MCU

RD: Receives serial data from the MCU

Software

The application runs on Windows XP and above. It was written in C and compiled with MinGW32 GCC V3.4.2 under Code::Blocks.

Operation

After starting the application, connect the programmer to the serial port and target MCU. Now choose the serial port from the 'Interface' dropdown list, and click the 'Test' button to check the connection to the MCU. During the test you will be asked to turn target power on and off, to ensure that the MCU remains synchronized to the serial port. Assuming this test passes, you should then be able to perform any of the following operations:-

Menu

  • Load:- load an Intel Hex file into the write buffer. Hex data is displayed on screen for reference (not editable!).
  • Quit:- end the application. (also 'Quit' button and close window button)

Buttons

  • Check:- inspect each Flash ROM block to see whether it is blank (erased). Click on a block to show the erasure status of each byte in it.
  • Erase:- erase selected blocks, or the entire chip.
  • Write:- program Hex data from the write buffer into selected blocks or the entire chip.
Note: Bits in Flash ROM can only be programmed from '1' to '0', and the only way to get a '0' back to '1' is by erasing the whole block. Adjacent bits in a previously programmed Byte may be also be dragged down by other '0' bits written to it, so a non-blank Byte can only reliably be overwritten with '00'.

To speed up programming of partially blank data, 78K0Sprog skips over leading and trailing 'FF' Bytes in the write data for each block ('FF's embedded in non-blank areas are not skipped, since that would slow it down). Therefore it is possible to write to a blank area of a previously programmed block by simply ensuring that the rest of the data (before and after it) is set to 'FF'. Using the same technique it is also possible overwrite any Byte with '00', without disturbing other locations in the block.This may be useful for appending data or modifying code in a chip which has already been programmed.
Optional Components

I added LEDs on Vdd and TXD, RXD and DTR lines, so I could see what the programmer was doing. No project is complete without blinking LEDs! 

The programmer can also be used as an RS232 to TTL serial interface. To support full duplex operation I added a jumper which splits the TX and RX signals, and an extra header row that the target can be plugged into to access the serial port when running. 

Frequently Asked Questions

Q: Why doesn't your programmer have a 'Read Flash' function?
A: It is not possible to read 78K0S Flash with a programmer. This is a security feature built into the chip, designed to prevent IP theft.

Q: I am a thief. How can I rip the firmware out of these chips using your programmer?
A: You can't. Go away!

Q: OK, I'm not really a thief. I just want to look at the code for 'educational purposes'.
A: You are either a liar, or a liar and a thief - the answer is still the same.

[home] [electronics]