I2C-HAT firmware update

Download and install stm32flash on Raspberry PI

stm32flash is the tool you need to update the firmware on the I2C-HATs.

Open a terminal on Raspberry PI and go to the directory where you want to download stm32flash, type the following commands to download and install:

STM32 integrated bootloader

All I2C-HATs are based on STM32 ARM chips which have the integrated STM32 I2C bootloader support, this enables firmware update via I2C bus.


  • Disconnect everything that’s connected to board inputs/outputs
  • Make sure you have the right I2C clock stretching timeout value, check this POST

Enable the bootloader

Install the BOOT jumper before powering up the I2C-HAT on which you wish the firmware to be updated, the I2C address for the bootloader is specified in the following table:

I2C-HAT name ST Micro Bootloader I2C Address
DI16 STM32F042 0x3E
Rly10 STM32F042 0x3E
DI6Rly6 STM32F042 0x3E
Step1M2A STM32F072 0x39

Use the folowing command to scan the I2C1 bus on Raspberry PI:

Command and output:

If you can find the bootloader address 0x3E(or 0x39) in the i2cdetect output, than it’s ok to proceed to the next step.

Download and write the firmware

Go to the desired location where you want to download the firmware and type the following commands:

You can find all firmware releases on github

You should remove the BOOT jumper, the next command will write and start the new firmware.


Leave a Reply

Your email address will not be published. Required fields are marked *