Compiling and Programming PIC Firmware

From spiderboard.org
Jump to: navigation, search

About

SpiderSoM and MX10 implement a PIC16F1454 Microcontroller to enable access to UART, I2C and JTAG interfaces.
The firmware consists of a bootloader and the user application and implements the USB DFU protocol to allow firmware updates.

Requirements

Updating Firmware

Downloading Sources

The source for the PIC Firmware is available on github.

  • Open a new terminal.
  • Use git to download the sources:
    $ git clone https://github.com/ARIES-Embedded/pic16f1-usb-firmware.git spider-firmware
  • firmware/ contains the bootloader.
  • example-apps/aries-firmware/ contains the user firmware.
  • tools/ contains the 454hex2dfu utility to convert a .hex file to a .dfu file.

Compiling Firmware

  • Change into the directory: example-apps/aries-firmware/ and run make.
    $ cd spider-firmware/example-apps/aries-firmware/
    $ make
  • If no errors occur a firmware.hex was created.

Programming Firmware

  • The PIC firmware uses the USB DFU Protocol to allow firmware updates.
  • First convert the .hex file into a .dfu file using the 454hex2dfu tool (needs to be build first).
    $ cd ../../tools
    $ make
    $ ./454hex2dfu ../example-apps/aries-firmware/firmware.hex firmware.dfu
  • Then use dfu-util to upload the new firmware to PIC.
    $ dfu-util -d 04d8:efd0 -D firmware.dfu
  • The PIC user mode uses USB VID:PID 04d8:efd0 and the bootloader 1209:2002.
  • dfu-util first sets the PIC into bootloader and then starts uploading the new firmware.
  • The PIC will remain in bootloader until it is reset per powercycle.

Updating Bootloader

  • Since the bootloader is write protected, it can only be updated using an ICSP device (ex. PICKit).
  • The ICSP pin header on the SpiderBase enables full access to the PIC16F1454 microcontroller.