2025-04-23 10:08 PM
Hi,
I'm working on flashing an STM32 MCU via I2C. The current setup involves a processor (host) and an STM32 MCU (G491RET6), where the processor needs to upload firmware to the MCU and perform flashing over I2C with the STM32 acting as the slave.
I have a question regarding the I2C interface used during bootloader mode. The MCU has I2C1, I2C2, and I2C3 available — can any of these be used for flashing in boot mode, or is only a specific I2C peripheral supported by the STM32 bootloader?
Also, for I2C1, there are multiple pin options available in the pinmux configuration. Which specific pins should be used for flashing via I2C in this case?
Solved! Go to Solution.
2025-04-25 3:48 AM - edited 2025-04-25 3:49 AM
Hello @abhijith_raj
@abhijith_raj wrote:
Hi @TDK
Our basic schematic is as follows: we’ve connected I2C1 for communication between the processor and the MCU, as well as for firmware flashing. I2C3 is used for external sensors.Will this setup cause any issues during boot mode for firmware flashing? The documentation mentions that only I2C2 and I2C3 are supported in boot mode.
No, this will no gonna working.
You cannot use I2C1 for the bootloader (Processor Host/MCU G4), Only I2C2 and I2C3 are available as indicated by the AN2606 / page 263. Moreover only PC4/PA8 are available for I2C2 and PC8/PC9 are available for I2C3.
So what we suggest is to swap the I2C instances: I2C1 for the sensor communication and I2C3 for the bootloader with PC8/PC9 as you've already indicated in your sketch.
2025-04-23 10:18 PM
This is usually documented in the reference manual for your MCU variant.
Here an example for some F3 variants I have at hand :
2025-04-24 6:14 AM
Hi @Ozone ,
I’m currently using the Nucleo-G491RE evaluation board.
In the current firmware, I2C2 and I2C3 are configured as masters.
During boot mode, do these pins get reconfigured? If so, can I still use either of the I2C interfaces?
2025-04-24 6:22 AM
The AN2606 document will specify which pins and peripherals are available to the bootloader. Only those pins are supported. Here are the supported I2C interfaces for the STM32G491xx chips:
2025-04-25 12:02 AM
Hi @TDK
Our basic schematic is as follows: we’ve connected I2C1 for communication between the processor and the MCU, as well as for firmware flashing. I2C3 is used for external sensors.
Will this setup cause any issues during boot mode for firmware flashing? The documentation mentions that only I2C2 and I2C3 are supported in boot mode.
2025-04-25 12:33 AM
Firmware upate via I2C means you need to attach an external device to one of the supported I2C peripherals, either 2 or 3. This might be I2C3, because the pins the BL would allocate for I2C2 might be used for other purposes, and thus interfere.
As you see in the AN screenshot, there are no pin options in the BL.
The BL is ROM-based code, and it will use PC4/PA8 or PC8/PC9, respectively.
You need to design your firmware update capability around this constraints.
2025-04-25 3:48 AM - edited 2025-04-25 3:49 AM
Hello @abhijith_raj
@abhijith_raj wrote:
Hi @TDK
Our basic schematic is as follows: we’ve connected I2C1 for communication between the processor and the MCU, as well as for firmware flashing. I2C3 is used for external sensors.Will this setup cause any issues during boot mode for firmware flashing? The documentation mentions that only I2C2 and I2C3 are supported in boot mode.
No, this will no gonna working.
You cannot use I2C1 for the bootloader (Processor Host/MCU G4), Only I2C2 and I2C3 are available as indicated by the AN2606 / page 263. Moreover only PC4/PA8 are available for I2C2 and PC8/PC9 are available for I2C3.
So what we suggest is to swap the I2C instances: I2C1 for the sensor communication and I2C3 for the bootloader with PC8/PC9 as you've already indicated in your sketch.
2025-04-25 7:57 AM
It states what pins are supported, as I also said in my response. Read it.