2013-11-12 10:03 PM
Hi all,
I'm trying to test the system bootloader on an STM32F417 to download a .bin file into flash memory using the STM32F4G-EVAL board. After setting the boot pins as per AN2606 (BOOT0 = 1, BOOT1 = 0) I reset and can connect to the MCU using the ST flash loader demonstrator program over USART.I follow the procedure in the demonstrator manual (UM0462) and the download begins, but typically reports ''FAIL: Unable to download data'' after somewhere between 4-12KBytes of the download.I have tried removing read and write protection prior to the download, and manually erasing the flash first, but although those operations complete successfully, the download still fails after a few KB. I have tried with two different .bin files (both of which load fine using ST-Link) and also tried the .hex version just in case, but still no change. Dropping the Baud rate also has no effect (aside from slower transfer rate).The COM port and cable appear to work fine (I use them in my applications without problems).Can anyone suggest what might be causing this to fail mid-download and/or a possible resolution? Thanks in advance.2013-11-12 11:58 PM
I've generally found the system loader to be pretty robust in F1/F2/F4 applications where I have tried it. The STM32F4-DISCO has problems with USART1 PA9/10 due to a large bulk cap on the pins.
One would need to examine the failure at the protocol level and look to see what commands failed and the state of memory at the time. The loader expects even parity comms (8E1), it bench marks the 0x7F start character to auto-baud the interface, and the USART doesn't actually ''receive'' that character. If the timing up front is marginal, the transfer will be too. We have encountered a number of USB-to-Serial dongles which I'd call marginal, if you have an on-board serial port try that, and other dongles. Perhaps look at installing a serial port monitor app to see what traffic is going on at the failure point, or instrument the Flash Demonstrator code. Here I've been using our own implementation of the protocol. Often it's not the baud rate, but the stability of it, and whether the dongle uses a crystal, or not. Sending a constant 0x55 bytes, and a scope on persistence mode triggering on the start bit might be illustrative of such issues. As I spent some time the other week fighting a serial port problem, I might point out if you have a Prolific driver in Win7 64-bit dating from earlier this year you might want to update it, as the driver returns bad/corrupt data with very large transfers (MB). If you close and reopen the com port (CreateFile \\.\COM6 or whatever) the data comes back correctly, where as if the current channel is left open at some point the internal state goes arwy, causing much grief.2013-11-26 06:53 PM
Thanks Clive, very helpful as always. Indeed it was eventually tracked to a ''marginal'' USB-serial dongle: a cheap knock-off of a prolific chip which purports to be a prolific chip when enumerated but is in fact a rip-off. Unfortunately we had two such chips in two different dongles, so that even though I thought I had eliminated that as a possibility it was in fact still the problem. Trap for young players! New dongle and all is well. Thanks for the help!
Dave.2013-11-27 01:53 AM
Dave, thanks for closing out the thread with your resolution, glad to here you got it sorted out. -Clive