CubeProgrammer API downlaodFile error
Hey there,
I am using the CubeProgrammer API (2.17.0) to flash a STM32U545 MCU over USB DFU with a new firmware.
When doing so a write error occurs (downlaodFile(...) returns CUBEPROGRAMMER_ERROR_WRITE_MEM (-10)) when flashing a new hex file (when using the same hex file as already on the MCU no error occurs).
Flashing the hex file using the CubeProgrammer application (via J-LINK) works fine.
Also a full chip erase, so no write protection active.
My code:
CubeProgrammer::dfuDeviceInfo* dfu_list = nullptr;
int count = CubeProgrammer::getDfuDeviceList(&dfu_list, 0xdf11, 0x0483);
CubeProgrammer::connectDfuBootloader(dfu_list[0].usbIndex);
int FirmwareStartAddress = 0x08000000;
unsigned int verify = 1; // verify download
unsigned int skip_erase = 0; // do not skip erase
CubeProgrammer::cubeProgrammerError result = static_cast<CubeProgrammer::cubeProgrammerError>(
CubeProgrammer::downloadFile(file_path, FirmwareStartAddress, skip_erase, verify, L""));
When skipping the verify I don't get an error but the old firmware is still on the MCU after a reboot.
Does anyone might have a guess what could cause the write to fail?
Thank you and best Regards,
Howard Roak
PS: In case I missed somthing in the option bytes:

