patchAVR Downloader/UploaDEr - Patches: patch #7680, Fixing timeout problem in ser_recv...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

patch #7680: Fixing timeout problem in ser_recv in ser_win32.c

Submitter:  Rene Liebscher <rliebscher>
Submitted:  Tue 29 Nov 2011 08:10:15 PM UTC
   
 
Category:  None Priority:  5 - Normal
Status:  Ready For Test Privacy:  Public
Assigned to:  rliebscher Open/Closed:  Closed

Sat 17 Dec 2011 08:44:01 PM UTC, comment #2: 

Implemented in svn revision 1024

Rene Liebscher <rliebscher>
Group Member
Tue 13 Dec 2011 03:51:03 PM UTC, comment #1: 

Some measurements when using the bus pirate without a connected mcu (so it fails to initialize it and returns with error, but to do this it already send several commands to the bus pirate.)

  • original code:
    • binary mode : 0m20.329s
    • ascii mode : 4m11.766s


  • patched code:
    • binary mode : 0m1.156s
    • ascii mode : 0m3.547s



Command line for binary mode:

$ time ../avrdude -c buspirate -p m8 -P com7

Detecting BusPirate...
**
**  Bus Pirate v3b
**  Firmware v5.10 (r559)  Bootloader v4.4
**  DEVID:0x044F REVID:0x3043 (24FJ64GA002 B5)
**  http://dangerousprototypes.com
**
BusPirate: using BINARY mode
avrdude.exe: initialization failed, rc=-2
             Double check connections and try again, or use -F to override
             this check.


avrdude.exe done.  Thank you.


real    0m20.329s
user    0m0.015s
sys     0m0.046s


Command line for ascii mode:

$ time ../avrdude -c buspirate -p m8 -P com7 -x ascii

Detecting BusPirate...
**
**  Bus Pirate v3b
**  Firmware v5.10 (r559)  Bootloader v4.4
**  DEVID:0x044F REVID:0x3043 (24FJ64GA002 B5)
**  http://dangerousprototypes.com
**
BusPirate: using ASCII mode
BusPirate is now configured for SPI
avrdude.exe: initialization failed, rc=-2
             Double check connections and try again, or use -F to override
             this check.


avrdude.exe done.  Thank you.


real    4m11.766s
user    0m0.015s
sys     0m0.031s


Rene Liebscher <rliebscher>
Group Member
Tue 29 Nov 2011 08:10:15 PM UTC, original submission:  

The Windows code for ser_recv does not support a correct return value in case of a timeout. (It returns 0.) The other code in ser_posix.c returns -1 in this case.
This patch just returns -1 at timeout.

Without this patch you need with a bus pirate as programmer every time when it waits for the prompt about 10s (in buspirate_readline_noexit(), 4 characters read and 95 times the timeout of 100ms to fill the complete buffer, as it does not recognize the timeout without this patch).

PS: May be it would be better to change the return code of ser_recv to return the number of read bytes. Currently you can not know how many bytes are really read by the function.



Rene Liebscher <rliebscher>
Group Member

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attached Files
file #24503:  ser_win32.patch added by rliebscher (399B - application/octet-stream)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by rliebscher (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    Follow 6 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2013-09-03 rliebscher Open/ClosedOpen Closed
    2011-12-29 rliebscher StatusNone Ready For Test
        Open/ClosedClosed Open
    2011-12-17 rliebscher Assigned toNone rliebscher
        Open/ClosedOpen Closed
    2011-11-29 rliebscher Attached File- Added ser_win32.patch, #24503

    Back to the top

    Powered by Savane 3.13-3230.
    Corresponding source code