SSC-32 Open-Source Information: Description of Bootloader Operation

 

The SSC-32 Boot Loader occupies the last 256 bytes of the 8192 bytes of Flash program memory in the AVR ATMega8 processor. The boot loader allows the SSC-32 firmware to be updated using an RS-232 connection to a PC, without the use of a special programmer. It can change the program data at any address within the SSC-32, with one exception: the boot loader cannot erase or modify itself. Therefore it is not possible to inadvertently corrupt the boot loader while attempting to update the SSC-32 firmware.

The boot loader operates at 115.2 kBaud, 8 data bits, 1 stop bit, no parity. It can be started in two ways:

* If SSC-32 firmware is currently running, send the command "GOBOOT" followed by a carriage return.
* Power up the SSC-32 board with a jumper installed across the Baud pins. This method works regardless of what firmware is installed.

Once the boot loader is running, it responds to the following commands:

* "rAAAA<CR>" -- read a page starting at address "AAAA"
* "eAAAA<CR>" -- erase the page containing address "AAAA"
* "wAAAA<CR>DDDD...DDDD<CR>" -- write the page starting at "AAAA" with data "DDDD...DDDD" (total 128 characters of data)
* "gAAAA<CR>" -- goto address "AAAA"

In the command descriptions, "AAAA" is a 4-character hexadecimal address, "DDDD...DDDD" is 128-characters of hexadecimal data, an "<CR>" is a carriage return character (ASCII 13). A line feed character may be sent with the carriage return, but it is not required.

Each of the boot loader commands consists of a single lower-case character ('r', 'e', 'w', or 'g') followed by a 4-character hexadecimal address, followed by a carriage return. The address must use decimal digits and the upper case characters 'A' - 'F'. It must have exactly 4 digits, so leading 0's are required if the number is less than 1000 hex. At the end of every command, the boot loader will send a '.' character, indicating that it is ready for the next command.

The boot loader operates on 64-byte pages of data. The read command 'r' will return 64 bytes, or 128 hexadecimal characters, starting at the address given, followed by a '.' character. The 'e' command will erase a 64-byte page, and send a '.' command when the erase is complete. The 'w' command will write 64 bytes of data specified by the 128 hexadecimal characters "DDDD...DDDD", and send a '.' character when the write is complete.

The 'g' command can be used to start the firmware application after loading. The firmware always starts at address 0000, so the command to start the firmware is "g0000<CR>"

If the 'g' command is used to start the firmware, the Baud rate will change from 115.2 kBaud to whatever is selected by the Baud select pins. If the Baud select pins are jumpered together, the Baud rate will remain at 115.2 kBaud.

Erase and Write commands ('e' and 'w') require several milliseconds to complete. If a program is used to send the commands, it must not send the next command until the previous command has completed. It can use any of the following methods to meet this requirement:

* After sending an 'e' or 'w' command, wait for the boot loader to reply with a '.' character before sending the next command.
* After sending an 'e' or 'w' command, wait for at least 5 milliseconds before sending the next command.
* After sending an 'e' or 'w' command, send 60 '.' characters before sending the next command (60 characters at 115.2 kBaud require 5.2 milliseconds to transmit).