Quantcast
Channel: Dangerous Prototypes » PIC programmer
Viewing all articles
Browse latest Browse all 10

Open Logic Sniffer bootloader rescue

$
0
0

Some Logic Sniffers shipped without a bootloader, and will require a firmware flash before USB upgrades are possible. This post describes how to program the OLS bootloader using a Bus Pirate. It’s also possible to program the bootloader with a PIC programmer like a PICkit or ICD2. If you don’t have a Bus Pirate or a PIC programmer, we’ve arranged repair centers worldwide to reflash the Logic Sniffer, please contact us for the address nearest you. Update: Seeed Studio has also offered to reprogram your OLS.

The bootloader rescue package also includes the latest version of the bitstream (2.04) for the FPGA and the firmware (v05/06) for the PIC. The update implements an SPI connection between the PIC and the FPGA that eliminates the most prevalent reliability issue in the first release. The updates are still beta, but there will be a final version soon. This update will require a firmware upgrade using the bootloader, so now is a good time to check if your bootloader is present and reprogram it if needed.

Stuff you’ll need:

Process overview:

  1. Check if the bootloader is present using pump-loader
  2. Update the Bus Pirate firmware if needed
  3. Connect the Bus Pirate to the Logic Sniffer
  4. Program the bootloader into the Logic Sniffer PIC chip with the Bus Pirate
  5. Load a new firmware into the Logic Sniffer PIC with the USB bootloader
  6. Load a new bitstream into the Logic Sniffer ROM with pump-loader

1. Check if your OLS has a bootloader

In this step we’ll check the OLS to see if the bootloader is present, or if it’s one of the unlucky ones that shipped without a bootloader.

  • Connect the Logic Sniffer to a USB port.
  • Hold the update button down and press the reset button once. The ACT LED will light and the OLS will enumerate as a USB virtual serial port.
C:\pump>pump-loader -p:COM4 -status
PUMP loader
Opening serial port 'COM4' @ 921600 ... OK
Found PUMP HW: 1, FW: 0.1, Boot: 1
Found flash: ATMEL AT45DB041D
no input file specified !

C:\pump>
  • Run pump-loader (\Bitstream-2.04update\pump-loader.exe) with the -status option. Specify the OLS serial port (-p:) for your system. Pump-loader will connect to the OLS and read the OLS hardware/firmware/bootloader version numbers, and verify the ROM flash chip ID.
  • If it shows ‘Boot:1′, STOP, the bootloader is present you do not need to reprogram it.
Found PUMP HW: 1, FW: 0.1, Boot: 255
  • If the pump-loader reports ‘Boot: 255′, then there is no bootloader present. Please continue to step 2.

2. Update the Bus Pirate if needed

The programmer application uses a new command available only in the most recent Bus Pirate firmware, firmware v4.5 is required. Don’t forget to upgrade to the Bus Pirate v4 bootloader first if you’re still using the v2 bootloader (P24QP).

3. Connect the Bus Pirate to the OLS

In this step we’ll connect the 4 or 5 wires from the Bus Pirate to the OLS that will be used to write the new bootloader into the PIC. These wires attache to the ICSP header.

The OLS must be powered during programming. There’s two ways to do that: connect a USB cable to the OLS during programming, or power the OLS from the Bus Pirate 3.3volt supply. Do not connect both.

BP –> OLS
MOSI –> PGD
CLK –> PGC
CS –> VPP
GND –> GND
3.3volts->3V3 (optional)

  • Connect the Bus Pirate to the OLS as shown in the table and diagram. Table and diagram by IPenguin.
  • Power the OLS from a USB cable OR the Bus Pirate 3.3volt supply.

4. Program the bootloader into OLS

In this step we’ll write the bootloader code into the OLS PIC chip using a Bus Pirate. The Bus Pirate PIC programmer is a Windows/.NET application that should also run on Linux/Mono.

  • Start Bus Pirate PIC programmer application (\BusPirateProgrammer\executable\Bus Pirate PIC Programmer.exe).
  • Choose the Bus Pirate serial port and press the connect button to initialize the Bus Pirate.

  • Press the ‘Read Device ID’ button.
  • The programmer should report ‘Found PIC18F24J50 Device ID: 0x4c00′. If it reports an invalid device, check the wiring between the Bus Pirate and the OLS, and make sure the OLS is powered by the USB cable or the Bus Pirate 3.3volt power supply.
  • Press the ‘…’ button and select the OLS bootloader (\BusPirateProgrammer\OLSv1-bootloader-v1-20MHz.hex).

  • Press the ‘Program’ button. The programmer will erase the PIC and then program the bootloader. Sit back and relax, this will take a few minutes
  • Once complete, remove the connection between the Bus Pirate and the OLS.

5. Load new firmware with bootloader

Now the PIC has a bootloader, but no main firmware. We will install a new firmware in the OLS PIC using the bootloader.

We used a custom compile of the Diolan bootloader utility that is only available for Windows (64bit Linux test version here), this step currently requires a Windows PC until someone compiles the bootloader utility for other platforms. Use only our custom from the update package with the OLS, do not use the unmodified utilities from Diolan.

  • Enter the bootloader with a jumper – Place a jumper between the PGC and PGD pins and then press the reset button. The ACT LED will light and the OLS will enumerate as a USB HID device (no driver needed). With out a jumper the OLS will not enter the bootloader.
 C:\firmware>fw_update -e -w -vid 0x04D8 -pid 0xFC90 -ix OLSv1-firmware-v06-20MHz.hex
U2IO flash erasing: DONE.
U2IO flash programming: DONE.
RESET Device
Operation successfully completed.

C:\firmware>pause
Press any key to continue . . .
  • Run the firmware loader (\Firmware-0506update\fw_update.exe) as shown above, or just use the OLSv1-firmware-v06-20MHz.bat (or 05) included in the update archive.
  • The chip is erased and then programmed. It’s a little slow, be prepared to wait.
  • Remove the jumper, and reset the board by pressing the RESET button.

6. Load updated ROM with pump-loader

In this final step we put the OLS in ROM update mode and load the latest bitstream for the FPGA. OLS firmware v04+ requires bitstream v2.04 or later.

  • Enter update ROM mode. Hold the UPDATE button then press the RESET button to enter update mode. The ACT LED lights, and the OLS enumerates as a virtual serial port.

  • If this is the first upgrade to v05/06 you will need to use the updated .inf (\inf\mchpcdc.inf) included in the archive to assign a driver to the OLS.
C:\Perl\eg>pump-loader -p:COM4 -write -wH:pump.mcs -run
PUMP loader
Opening serial port 'COM4' @ 921600 ... OK
Found PUMP HW: 1, FW: 0.5, Boot: 1
Found flash: ATMEL AT45DB041D
Reading HEX file 'pump.mcs' ... OK! (binary size = 169216)
Will write 641 pages
Page 0x0000 write ... OK
......
Page 0x0280 write ... OK
PUMP switched to RUN mode

C:\Perl\eg>
  • Edit the load_ROM.bat file (\Bitstream-2.04update\load_ROM.bat) and modify the -p:COMx to match your system.
  • Run load_ROM.bat to load the updated bitstream to the OLS ROM chip.
  • The upload will take a few seconds, but the operation isn’t critical. If it fails or is interrupted nothing will be damaged, just try the update again. If you use the -run flag the OLS will exit update mode and return to normal operating mode when the upload is complete.

Finish by unplugging the OLS from USB, then plugging it in again.

Congratulations, master hacker, your upgrade is complete. If this worked for you, or if you need some help, please give us a shout in the forum.


Viewing all articles
Browse latest Browse all 10

Trending Articles