Skip to main content
Graduate II
May 20, 2025
Question

STM32G491 IAP

  • May 20, 2025
  • 2 replies
  • 628 views

Hi,

I'm working on firmware upgrade functionality for an STM32G491 series MCU. In our system, the MCU communicates with a processor over I2C, where the processor acts as the master and the MCU as the slave. Currently, we're using I2C1 on the MCU for this communication.

However, as per AN2606, I2C1 is not supported in boot mode for firmware flashing, which limits our ability to use standard ISP. Therefore, we're exploring the option of using In-Application Programming (IAP) over I2C1.

Is it possible to perform IAP using I2C1 in this configuration? If so, could you point me to any sample code or reference implementations?

    This topic has been closed for replies.

    2 replies

    Super User
    May 20, 2025

    How to use the ST Open Bootloader for STM32 Microc... - STMicroelectronics Community

     

    It would be better in the long run to switch to a bootloader supported I2C pins. Less code, more time spent on functionality.

    Graduate II
    May 20, 2025

    You can code your own IAP implementation using whatever interface and protocol you choose.

    Review other IAP examples you can find, adapt, or have your coders code.

    Graduate II
    May 20, 2025

    Hi @Tesla DeLorean ,
    My doubt is in IAP driver implementation, I need to enable one UART, I2C and a GPIO. After jumping to the User application, whether the initialised I2C, UART and GPIO need to be reinitialised? or I need to de init everything before jumping to user application?

     

    Graduate II
    May 20, 2025

    You get to decide the contractual details between your loader and your app.

    You can initialize the clocks, PLL just once, and not repeat when in the application. This will save time, but just be aware in the application that the entry conditions may be different, and not at reset defaults. The peripherals, clocks, pins, etc will be in whatever state the loader leaves them.

    Generally, you want to hand over a relatively quiet and stable system, so not generating interrupt, say for SysTick, TIMx and UARTx, as at the point of handover none of the HAL RAM instances will follow, and the application image will have it's own RAM allocations as doled out by the Linker.

    Perhaps look at IAP examples for other STM32 families for simpler implementations, or at

    STM32Cube_FW_G4_V1.5.2\Projects\NUCLEO-G491RE\Applications\OpenBootloader