cancel
Showing results for 
Search instead for 
Did you mean: 

Bootloader transfer takes double the time for chosen baud rate

rgrindall
Associate II
Posted on January 27, 2016 at 17:10

I have been using the STM32 Flashloader Demonstrator to read/write to/from an L151 MCU.  It takes 58 seconds to read 391168 bytes from the MCU flash @ 115200.  That is roughly twice what I would expect :

391168 x 9 (bits/byte) / 115200 = 30.56.  Other baud rates yield similar results.  I know there is overhead because each read can only do 255 bytes but doing the math it still doesn't account for this much difference.  Is each data byte sent with its complement (similar to the command itself) ?  It doesn't say it is in the AN3155 but I can't think of any other explanation for the transfer to take so long.  Thanks.
4 REPLIES 4
Posted on January 27, 2016 at 17:14

Did you count up the FLASH programming time?

[EDIT] Ah. *read*. Overlooked that, sorry. I don't have an answer, then.

JW
rgrindall
Associate II
Posted on January 27, 2016 at 17:19

This was actually an upload.  I have a programmed MCU that I am reading the reading the contents of the Flash from. 

pkumar1883
Associate II
Posted on January 28, 2016 at 15:15

Dear Edge,

There may be few reasons of extra time-

  • Total time should be equal to transfer time(30.56) plus read time(time taken by micro controller to read from flash).
  • Each byte transfer should consist of 10 bits(1Start Bit+8bit Data+1Stop bit=10bit), if not using any parity.
  • Your receiving utility  may impose some Time delay between two packets(Receiving and sending back acknowledgement)

rgrindall
Associate II
Posted on January 28, 2016 at 20:08

Thanks for your interest in my question. You're correct, I did not account for start and stop bits, but I did account for parity so if I change 9 to 11 bits/byte the time is 37.35 seconds. As I mentioned each read command can only transfer 255 bytes so it takes 1534 read commands from the host PC to transfer the data. The read command adds 11 bytes including acks back and forth for each request.  That adds 1.6 seconds. That brings the total to about 40 seconds leaving about 18 seconds for FLASH read time, MCU instruction cycles, and host PC processing time.  That seems high to me for that type of activity but as is being pointed out the little things add up.  If anyone notices a big chunk contributor that I'm missing, please share.  I appreciate your time and thoughts.  Thanks.