Skip to content

tjrov/bootloader

Repository files navigation

bootloader

This is the bootloader for uploading firmware to the ROV over its RS-485 based tether.

Credit goes to jgillick's avr-multidrop-bootloader, which we reverse-engineered and modified for our purposes.

Bootloader Installation

To install the bootloader, connect the ROV computer to the surface computer using an ISP programmer. In the "ROV" directory run

make clean

make

make program

This will compile and upload the bootloader code to the ROV. You should see the status LED of the ROV blink 5x and then stop.

Uploading Code Using the Bootloader

Compile the ROV firmware and note the location of the resulting binary (.hex file). You could use the test_program, which blinks the ROV status LED, for example.

Compile the Uploader code (written in Java) with javac -cp ".:./jars/jSerialComm-1.3.11.jar" Uploader.java

To run the Uploader, do java -cp ".:./jars/jSerialComm-1.3.11.jar" Uploader

When prompted, provide the path to the hex file. When prompted, select /dev/ttyAMA0, the Raspberry Pi TTL Serial Port on its GPIO pins.

The code should upload, and when it finishes, the ROV computer will restart. This time, the onboard status LED will blink only twice, and the program will start immediately without first running the bootloader. You can power cycle the ROV computer, and the program will still run. If you are using the test_program code, the LED will blink one second on, one second off. To upload new code, you need to send 0xFF 0xFF 0xF5 0x00 0x00 0x00. For example, you can use the command printf "\xFF\xFF\xF5\x00\x00\x00" > /dev/ttyAMA0.

How the bootloader works

  1. When the ROV starts up, the bootloader runs. If the first EEPROM index (0x00) is set to the value 0x01, the bootloader runs the main firmware.

  2. Otherwise, the ROV waits for new firmware.

  3. After firmware is installed, the ROV sets EEPROM index 0x00 to 0x01 and resets (go to step 1).

What your code must do

  1. When your code starts, it should set EEPROM index 0x00 to the value 0x01 to stop us from having to run the bootloader again.

  2. Now do whatever the program should do. This includes receiving and processing any serial data and sending new data.

  3. Upon receiving a command you choose, change the value in EEPROM index 0x00 to anything except 0x01 (e.g. 0x42 :D).

  4. Reset the ROV computer in software and the bootloader will run this time.

Bootloader LED Blink Codes

The bootloader uses the pin 13 LED (the blue one on the main computer board) to show important status info.

Remember that the bootloader always runs when the ROV powers up. At this time, it will decide either to run the main program or stay in the bootloader and wait for code to be uploaded. If the bootloader is passing on to the main program, it will blink TWICE. If it will stay in the bootloader, it will blink FIVE TIMES (FICE? idk).

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published