cancel
Showing results for 
Search instead for 
Did you mean: 

UPGRADE FIRMWARE stm32l072kztx

yurymiguel
Associate II

Olá pessoal,
estou tentando atualizar o micro firmware usando stm32 cubeIde stm32l072kztx. Já tentei usar os comandos AT^SISS e baixar o arquivo .HEX compilado via FTP, já tentei usar os comandos AT^SNFOTA, mas não funcionou. Baixando via FTP consigo baixar e colocar em modo de atualização de firmware e rodar sem retornar nenhum erro, mas ao testar vi que o firmware não foi atualizado. Ao usar o FOTA com o comando AT?SFDL=2 para executar a atualização do firmware, ele sempre retorna FOTA START --> FOTA FAIL --> FAIL!. O que devo fazer para atualizar o firmware do mcu e fazer com que o código-fonte que está sendo executado seja alterado pelo que está no novo firmware que é o novo firmware baixado do servidor?

7 REPLIES 7

"Hi everyone, I'm trying to update the micro firmware using stm32 cubeIde stm32l072kztx. I've tried using the AT^SISS commands and downloading the compiled .HEX file via FTP, I've tried using the AT^SNFOTA commands, but it didn't work. Downloading via FTP I can download and put it in firmware update mode and run without returning any errors, but when testing I saw that the firmware was not updated. When using FOTA with the AT?SFDL=2 command to perform the firmware update, it always returns FOTA START --> FOTA FAIL --> FAIL!. What should I do to update the mcu firmware and cause the source code that is running to be changed by what is in the new firmware which is the new firmware downloaded from the server?"

What firmware are we talking about that's supporting AT commands, and how's the data getting transferred? Review the firmware source, understand the expectations.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Lina DABASINSKAITE
Community manager
Community manager

Hello dear @yurymiguel , 

Thanks for your message. The forum language is English, so please expect the answers to be provide the respective language. 

@Tesla DeLorean , thanks for translating! 

BR,
Lina


In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.

I just pressed a button in Chrome/Google, as I've previously observed, I'd much rather someone asks/answers richly in their native language, than poorly in English.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

sorry for the confusion. Im trying to upgrade firmware, the ideia is that i run the computer with an initial code and after a certain routine it downloads a .HEX file via http (I use telit exs82-w module together), and then stores the data of this new firmware, and after that it somehow stops running the old firmware and starts to run the new one that was downloaded. All this with the code running, I'm currently trying to acomplishing this using dual-bank, where I store my downloaded firmware in the BANK2 of the flash, and after that I can't stop running the old one and start running the new one.

IDE stm32 cubeIde
Micro stm32l072kzt6x
Módule exs82-w telit
My micro stm32l072 has the following verses v1.12.1 - v1.12.2 - v1.12.0

Ok, so you're trying to update the firmware in the STM32 or EXS82?

If you download a .HEX from the HTTP server into the STM32, for the STM32, you're going to have to unpack that into a binary form, and then load it into the STM32 at the appropriate address (the one the linker built it for)

You could stage it in the second bank, and then use that to update the image in the first bank (or portion thereof), but there are quite a lot of moving parts.

If the image is in the second bank, and you need to run that from the first, you might want to use a reset to fork execution, and swap the banks. Do you have a way to determine which image is newer, and which bank is currently mapped?

https://www.telit.com/devices/exs82/

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

I need to update the stm32 firmware, the default and original firmware seems to start at bank1, using hal flash page function I pass the initial adress of bank2 and follow it through the memory monitor(I use CubeIDe) and I see that the data in .HEX is being stored, but I cant-jump to bank2 and bank1 stops executing, I've already tried changing the vector initialization with code running call the function, I've tried configuring opbit for bank2 after downloading and resetting the computer, I've already tried to map the code execution for bank2 in many ways after the donlowad is completed, my code has the entire conversion structure for .HEX, not for binary. My computer has the following firmware versions v1.12.1 - v1.12.2 - v1.12.0, I hope that these versions that came with me computer are capable of marking the bootloader, What form,  or function of the Hall lib, or anything else should I use to skip execution the pro bank2 code? Should i call some other pin configuration?

The currentStatus of this case returns Sucess-Close-Service wich indicates that the .HEX firmware was sucessfully downloaded and is saved in memory bank2, Then I tried to do all this jump to bank2, this case is inside a while loop.

 

case GET_FW:
 {
 FLASH_OBProgramInitTypeDef obConfig;

 HAL_FLASHEx_OBGetConfig(&obConfig);

 if (obConfig.BOOTBit1Config != OB_BOOT_BIT1_SET)
 {

 FLASH_modeFirmware();

 }

 currentStatus = NB_IoT(MODE);

 if (currentStatus == SUCCESS_CLOSE_SERVICE)
 {

 //SYSCFG->CFGR1 &= ~SYSCFG_CFGR1_MEM_MODE;
 //SCB->VTOR = FLASH_BASE | FLASH_BANK2_BASE;
 // __HAL_SYSCFG_REMAPMEMORY_SRAM();
 //FLASH->OPTR &= ~FLASH_OPTR_nRST_STOP_Msk;
 //SCB->VTOR = FLASH_BASE |   0x8018000;
 //SCB->VTOR = 0x8018000;
 

    //FLASH_jumpFirmware();
    //FLASH_exitModeBoot();
     //currentOperation = RESET_MOD;
      //HAL_NVIC_SystemReset();
 }

else if (currentStatus == FAIL_GET_REQUEST)
 {

 currentOperation = WAITING_COMMAND;
 }
 else
 {

 }
 }
 break;





Currently this function is called to perform the jump. We configure it to jumpt to bank2.
void FLASH_jumpFirmware()
{
FLASH_AdvOBProgramInitTypeDef advOBConfig;

HAL_FLASH_Unlock();

 advOBConfig.OptionType = OPTIONBYTE_BOOTCONFIG;
 advOBConfig.BootConfig = OB_BOOT_BANK2;

 if (HAL_FLASHEx_AdvOBProgram(&advOBConfig) != HAL_OK)
 {
 //*
 }

HAL_FLASH_Lock();

}