2017-05-23 02:18 AM
Hello everyone,
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 bewritten and checksum).Detail:
Bootloader version: 0x11
Chip Id: 0x0462Payload size: 256 HWSPI Clock = 1MHzLSE is present,
HSE is absentPower = 1V8
Command sequence:
1. Sync word, wait for ack2. Get version
3. Get Chip ID4. Read the first page5. Mass Erase if the first page not empty6. Write 256 bytes
7. Read 256
8. Verify
9. Goto step6 if Verify failed.
10. Write next 256 bytes and verify and etc...
What do I wrong? Could you provide some advice?BR,
Denis#system-memory #spi-bootloader #stm32l42017-05-25 06:17 AM
Thank you guys!)
I figured out the reason!The problem in VDDUSB, my circuit provide VDDUSB when USB is connected, otherwise VDDUSB = 0.I suppose USB error interrupts don't allow work correctly. I observed similar behavior in my application when USB was initialized but VDD = USB0,Workarounds:
1. USB is connected: Initialize SPI bootloader before will activate USB DFU.
2. USB is disconnected and VDDUSB = 0: You must have the possibility to pull up USBVDD pin. In my case, I have external_power signal on the second MCU connected toUSBVDD, and reinit pin to output, I do it shortly, after shortly high-level bootloader work correctly,
don't hesitate about level ~1V fix it problemMySTM32 SPI Bootloader Client here: