UART bootloader doesn't answer after successful read unprotect command
Hello,
I have a problem with the bootloader on a Nucleo G071RB. I have no problem reaching the bootloader to download some new firmware in UART, after a reset and Boot0 pin set as it should, the bootloader responds to messages send through UART : when sending the begin command it is acked, same for the command to get version and read protection status and the readout unprotect command too. The problem is, after sending this last one, it simply stops responding after sending the two ACKs of the readout unprotect command. I've tried with the begin command and the write unprotect command, it doesn't answer, there's no ACK or NACK, it just sends nothing.
It is also worth mentioning that the firmware that was present on the Nucleo board isn't erased as it continues to run after a reset in normal execution mode.
I have logged the response of the get version and read protection status and I have the following result which seems a bit odd : 0x79 0x31 0x00 0x00 0x79. So I have the two ACKS, the version is 3.1 but the option bytes set to zero doesn't feel right.
In the firmware on the STM that has ran at least once, I have the following code to enable bootloader selection with Boot0 pin :
FLASH_OBProgramInitTypeDef flash_ob_program_init, flash_ob_program_set;
HAL_FLASHEx_OBGetConfig(&flash_ob_program_init);
if ((flash_ob_program_init.USERConfig & FLASH_OPTR_nBOOT1) != OB_BOOT1_SYSTEM ||
(flash_ob_program_init.USERConfig & FLASH_OPTR_nBOOT_SEL) != OB_BOOT0_FROM_PIN) {
HAL_FLASH_Unlock();
HAL_FLASH_OB_Unlock();
flash_ob_program_set.OptionType = OPTIONBYTE_USER;
flash_ob_program_set.USERType = FLASH_OPTR_nBOOT1 | FLASH_OPTR_nBOOT_SEL;
flash_ob_program_set.USERConfig = OB_BOOT1_SYSTEM | OB_BOOT0_FROM_PIN;
HAL_FLASHEx_OBProgram(&flash_ob_program_set);
HAL_FLASH_OB_Launch();
}So maybe there's something wrong there but I don't see what. Any ideas where it could come from ?
Best regards,
Laurent Louf
