bugAVR Downloader/UploaDEr - Bugs: bug #35208, avrdude 5.11 on freebsd 8.2-STABLE...

 
 

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

bug #35208: avrdude 5.11 on freebsd 8.2-STABLE does not reset Arduino Uno properly

Submitter:  None
Submitted:  Sun 01 Jan 2012 03:28:25 PM UTC
   
 
Category:  None Severity:  3 - Normal
Priority:  5 - Normal Item Group:  None
Status:  Fixed Privacy:  Public
Assigned to:  joerg_wunsch Originator Name:  bob frazier
Originator Email:  -email is unavailable- Open/Closed:  Closed
Release:  None Programmer hardware: 
Device type: 

Tue 10 Jan 2012 07:22:56 AM UTC, comment #5: 

Fixed in r1036.  Thanks for tracking this down to everyone!

Joerg Wunsch <joerg_wunsch>
Group administrator
Tue 03 Jan 2012 03:32:52 AM UTC, comment #4: 

I downloaded avrdude 5.11 and 5.11.1 source, and applied the [equivalent] patch to arduino.c in both versions and successfully tested them under Debian Linux (2.6.32-5-686 kernel), with Arduino 1.0 (compiled from source, modified installation to use compiled avrdude in lieu of the one that ships with the Arduino environment, verified by using 'verbose' upload option).  Subsequent regression test was unable to reproduce the original problem in Debian Linux i386, as with FreeBSD-7.2-STABLE.  However, neither of the avrdude versions had any problems running with the recommended change applied.

I do not currently have the ability to test avrdude properly with FreeBSD 9 but I do not see any reason why it would not work with the changes applied.


bob frazier <bombasticbob>
Tue 03 Jan 2012 03:22:14 AM UTC, comment #3: 

Thanks for looking into this!

I don't think there should be a problem with increasing the time between the '0' and '1' (pulling the line high and pulling the line low), but it would be good to test it with other boards and operating systems.

David A. Mellis <mellis>
Tue 03 Jan 2012 01:38:45 AM UTC, comment #2: 

I did some 'scope' work on the device and it appears you are correct, i.e. RTS+DTR set to 1 brings the digital line low rather than high.  As it turns out adding the extra '1' causes the Uno to reset where it had not been doing so before, but this may have been an anomoly.  What works even better is increasing the time delay between setting RTS+DTR to zero and setting RTS+DTR to 1 in the avrdude code.  I have added a patch that changes the delay time from 50msec to 250msec, and I have made repeated tests to make sure that the results are consistent.  The purpose of the increased time delay is based on what I discovered when I scoped the reset signal.  I was literally getting 2 signals, one in which the reset level was usually above 1V during the pulse, and a second one where the level dropped below 1V and (usually) caused a reset.  After applying the new patch, the Arduino Uno resets happen consistently and I don't get any more programming errors.

bob frazier <bombasticbob>
Mon 02 Jan 2012 07:13:13 PM UTC, comment #1: 

If I remember correctly, "setting" DTR and RTS actually lowers them to ground and "cleaning" them pulls the pins high.  Which means that the current avrdude code should pull the lines high and then low, triggering a reset.  Bob, did you check this on a scope or meter?  What'd you see?

If I'm right, then this patch could have the effect of generating two falling edges on some platforms, which might be problematic.  I'd rather it not be applied unless we can get more information about what's actually happening on the hardware and it can be tested on other operating systems.

David A. Mellis <mellis>
Sun 01 Jan 2012 03:28:25 PM UTC, original submission:  

in order to program the Arduino Uno there is code in arduino.c that sets the RTS+DTR lines to low, then high again.  Unfortunately in FreeBSD 8.2-STABLE the RTS and/or DTR lines may not be in a 'high' state prior to this.  To prevent this from becoming a problem, I recommend a simple patch that sets the RTS+DTR to a high state prior to going to low again and back to a high state.  The high to low transition is necessary to perform the reset properly, and the patch guarantees it will happen at the right time.  It should be pointed out that in earlier versions of FreeBSD (such as 7.2-STABLE), the libusb port was being used and this issue did not show up.  So it appears that the code was relying on both the RTS and DTR lines to be set high during a device open.  Since this is (apparently) no longer the case, or is not RELIABLY the case, adding the extra 2 lines of code ensures that the lines WILL be in a 'high' state before doing a reset.

related information (and patch) in FreeBSD bug report:
http://www.freebsd.org/cgi/query-pr.cgi?pr=163749

Anonymous

 

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

Attached Files
file #24728:  patch-arduino.c added by bombasticbob (442B - text/x-c - updated patch increases 'discharge' time in lieu of adding pre-'1' state on RTS and DTR)
file #24717:  patch-arduino.c added by None (564B - text/x-c - recommended patch for arduino.c applied to FreeBSD port)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by joerg_wunsch (Posted a comment)
  • -email is unavailable- added by bombasticbob (Updated the item)
  • -email is unavailable- added by mellis (Posted a comment)
  • -email is unavailable- added by None (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 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2012-01-10 joerg_wunsch StatusNone Fixed
        Assigned toNone joerg_wunsch
        Open/ClosedOpen Closed
    2012-01-03 bombasticbob Attached File- Added patch-arduino.c, #24728
    2012-01-01 None Attached File- Added patch-arduino.c, #24717

    Back to the top

    Powered by Savane 3.14-f13d.
    Corresponding source code