50.1 Appendix A: MPLAB® Harmony v3 UART-I2C Factory Bootloader for PIC32CM JH00/JH01

The Bootloader programmed at production by Microchip is an MPLAB Harmony v3-based Bootloader capable of programming an application binary using either the UART or I2C interface.

Key Features

  • The Bootloader is programmed at the Flash memory location (0x00000000) and takes up to 4 KB of Flash memory. It is protected by default using the BOOTPROT fuse setting from any erase-writes. The BOOTPROT value is set to 4 KB (0x1000).
  • The Bootloader startup code copies the Bootloader from the Flash memory to the SRAM from (0x20000010) before calling the main function. The main function (and therefore the entire Bootloader) runs from the SRAM to allow upgrading of the Bootloader code itself in Flash memory.
  • The Bootloader provides a feature to read the current version of the Bootloader running by using the read version command.
  • The Bootloader provides a feature to program the Fuse settings using a separate command.
  • The Bootloader provides two options to trigger the Bootloader mode:
    • External trigger: Bootloader will be triggered based on the status of a GPIO pin.
    • Internal trigger: Bootloader will be triggered based on the trigger pattern written at a specific location in the SRAM by the application firmware.
  • After a new application image is programmed, the Bootloader will verify the programmed application space by generating a CRC-32 value and comparing it with the CRC-32 received from the Host. The application CRC will not be verified after every reset before jumping to the application space for faster startup.
  • The Bootloader will read the first four bytes of application space (0x1000) to decide if a valid application is present. If the contents of the first four bytes are not 0xFFFFFFFF, then the Bootloader assumes a valid application is present and jumps to the application. If a valid application is not present, then the Bootloader will wait, and remain in Bootloader mode.

Key Requirements

  • By default, the Bootloader expects the application to start from the 0x1000 location. Therefore, the application should be built to start from the 0x1000 Flash location.
  • To update the Bootloader code, the user should first set the BOOTPROT fuse to 0xF to disable the write protection, then send the new Bootloader binary.
  • External Pull-ups must be used for the I2C SDA and SCL lines.
Figure 50-1. UART-I2C Bootloader Memory Layout
Figure 50-2. UART-I2C Bootloader System Level Execution Flow