1.5.1 PIC32 WFI32E Curiosity Board: Building and Running the File System Based SPI 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/fs/spi/.

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

Programmer Application

Project NameDescription
app_programmer/firmware/pic32mz_w1_curiosity.XMPLAB X Project for PIC32 WFI32E Curiosity Board

Setting Up PIC32 WFI32E Curiosity Board

  • To run the demo, the following additional hardware are required:
  • Connect IO1 Xplained Pro Extension Kit to the J203 XPRO header of PIC32 WFI32E Curiosity Board
  • On the GPIO Header (J207), connect U1RX (Pin 13) and U1TX (Pin 23) to TX and RX pin of any USB to UART converter (e.g., USB UART Click board)
  • Connect the Debug USB port on the board to the computer using a micro USB cable

Running the Application

  1. Open the bootloader project bootloader/firmware/pic32mz_w1_curiosity.X in the IDE.
  2. Ensure that the app_programmer/firmware/pic32mz_w1_curiosity.X is added as a loadable project to bootloader application.
    • As the SPI 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.
  3. Open the Terminal application (e.g., Tera Term) on the computer to get programmer application messages through UART once loaded.
  4. Configure the serial port settings as follows:
    • Baud: 115200
    • Data: 8 Bits
    • Parity: None
    • Stop: 1 Bit
    • Flow Control: None
  5. Build and program the bootloader application using the IDE.
  6. Once programming is done, bootloader starts execution and directly jumps to application space to run the programmer application.
    • RED LED (D202) starts blinking indicating that the programmer application is running and the user should see below output on the console
  7. Open the programmer application project app_programmer/firmware/pic32mz_w1_curiosity.X in the IDE.
  8. Update app_programmer/firmware/src/app_monitor.c to update printf message from Serial Memory to SPI Flash Memory as below.
    printf("\r\n###### File System (SPI Flash Memory) Programmer Application Running ######\r\n");
  9. Clean and Build the project to generate the binary (Do not program the binary).
  10. Copy the generated application binary file to a sdcard from the Host PC.
    <harmony3_path>/bootloader_apps_serial_memory/apps/fs/spi/app_programmer/
    firmware/pic32mz_w1_curiosity.X/dist/pic32mz_w1_curiosity/production/
    pic32mz_w1_curiosity.X.production.bin
  11. Rename the copied application binary file to image.bin.
  12. Insert the sdcard with the application binary image.bin in the micro-SD Card slot of the IO1 Xplained Pro Extension Kit.
  13. Following figure shows output of successfully copying the programmer application binary to SPI Flash Memory.
    • RED LED (D202) should still be blinking
  14. Remove the sdcard from the sdcard slot.
  15. Press and hold the Switch SW1/SW200 to trigger Bootloader from programmer application and the user should see below output.
  16. Once Firmware Update is successful, RED LED (D202) should start blinking indicating updated programmer application running and the user should see below output on the console.

Additional Steps (Optional)