From owner-freebsd-ports-bugs@FreeBSD.ORG Sun Jan 1 05:20:35 2012 Return-Path: Delivered-To: freebsd-ports-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C5A6D1065C42 for ; Sun, 1 Jan 2012 05:20:13 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 4F17B8FC1D for ; Sun, 1 Jan 2012 05:20:12 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.5/8.14.5) with ESMTP id q015KCpE061560 for ; Sun, 1 Jan 2012 05:20:12 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.5/8.14.5/Submit) id q015KCd7061559; Sun, 1 Jan 2012 05:20:12 GMT (envelope-from gnats) Resent-Date: Sun, 1 Jan 2012 05:20:12 GMT Resent-Message-Id: <201201010520.q015KCd7061559@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-ports-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, bob frazier Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C99501065680 for ; Sun, 1 Jan 2012 05:15:50 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22]) by mx1.freebsd.org (Postfix) with ESMTP id 9DEEE8FC15 for ; Sun, 1 Jan 2012 05:15:50 +0000 (UTC) Received: from red.freebsd.org (localhost [127.0.0.1]) by red.freebsd.org (8.14.4/8.14.4) with ESMTP id q015FojL073223 for ; Sun, 1 Jan 2012 05:15:50 GMT (envelope-from nobody@red.freebsd.org) Received: (from nobody@localhost) by red.freebsd.org (8.14.4/8.14.4/Submit) id q015Fogn073222; Sun, 1 Jan 2012 05:15:50 GMT (envelope-from nobody) Message-Id: <201201010515.q015Fogn073222@red.freebsd.org> Date: Sun, 1 Jan 2012 05:15:50 GMT From: bob frazier To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Cc: Subject: ports/163749: devel/avrdude fails to reset RTS/DTR properly for Arduino Uno in 8-STABLE/amd64 X-BeenThere: freebsd-ports-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Ports bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 01 Jan 2012 05:20:35 -0000 >Number: 163749 >Category: ports >Synopsis: devel/avrdude fails to reset RTS/DTR properly for Arduino Uno in 8-STABLE/amd64 >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sun Jan 01 05:20:11 UTC 2012 >Closed-Date: >Last-Modified: >Originator: bob frazier >Release: 8.2-STABLE amd64 >Organization: S.F.T. Inc. >Environment: FreeBSD hack.SFT.local 8.2-STABLE FreeBSD 8.2-STABLE #0: Wed Dec 28 03:04:48 PST 2011 root@hack.SFT.local:/usr/obj/usr/src/sys/GENERIC amd64 >Description: when attempting to program an Arduino Uno (using comms/uarduno driver) in 8.2-STABLE with the latest avrdude and Arduino 1.0 environment the Arduino Uno does not properly reset, resulting in an inability to program the device. This problem does NOT occur in 7.2 (which uses libusb), nor does it occur when I flash an 'arduino clone' board using a different board setting and driver. A patch to avrdude corrects the problem by setting the RTS/DTR lines high BEFORE setting them low, then back to high again. This guarantees a proper high to low transition that is apparently needed to discharge the reset capacitor properly. >How-To-Repeat: attempt to program an Arduino Uno using the Arduino 1.0 development environment >Fix: the patch file (attached) modifies arduino.c to force the RTS and DTR lines _HIGH_ before setting them to low (guaranteeing you get the high to low transition that is needed to discharge the reset capacitor). Otherwise the code appears to rely on the lines being set high on open. For some reason this problem did not occur in the earlier development environment, nor when the libusb port is being used (as it is on 7.2-STABLE) Patch attached with submission follows: --- arduino.c.orig 2011-12-31 21:00:47.000000000 -0800 +++ arduino.c 2011-12-31 21:01:09.000000000 -0800 @@ -88,10 +88,13 @@ strcpy(pgm->port, port); if (serial_open(port, pgm->baudrate? pgm->baudrate: 115200, &pgm->fd)==-1) { return -1; } + /* Set DTR and RTS to high before I do anything else (BBB mod) */ + serial_set_dtr_rts(&pgm->fd, 1); + usleep(50*1000); /* Clear DTR and RTS to unload the RESET capacitor * (for example in Arduino) */ serial_set_dtr_rts(&pgm->fd, 0); usleep(50*1000); /* Set DTR and RTS back to high */ >Release-Note: >Audit-Trail: >Unformatted: