1.4.3 PIC32MZ Embedded Connectivity with FPU (EF) Starter Kit: Building and Running the QSPI Flash Bootloader applications

Downloading and building the application

To clone or download this application from Github,go to the main page of this repository and then click Clone button to clone this repo or download as zip file. This content can also be download using content manager by following these instructions

Path of the application within the repository is apps/qspi_flash_bootloader/

To build the application, refer to the following table and open the project using its IDE.

Setting up the host script

  • Refer to UART Host Script Help for setting up the uart_host.py utility used to send the application binary from host PC

    • There will be no reset command sent from host after programming by default.

    • Reboot command has to be sent separately only after successful programming to trigger bootloader from programmer application

Running the Application

  1. Open the bootloader project bootloader/firmware/pic32mz_ef_sk.X in the IDE

  2. Make sure that the app_programmer/firmware/pic32mz_ef_sk.X is added as a loadable project to bootloader application

    • As the QSPI Flash memory may not have any valid binary required by bootloader for the first time, Adding the app_programmer as loadable allows MPLAB X to create a unified hex file and program both these applications in their respective memory locations based on their linker script configurations

    mplab_loadable_pic32mz_ef_sk
  3. Build and program the bootloader application using the IDE

  4. Once programming is done bootloader starts execution and directly jumps to application space to run the programmer application

    • LED3 starts blinking indicating that the programmer application is running

  5. Open the programmer application project app_programmer/firmware/pic32mz_ef_sk.X in the IDE

  6. Update app_programmer/firmware/src/config/pic32mz_ef_sk/user.h to use LED2 instead of LED3 as below

    	#define LED_TOGGLE()            LED2_Toggle()
  7. Clean and Build the project to generate the binary (Do not program the binary)

  8. Run the uart_host.py from command prompt to program the updated programmer application binary in QSPI Flash memory

     python <harmony3_path>/bootloader_apps_serial_memory/tools/uart_host.py -v -i <COM PORT> -d pic32mz -a 0x9D000000 -f <harmony3_path>/bootloader_apps_serial_memory/apps/qspi_flash_bootloader/app_programmer/firmware/pic32mz_ef_sk.X/dist/pic32mz_ef_sk/production/pic32mz_ef_sk.X.production.bin
  9. Following snapshot shows output of successfully programming the programmer application

    • LED3 should still be blinking

    uart_host_output_program
  10. Run the uart_host.py from command prompt to send a Reboot command. This command Updates MetaData and triggers Bootloader to program the updated binary from QSPI Flash to Internal Flash

    python <harmony3_path>/bootloader_apps_serial_memory/tools/uart_host.py -v -i <COM PORT> -r
    uart_host_output_reboot
  11. Once Firmware Update is successful LED2 should start blinking indicating updated programmer application running

    • If there was any error you may need to power cycle the device to retry firmware upgrade

  12. Update app_programmer/firmware/src/config/pic32mz_ef_sk/user.h to revert to LED3 from LED2 as below

    #define LED_TOGGLE()            LED3_Toggle()
  13. Clean and Build the project to generate the binary (Do not program the binary)

  14. Repeat Step 8-9.

    • You should see LED2 still blinking

  15. Press the Switch SW1 to Update MetaData and trigger Bootloader to program the updated binary from QSPI Flash to Internal Flash

  16. Once Firmware Update is successful LED3 should start blinking indicating updated programmer application running

    • If there was any error you may need to power cycle the device to retry firmware upgrade

Additional Steps (Optional)