Bootloader instructions for the SU 1.2 driver
Connection block diagram
This manual describes the use of the bootloader for the SU 1.2 controller, in which the central unit is the ATMEGA32 processor.
The described bootloader allows programming the ATMEGA32 processor in the SU 1.2 controller using the RS-232 serial interface.
Using any terminal program (e.g. Tera Term) and the RS-232 connector, you can send the program file in *.bin form to the controller. In this way, the bootloader program allows you to update the software in the controller without having to disassemble it.
Using the ISP or JTAG connector, program the processor with the bootloader program (bootloader12.hex file) and set the configuration bits appropriately:
- set the bootloader program initialization vector to start at address $3F00, because the bootloader program occupies the last 256 words (512 bytes) of the processor program memory (BOOTSZ1=1, BOOTSZ0=1),
- move the processor reset vector to the beginning of the bootloader program (BOOTRST=0).
The bootloader program programs the application program memory of the ATmega32 processor from address $0000 to address $3EFF (32256 bytes). The remaining part of the program memory (from address $3F00 to address $3FFF – 512 bytes) is occupied by the bootloader program. To ensure communication between the controller and the computer, connect the RS-232 ports of both devices using a 3-wire cable. All bootloader messages are displayed in the terminal program on the computer monitor.
RS-232 interface parameters to be set in the terminal program on a PC (e.g. Tera Term):
- transmission speed 4800 baud,
- 8 data bits,
- odd parity bit,
- 1 stop bit,
- no flow control.
Entering the controller programming mode using the bootloader program is done by holding down the two controller keys ESC and OK at the same time and performing one of the following actions:
- hardware reset of the controller (e.g. turning the controller power off and on),
- from the application level, execute the jump instruction to the address $3F00.
Detailed instructions for using the bootloader program:
STEP 1: After entering the bootloader program, the controller will send a query: Program flash?
STEP 2: At this point, confirm or cancel the programming of the processor memory:
To cancel memory programming, press the controller’s ESC key. The controller will send the message: Exit. Then the bootloader program will execute instructions to jump to the address $0000 in program memory.
To confirm memory programming, press the controller’s UP and DOWN keys simultaneously. The controller will send the message: Send *.bin file… The controller will wait for the program file to be sent.
STEP 3: Run the procedure for sending an ASCII file from the terminal program and send the application program file in *.bin format (binary form). The program file in *.bin format, regardless of the size of the application, should always have a volume of 32768 bytes. When transmitting the program file, the controller sends back a progress bar: 1 █ character sent equals 128 bytes received. If a transmission error occurs during programming, the controller will send the message Transmission error! and the bootloader program will be stopped.
STEP 4: After programming the program memory, the controller will send the message Verification, resend the *.bin file… The controller will wait for the application program file to be resent, which will allow verification of the programmed program memory. When retransmitting the program file, the controller sends back a progress bar: 1 character sent ▒ equals 128 bytes received. If during verification there is an inconsistency between the application program memory and the contents of the program file, the controller will send the message Verification error! and the boolader program will go to step 1 of this manual.
STEP 5: If the program memory verification is successful, the controller will send a Success message and execute the program memory jump instruction to address $0000.