I have the following issue: when I try to flash firmware over SPI Bootloader and send data by command 0x31U (Write Memory) then read data by 0x11U (Read Memory) I got corrupted data, some words still have 0xFFFFFFFF value.
Command "read memory" return the correct(real) data, I checked it by st-link directly. It is mean command "Write Memory" work incorrect.
If I try to write data and then verify it again, after ~15 attempts, finally, I am getting the correct result.
I implemented delay as provided in the documentation but this can't improve the situation.
Document DocID024458 Rev 4, AN4286, SPI protocol used in the STM32 bootloader
Note: In some operating conditions, the Master has to wait for a delay of 1 ms after receiving the
Acknowledge and before sending the data frame (number of bytes to be written, data to be
written and checksum).
Bootloader version: 0x11
Chip Id: 0x0462
Payload size: 256
SPI Clock = 1MHz
LSE is present,
HSE is absent
Power = 1V8
1. Sync word, wait for ack
2. Get version
3. Get Chip ID
4. Read the first page
5. Mass Erase if the first page not empty
6. Write 256 bytes
7. Read 256
9. Goto step6 if Verify failed.
10. Write next 256 bytes and verify and etc...
What do I wrong? Could you provide some advice?