1.1.3 PIC32MK MCA Curiosity Pro: Building and Running the I2C Bootloader applications

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

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

Bootloader Application

Project NameDescription
bootloader/firmware/pic32mk_mca_curiosity_pro.XMPLABX Project for PIC32MK MCA Curiosity Pro

Test Application

Project NameDescription
test_app/firmware/pic32mk_mca_curiosity_pro.XMPLABX Project for PIC32MK MCA Curiosity Pro

Setting up PIC32MK MCA Curiosity Pro

  • SAM E54 Xplained Pro Evaluation Kit is used as the Host development kit and PIC32MK MCA Curiosity Pro is used as the Target Development Kit

    i2c_bootloader_host_target_connection
  • Connect the I2C SDA line Pin 11 (SDA2/RA8) on EXT1 of the Target Development Kit to the I2C SDA line Pin 11 (SERCOM7 PAD/PD08) on EXT2 of the Host development kit

  • Connect the I2C SCL line Pin 12 (SCL2/RB4) on EXT1 of the Host development kit to the I2C SCL line Pin 12 (SERCOM7 PAD/PD09) on EXT2 of the Host development kit

  • Connect a ground wire between the Host development kit and Target development kit

  • Connect the Debug USB port on the Host development kit to the computer using a micro USB cable

  • Connect the Debug USB port on the Target development kit to the computer using a micro USB cable

Building and Configuring I2C Host Applications

Using I2C SDCARD Host application to send the application binary to Target development kit

host_app_sdcard_setup

If the SDCARD Host Development Kit being used is other than SAM E54 Xplained Pro Evaluation Kit then follow the steps mentioned in Configuring SDCARD Host application project

configuring-the-sdcard-host-application

  1. Open the SDCARD host application project host_app_sdcard/firmware/sam_e54_xpro.X in the IDE

    • If a SDCARD host application project of different development kit is used then open that project in the IDE

  2. Make sure that the APP_I2C_BOOTLOADER_TARGET_DEVICE macro is set to the target board being programmed

  3. Build and program the SDCARD host application using the IDE on to the I2C host dvelopment kit

  4. Open the test application project test_app/firmware/pic32mk_mca_curiosity_pro.X in the IDE

  5. Build the project to generate the binary (Do not program the binary)

  6. Copy the application binary into the SD card and insert the SD card in the SD card slot available on the SAM E54 Xplained Pro Evaluation Kit

  7. Open the Terminal application (Ex.:Tera Term) on the computer

  8. Configure the serial port settings for Host Development kit as follows:

    • Baud : 115200

    • Data : 8 Bits

    • Parity : None

    • Stop : 1 Bit

    • Flow Control : None

  9. Jump to Running The Application

Running the Application

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

  2. Build and program the application using the IDE on to the Target development kit

    • LED1 will be turned-on to indicate that bootloader code is running on the target

    • LED1 will also turn on when the bootloader does not find a valid application; i.e. the first word of the application (stack pointer), contains 0xFFFFFFFF

  3. If the test application is being programmed, Open the Terminal application (Ex.:Tera Term) on the computer and configure the serial port settings for Target Development kit as follows:

    • Baud : 115200

    • Data : 8 Bits

    • Parity : None

    • Stop : 1 Bit

    • Flow Control : None

  4. Press the Switch SW0 on the Host development kit to trigger programming of the application binary

  5. Once the programming is complete,

    • LED0 on the Host development kit will be turned on indicating success

    • If SDCARD Host application was used to program the application binary following message will be displayed on the terminal of Host development kit

      i2c_bootloader_host_app_sdcard_output
    • The target development kit will be reset. Upon re-start, the boot-loader will jump to the user application

    • If the test application is programmed then LED1 should start blinking and you should see below output on the Target development kit console

      output
  6. Press and hold the Switch SW200 to trigger Bootloader from test application and you should see below output

    output
  7. Press Reset button on the Host development kit to reprogram the application binary

  8. Repeat Steps 4-5 once

    • This step is to verify that bootloader is running after triggering bootloader from test application in Step 6

Additional Steps (Optional)

Using SDCARD Host application