Power UP

Oh, well the board is there. Lets do something with it. First let me explain the board connectors:

I have the "Power connector", to which I supply regulated 5V using a simple 7805 voltage regulator and a wall-wart adapter. The only other thing you will need is an RS232 cable to connect the board's serial port with your favorite PC. Note that the board supplies only transmit and receive signals, so there is no hardware flow control. As a matter of fact there is no flow control at all.

Here is how to set the jumpers to select the "Boot mode" so the MCU will start its internal boot ROM. Note that this may erase the EEPROM if the security feature has been enabled on the part you are working with. If you have pre programmed part and wish to keep the original programming, stop right now and get a new part.

After you hook the power if you have an oscilloscope, you can check the oscillator, by checking the signal on the resistor pins next to the quartz crystal. You should be able to see the oscillator working at the crystal frequency, if not your MCU will most likely not work at all.

Quick smoke test:

If you do not have an oscilloscope do not despair. Simply hook the rs232 connector (with the power off of course) to the PC and start Hyper Terminal (1). Open a new connection and specify "Direct to COMx", speed 1200 bps, 8 bit connection 1 stop bit, no parity.

Hit any symbol ("~" 0x7E will work). Then the MCU should echo whatever you type (up to 256 symbols). Your mileage may vary, depending of the MCU revision, some Boot ROM implementations have a build-in timeout, so they stop receiving characters if you don't send fast enough.

This is what happens under the hood

When you start the MCU in "boot mode" (here is a link to Motorola's AppNote), the part first sets the serial communication speed to 7812 bps (quite odd number I agree). Then the MCU waits until it receives the first byte from the serial port. Then it compares the received byte with 0xFF, if it is not 0xFF, then the MCU assumes the communication is 1200 bps, so it reconfigures the serial interface for 1200 bps. If the received byte is 0xFF then the communication continues on 7812 bps.

The MCU it starts receiving bytes and echoes the received byte back storing it in the page0 (addresses 0 to 255) until the page is full or depending of the ROM revision a timeout occurs. Then the MCU starts executing the program it just received starting from address 0.

Why our smoke test works?

Well since we send a byte which is not 0xFF, the MCU will switch to 1200bps speed. Then it will start receiving bytes and echo them back, so we see what we type on the terminal screen.

What happen to the program which is executed?

Well, it does get executed eventually, but no harm can be done. Most likely the MCU will see some invalid code and block. The worst that could happen is that you may accidentally destroy some of the EEPROM content. As I stated earlier you if you care about it find a part on which you can experiment.

Enough fooling around. Let's write a program.

Note:

  1. I'm primary using Windows 98 for all the projects in this web site. If you are using Linux, you are experienced enough to know that to do to make the analog steps there :)

Go Back