4 Microchip Device Firmware Update (pymdfu)

Introduction

The Microchip Device Firmware Update (pymdfu) tool is used to transfer an application program from the host machine (development host) to a target device (a device running the embedded application). pymdfu transfers the image file (.img) created from the application hex file (.hex) and the bootloader configuration file (.toml) by the Firmware Image Builder tool (pyfwimagebuilder).

pymdfu Workflow

The workflow required for pymdfu to function with the bootloader client firmware is described below. All the steps mentioned here are required to successfully upgrade the application firmware using MCC Melodyʼs 8-Bit MDFU Client library and pymdfu.

Note: Make sure to have Python 3.8 or later installed and accessible by the command line interface.
  1. Open the Windows Command Prompt.
  2. Install the pymdfu tool using the command:

     pip install pymdfu
  3. Execute the below command to transfer the embedded application in .img format to the target device:

UART:
pymdfu update -v debug --tool serial --image <application.img> --baudrate <baudrate> -–port <comport>
  • E.g.,
    pymdfu update -v debug --tool serial --image avr128da48-checksum.img --baudrate 9600 --port COM15
    Note: Make sure to check the correct COM Port for the target device in the Device Manager.

SPI:

pymdfu update --tool mcp2210 -v debug --image <application.img> --clk-speed <clockspeed> --chip-select <pin number>
  • E.g.,

    pymdfu update --tool mcp2210 -v debug --image avr128da48-checksum.img --clk-speed 1500 --chip-select 7
    Note: The chip select argument in the above command is the GPIO pin number on the MCP2210 module connected to the target hardwareʼs Chip Select pin. In the previous example, the Chip Select is connected to GPIO 7 on MCP2210.