Senior
May 26, 2025
Solved
STM32H563: BANK SWAP
- May 26, 2025
- 2 replies
- 745 views
I am using NUCLEO-H563ZI and am trying to implement bank swap for firmware update. I am using YMODEM to update firmware. Initially when my code is being executed from BANK 1 and after writing the new firmware at BANK 2. The code execution starts from BANK 2 successfully. But the reverse in not happening. After all the process I checked the address where I am writing the new firmware in BANK 1 and nothing was there which cause hard fault.
Therefore, why the process doesn't fail initially when writing firmware at BANK 2 and it fails only when writing at BANK 1 even though the code is same. Below I have attached some files.
void SerialDownload(void)
{
uint8_t number[11] = {0};
uint32_t size = 0;
COM_StatusTypeDef result;
Serial_PutString((uint8_t *)"\rWaiting for the file to be sent ... (press 'a' to abort)\n\r");
result = Ymodem_Receive( &size );
if (result == COM_OK)
{
if ((erase_operation==1) && (end_of_download_operation ==0))
{
end_of_download_operation = 1;
}
Serial_PutString((uint8_t *)"\n\n\r Programming Completed Successfully!\n\r-----------------------\r\n Name: ");
Serial_PutString(aFileName);
Int2Str(number, size);
Serial_PutString((uint8_t *)"\n\r Size: ");
Serial_PutString(number);
Serial_PutString((uint8_t *)" Bytes\r\n");
Serial_PutString((uint8_t *)"-----------------------\n");
}
else if (result == COM_LIMIT)
{
Serial_PutString((uint8_t *)"\n\n\rThe image size is higher than the allowed space memory!\n\r");
}
else if (result == COM_DATA)
{
Serial_PutString((uint8_t *)"\n\n\rVerification failed! Error while writing to the Flash\n\r");
}
else if (result == COM_ABORT)
{
Serial_PutString((uint8_t *)"\r\n\nAborted by user.\n\r");
}
else if (result == ERASE_ERR)
{
Serial_PutString((uint8_t *)"\r\n\nERROR! Erasing the Flash.\n\r");
}
else
{
Serial_PutString((uint8_t *)"\n\rFailed to receive the file!\n\r");
}
}
