cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F429 IAP through UART using own protocol, without specific bootloader What do I need to do ?

SEmar
Associate II

Hi everyone,

My question is what do I have to do ?

I read too much information about IAP to really understand what do I need to do.

Our firmware is working great for now, we want to update the firmware without stop everything and on restart we can be in the newer firmware. The image "On the fly.png" shows our procedure.

During the upload process, we get the byte through the UART (parsed because of our protocol) and put these data in the FLASH (actually it works for put / read data at address 0x08100000), "Memory map.png".

I want to do it really simple :

  • Our initial firmware is contained in the Flash Bank 1 ;
  • Transfer firmware through UART to Flash Bank 2 ;
  • Restart in bootloader mode so we go to Flash Bank 2 = newer firmware.

So my idea was to :

  • Upload all data from START_ADDRESS = 0x0810000 ;
  • BOOT0 is connected to ground (so 0) -> start in bootloader ;
  • BFB2 should be 1;
  • FB_MODE should be 0 because at each upload we send data to the address 0x0810000.

But I read some about VECTOR_TABLE and in the AN2606 there is the conditional "first address of Bank2 is within int. SRAM address".

I do not really get this information.

Could you help me on that ? The procedure I imagine is compatible with the upload process ?

In case of update of the update, go to firmware version +1.1.1 from version 1.1.0, how did it go with this procedure ? We also write in the Bank 2 ?

Thanks,

Simon

Edit : I also need to know what file I have to upload if I want to write it directly in FLASH ? .bin / .hex / .srec / .elf

I think it is the .bin file but it seems very small (81 kBytes) also the .hex (226 kBytes).

1 ACCEPTED SOLUTION

Accepted Solutions
SEmar
Associate II

Hi everyone,

So I made it work, but I missed some information because I encountered some unexpected results.

BFB2 is swapped 0 to 1, following the number of re-programming.

I always program from address 0x08100000 which is unexpected because I thought 0x08100000 was only the BANK2 and with the software STM32 ST-LINK I saw when I swich BFB it is swapping the BANK1 <-> BANK2 addresses. I thought it was because of FB_MODE that I wrote before. But it didn't change.

So for now :

  1. Firmware 1.0.0 is loading normally with ST-LINK ;
  2. When 1st remote upgrade firmware to 1.0.0.1
    1. Erase bank 2 ;
    2. Upload data from address 0x0810 000 ;
    3. Swap BFB2 from 0 to 1 ;
    4. Reset -> firmware is 1.0.0.1 ;
  3. When 2nd remote upgrade firmware to 1.0.0.2 :
    1. Erase bank 1 ;
    2. Upload data from address 0x0810 000 ;
    3. Swap BFB2 from 1 to 0 ;
    4. Reset -> firmware is 1.0.0.2 ;
  4. Following

I need now to add Write Protection to the Bank containing the current application code.

Hope it can be used by others.

Website that helps me : Github guy

Simon

View solution in original post

2 REPLIES 2
SEmar
Associate II

Hi everyone,

So I made it work, but I missed some information because I encountered some unexpected results.

BFB2 is swapped 0 to 1, following the number of re-programming.

I always program from address 0x08100000 which is unexpected because I thought 0x08100000 was only the BANK2 and with the software STM32 ST-LINK I saw when I swich BFB it is swapping the BANK1 <-> BANK2 addresses. I thought it was because of FB_MODE that I wrote before. But it didn't change.

So for now :

  1. Firmware 1.0.0 is loading normally with ST-LINK ;
  2. When 1st remote upgrade firmware to 1.0.0.1
    1. Erase bank 2 ;
    2. Upload data from address 0x0810 000 ;
    3. Swap BFB2 from 0 to 1 ;
    4. Reset -> firmware is 1.0.0.1 ;
  3. When 2nd remote upgrade firmware to 1.0.0.2 :
    1. Erase bank 1 ;
    2. Upload data from address 0x0810 000 ;
    3. Swap BFB2 from 1 to 0 ;
    4. Reset -> firmware is 1.0.0.2 ;
  4. Following

I need now to add Write Protection to the Bank containing the current application code.

Hope it can be used by others.

Website that helps me : Github guy

Simon

SEmar
Associate II

Hi everyone,

So I found the problem, it enabled the bank swapping (FB_MODE was forced to '1').

To solve this issue, I called the HAL function HAL_DisableMemorySwappingBank();

Simon