Bootloader update

From FlySight
Jump to: navigation, search

Background

The "bootloader" is the part of FlySight's code which is responsible for handling firmware update.

The processor used in the FlySight comes with a bootloader installed, but this bootloader incorrectly identifies the device as a "USB 20.0" device instead of a "USB 2.00" device. Windows XP/7 and Mac overlook this small error, but Windows 8/10 will not connect to the FlySight in "firmware update" mode because of it.

FlySights with serial number 1-2488 use the original bootloader. Since FlySight serial number 2489, we update the bootloader before shipping so this issue is not present.

Equipment

To update FlySight's bootloader, you will need a hardware programmer and interface board, shown here:

Bootloader Equipment.JPG

There are many different hardware programmers available, but for this document we will use the USBasp programmer, which is described here:

https://www.fischl.de/usbasp/

The USBasp programmer is also widely available on eBay for about $2 including shipping:

https://www.ebay.ca/sch/i.html?_nkw=usbasp

In addition to the USBasp programmer, you will need an interface board which fits into the FlySight's microSD card holder. This is available from FlySight.

Procedure

To operate the hardware programmer, the first thing you'll want to do is to download and install WinAVR:

http://sourceforge.net/projects/winavr/

On the USBasp, there is a small "jumper" which selects between 5 V and 3.3 V. It's right next to the cable connector. Make sure the jumper goes between the middle pin and the 3.3 V pin. This selects the voltage that will be supplied to the board. Since the FlySight works on 3.3 V, it could be damaged if we applied 5 V to it. The jumper is shown in the following photo, with the orange rectangle in the correct position:

Bootloader Voltage Jumper.jpg

You should also have a small adapter board labeled "FlySight Programmer v1.2". You can plug the adapter board into the end of the USBasp's cable as shown in this photo:

Booloader Assembled.JPG

Once you've got WinAVR installed, you can plug the USBasp into your computer. You'll need to install a driver for the USBasp. First, download and install the Zadig USB driver installer, which can be found here:

http://zadig.akeo.ie/

Check that the USBasp is plugged in then run the Zadig software. In the Options menu, select "List All Devices". You should see the USBasp listed in the drop-down box as shown here:

Zadig USBasp.png

Select "USBasp" from the list. Check the "Driver" box below. This shows the driver currently installed for your USBasp. If the WinUSB driver is installed, then use Zadig to change it to libusb-win32 by selecting "libusb-win32" from the box to the right, as shown here:

Zadig USBasp libusb.png

Then click the "Replace Driver" button to install the libusb-win32 driver. The box on the left should change to show "libusb-win32". Close the Zadig USB driver installer.

Next, then follow these steps:

  1. Open up the FlySight's case and remove the printed circuit board (PCB).
  2. Remove the sticker on the microSD card and then remove the microSD card itself.
  3. Check that the FlySight is turned off (switch in the outward position).
  4. The FlySight Programmer board has one end that looks like a microSD card. Plug this into the microSD slot with the metal contacts facing toward the FlySight PCB.

Looking at the FlySight PCB, you will see a large module with a white label that says "NEO-something" on it. Holding the board so that you can read the label, to the left of that module you should see a button labeled S2 and below that a black resistor (small rectangular component) labeled R1. R1 is soldered to the board on the left and right sides, which is where it has a metallic colour. The left side of R1 is what I'm going to call RESET. In the image below, this is indicated by an orange arrow:

Bootloader RESET.jpg

Let's see if the USBasp will talk to the FlySight. With the FlySight Programmer plugged into the microSD slot, follow these steps:

  1. Go to a command line in Windows. To do this, I usually hit the Start button and then type "cmd" in the search box.
  2. At the command line, type "avrdude". You should see a description of how to use the avrdude utility. Let me know if the system doesn’t find avrdude at all.
  3. At the command line, type "avrdude -c usbasp -p at90usb646", but don't press enter just yet.
  4. On the FlySight Programmer, there is a small pin attached to the end of a short wire. Hold the tip of the pin against the left side of R1 (RESET), as shown below, while you press enter on the command line. Hold the tip to RESET until the command is complete.
Bootloader Holding.JPG

You should get a result like this:

   avrdude: warning: cannot set sck period. please check for usbasp firmware update.
   avrdude: AVR device initialized and ready to accept instructions
   Reading | ################################################## | 100% 0.02s
   avrdude: Device signature = 0x1e9682
   avrdude: safemode: Fuses OK
   avrdude done.  Thank you.

FlySights with serial number 98 through 497 (manufactured in 2010-2011) used the AT90USB1287 chip instead of the AT90USB646. If you're updating one of those units, you'll need to modify the command slightly:

   avrdude -c usbasp -p at90usb1287

You will have to hold the pin against the left side of R1 throughout this process. If the pin comes loose momentarily, you might get an error message. If this happens, try running the "avrdude" command again, but hold the tip of the pin against R1 with a little more pressure until the command is complete.

Now that we know the USBasp can talk to the FlySight, the final thing we want to do is to update the bootloader. You can find links to download two bootloader files below--one for units using the AT90USB646 (bl_usb_64k.a90) and the other for units using the AT90USB1287 (bl_usb_128k.a90).

AT90USB646 bl_usb_64k.a90
AT90USB1287 bl_usb_128k.a90

Download the appropriate bootloader file by right-clicking the link above and choosing "Save link as..." from the menu. Then copy it to a place you can easily access them from the command line. The desktop is pretty easy, so I'll use that. Then go to the command line window again and do the following:

Change to the desktop folder. On my system, I do that with cd Desktop. At the command line, type avrdude -c usbasp -p at90usb646 -U flash:w:bl_usb_64k.a90, but don't press enter. If you're working with the AT90USB1287, you'll want to use avrdude -c usbasp -p at90usb1287 -U flash:w:bl_usb_128k.a90 instead. Hold the tip of the FlySight Programmer's pin to the left side of R1 (RESET) while you press enter on the command line. Hold the tip to RESET until the command is complete.

The output should look like this:

   avrdude: warning: cannot set sck period. please check for usbasp firmware update.
   avrdude: AVR device initialized and ready to accept instructions
   
   Reading | ################################################## | 100% 0.03s
   
   avrdude: Device signature = 0x1e9682 (probably usb647)
   avrdude: NOTE: "flash" memory has been specified, an erase cycle will be performed
   		 To disable this feature, specify the -D option.
   avrdude: erasing chip
   avrdude: warning: cannot set sck period. please check for usbasp firmware update.
   avrdude: reading input file "bl_usb_64k.a90"
   avrdude: input file bl_usb_64k.a90 auto detected as Intel Hex
   avrdude: writing flash (65536 bytes):
   
   Writing | ################################################## | 100% 0.29s
   
   avrdude: 65536 bytes of flash written
   avrdude: verifying flash memory against bl_usb_64k.a90:
   avrdude: load data flash data from input file bl_usb_64k.a90:
   avrdude: input file bl_usb_64k.a90 auto detected as Intel Hex
   avrdude: input file bl_usb_64k.a90 contains 65536 bytes
   avrdude: reading on-chip flash data:
   
   Reading | ################################################## | 100% 0.28s
   
   avrdude: verifying ...
   avrdude: 65536 bytes of flash verified
   
   avrdude: safemode: Fuses OK (E:F3, H:9B, L:5E)
   
   avrdude done.  Thank you.

If you've gotten this far, then the bootloader on your FlySight is updated. The firmware has been erased in the process, but you can now update the firmware on a Windows 8/10 machine using the steps here:

http://flysight.ca/wiki/index.php/New_firmware_update_(Windows)

You should only have to update the bootloader once to make your FlySight Windows 8/10 compatible. For future firmware updates, you can simply follow the usual instructions.