From saper@saper.info Wed Aug 4 16:27:10 2010 Return-Path: Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1085D1065675; Wed, 4 Aug 2010 16:27:10 +0000 (UTC) (envelope-from saper@saper.info) Received: from k.saper.info (smtp-out.saper.info [IPv6:2001:41d0:1:c823::1002]) by mx1.freebsd.org (Postfix) with ESMTP id 5EE4A8FC12; Wed, 4 Aug 2010 16:27:09 +0000 (UTC) Received: from k.saper.info (localhost [127.0.0.1]) by k.saper.info (8.14.4/8.14.4) with ESMTP id o74GR7xl095096 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 4 Aug 2010 16:27:07 GMT (envelope-from saper@saper.info) Received: (from uucp@localhost) by k.saper.info (8.14.4/8.14.4/Submit) with UUCP id o74GR7cF095095; Wed, 4 Aug 2010 16:27:07 GMT (envelope-from saper@saper.info) Received: from radziecki.saper.info (localhost [127.0.0.1]) by radziecki.saper.info (8.14.3/8.14.3) with ESMTP id o74GQN5E098299 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 4 Aug 2010 16:26:23 GMT (envelope-from saper@saper.info) Received: (from saper@localhost) by radziecki.saper.info (8.14.3/8.14.3/Submit) id o74GQMDL098191; Wed, 4 Aug 2010 16:26:22 GMT (envelope-from saper) Message-Id: <201008041626.o74GQMDL098191@radziecki.saper.info> Date: Wed, 4 Aug 2010 16:26:22 GMT From: Marcin Cieslak Reply-To: Marcin Cieslak To: FreeBSD-gnats-submit@freebsd.org Cc: joerg@freebsd.org, freebsd-usb@freebsd.org Subject: avrdude unable to talk to Arduino board (via uftdi) X-Send-Pr-Version: 3.113 X-GNATS-Notify: >Number: 149283 >Category: usb >Synopsis: [uftdi] avrdude unable to talk to Arduino board (via uftdi) >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-usb >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Wed Aug 04 16:30:09 UTC 2010 >Closed-Date: >Last-Modified: Tue Aug 10 16:10:02 UTC 2010 >Originator: Marcin Cieslak >Release: FreeBSD 9.0-CURRENT amd64 >Organization: >Environment: System: FreeBSD radziecki.saper.info 9.0-CURRENT FreeBSD 9.0-CURRENT #5 r206987: Tue Apr 27 20:45:03 CEST 2010 saper@radziecki.saper.info:/usr/obj/usr/src/sys/VAIO amd64 avrdude-5.10 installed from ports, using default /usr/local/etc/avrdude.conf Arduino Duemilanove board with ATMega328 processor. Using Arduino USB interface, appearing as uftdi: # usbconfig -d ugen4.3 dump_device_desc ugen4.3: at usbus4, cfg=0 md=HOST spd=FULL (12Mbps) pwr=ON bLength = 0x0012 bDescriptorType = 0x0001 bcdUSB = 0x0200 bDeviceClass = 0x0000 bDeviceSubClass = 0x0000 bDeviceProtocol = 0x0000 bMaxPacketSize0 = 0x0008 idVendor = 0x0403 idProduct = 0x6001 bcdDevice = 0x0600 iManufacturer = 0x0001 iProduct = 0x0002 iSerialNumber = 0x0003 bNumConfigurations = 0x0001 # usbconfig -d ugen4.3 dump_all_config_desc ugen4.3: at usbus4, cfg=0 md=HOST spd=FULL (12Mbps) pwr=ON Configuration index 0 bLength = 0x0009 bDescriptorType = 0x0002 wTotalLength = 0x0020 bNumInterfaces = 0x0001 bConfigurationValue = 0x0001 iConfiguration = 0x0000 bmAttributes = 0x00a0 bMaxPower = 0x002d Interface 0 bLength = 0x0009 bDescriptorType = 0x0004 bInterfaceNumber = 0x0000 bAlternateSetting = 0x0000 bNumEndpoints = 0x0002 bInterfaceClass = 0x00ff bInterfaceSubClass = 0x00ff bInterfaceProtocol = 0x00ff iInterface = 0x0002 Endpoint 0 bLength = 0x0007 bDescriptorType = 0x0005 bEndpointAddress = 0x0081 bmAttributes = 0x0002 wMaxPacketSize = 0x0040 bInterval = 0x0000 bRefresh = 0x0000 bSynchAddress = 0x0000 Endpoint 1 bLength = 0x0007 bDescriptorType = 0x0005 bEndpointAddress = 0x0002 bmAttributes = 0x0002 wMaxPacketSize = 0x0040 bInterval = 0x0000 bRefresh = 0x0000 bSynchAddress = 0x0000 >Description: Any attempt to contact the board using avrdude fails. Checked with the same hardware (dual-boot) and Microsoft Vista (with arduino-0018 IDE) and the board can be contacted and programmed without any problems. Syslog with: hw.usb.ucom.debug: 15 hw.usb.uftdi.debug: 15 avrdude -c arduino -p m328p -P /dev/cuaU0 Aug 4 18:10:04 radziecki saper: Connecting board Aug 4 18:10:07 radziecki kernel: ugen4.3: at usbus4 Aug 4 18:10:07 radziecki kernel: uftdi0: on usbus4 Aug 4 18:10:07 radziecki kernel: uftdi_attach: Aug 4 18:10:07 radziecki kernel: ucom_attach_tty: tp = 0xffffff0003cd8400, unit = 0 Aug 4 18:10:07 radziecki kernel: ucom_attach_tty: ttycreate: U0 Aug 4 18:10:07 radziecki kernel: ucom_open: tp = 0xffffff0003cd8400 Aug 4 18:10:07 radziecki kernel: ucom_dtr: onoff = 1 Aug 4 18:10:07 radziecki kernel: ucom_line_state: on=0x01, off=0x00 Aug 4 18:10:07 radziecki kernel: ucom_rts: onoff = 1 Aug 4 18:10:07 radziecki kernel: ucom_line_state: on=0x02, off=0x00 Aug 4 18:10:07 radziecki kernel: ucom_ring: onoff = 0 Aug 4 18:10:07 radziecki kernel: ucom_line_state: on=0x00, off=0x08 Aug 4 18:10:07 radziecki kernel: ucom_break: onoff = 0 Aug 4 18:10:07 radziecki kernel: ucom_line_state: on=0x00, off=0x04 Aug 4 18:10:07 radziecki kernel: ucom_param: sc = 0xffffff0003cd9458 Aug 4 18:10:07 radziecki kernel: uftdi_pre_param: Aug 4 18:10:07 radziecki kernel: ucom_cfg_open: Aug 4 18:10:07 radziecki kernel: uftdi_cfg_open: uftdi_cfg_param: Aug 4 18:10:46 radziecki saper: Starting avrdude Aug 4 18:10:48 radziecki kernel: ucom_param: sc = 0xffffff0003cd9458 Aug 4 18:10:48 radziecki kernel: uftdi_pre_param: Aug 4 18:10:48 radziecki kernel: ucom_dtr: onoff = 1 Aug 4 18:10:48 radziecki kernel: ucom_line_state: on=0x01, off=0x00 Aug 4 18:10:48 radziecki kernel: ucom_rts: onoff = 1 Aug 4 18:10:48 radziecki kernel: ucom_line_state: on=0x02, off=0x00 Aug 4 18:10:48 radziecki kernel: uftdi_cfg_param: Aug 4 18:10:48 radziecki kernel: ucom_ioctl: cmd = 0x402c7413 Aug 4 18:10:48 radziecki kernel: ucom_ioctl: cmd = 0x402c7413 Aug 4 18:10:48 radziecki kernel: ucom_ioctl: cmd = 0x802c7414 Aug 4 18:10:48 radziecki kernel: ucom_param: sc = 0xffffff0003cd9458 Aug 4 18:10:48 radziecki kernel: uftdi_pre_param: Aug 4 18:10:48 radziecki kernel: ucom_ioctl: cmd = 0x8004667e Aug 4 18:10:48 radziecki kernel: ucom_ioctl: cmd = 0x8004667d Aug 4 18:10:48 radziecki kernel: ucom_ioctl: cmd = 0x4004746a Aug 4 18:10:48 radziecki kernel: ucom_ioctl: cmd = 0x8004746d Aug 4 18:10:48 radziecki kernel: ucom_dtr: onoff = 1 Aug 4 18:10:48 radziecki kernel: ucom_line_state: on=0x01, off=0x00 Aug 4 18:10:48 radziecki kernel: ucom_rts: onoff = 1 Aug 4 18:10:48 radziecki kernel: ucom_line_state: on=0x02, off=0x00 Aug 4 18:10:48 radziecki kernel: ucom_ioctl: cmd = 0x4004746a Aug 4 18:10:48 radziecki kernel: ucom_ioctl: cmd = 0x8004746d Aug 4 18:10:48 radziecki kernel: ucom_dtr: onoff = 0 Aug 4 18:10:48 radziecki kernel: ucom_line_state: on=0x00, off=0x01 Aug 4 18:10:48 radziecki kernel: ucom_rts: onoff = 0 Aug 4 18:10:48 radziecki kernel: ucom_line_state: on=0x00, off=0x02 Aug 4 18:10:48 radziecki kernel: uftdi_cfg_param: Aug 4 18:10:48 radziecki kernel: ucom_outwakeup: sc = 0xffffff0003cd9458 Aug 4 18:10:48 radziecki last message repeated 2 times Aug 4 18:10:53 radziecki kernel: ucom_ioctl: cmd = 0x4004746a Aug 4 18:10:53 radziecki kernel: ucom_ioctl: cmd = 0x8004746d Aug 4 18:10:53 radziecki kernel: ucom_dtr: onoff = 1 Aug 4 18:10:53 radziecki kernel: ucom_line_state: on=0x01, off=0x00 Aug 4 18:10:53 radziecki kernel: ucom_rts: onoff = 1 Aug 4 18:10:53 radziecki kernel: ucom_line_state: on=0x02, off=0x00 Aug 4 18:10:53 radziecki kernel: ucom_ioctl: cmd = 0x802c7415 Aug 4 18:10:53 radziecki kernel: ucom_outwakeup: sc = 0xffffff0003cd9458 Aug 4 18:10:56 radziecki saper: avrdude timeout Aug 4 18:11:18 radziecki saper: Sending INTR to avrdude Aug 4 18:11:19 radziecki kernel: ucom_outwakeup: sc = 0xffffff0003cd9458 Aug 4 18:11:23 radziecki kernel: ucom_close: tp=0xffffff0003cd8400 Aug 4 18:11:23 radziecki kernel: ucom_shutdown: Aug 4 18:11:23 radziecki kernel: ucom_cfg_close: Aug 4 18:11:33 radziecki saper: avrdude ended Aug 4 18:11:41 radziecki saper: Disconnecting board Aug 4 18:11:44 radziecki kernel: ugen4.3: at usbus4 (disconnected) Aug 4 18:11:44 radziecki kernel: uftdi0: at uhub5, port 3, addr 3 (disconnected) Aug 4 18:11:44 radziecki kernel: ucom_detach_tty: sc = 0xffffff0003cd9458, tp = 0xffffff0003cd8400 Aug 4 18:11:44 radziecki kernel: ucom_close: tp=0xffffff0003cd8400 Aug 4 18:11:44 radziecki kernel: ucom_close: tp=0xffffff0003cd8400 already closed Aug 4 18:11:44 radziecki kernel: ucom_close: tp=0xffffff0003cd8400 Aug 4 18:11:44 radziecki kernel: ucom_close: tp=0xffffff0003cd8400 already closed Aug 4 18:11:55 radziecki saper: Board disconnected >How-To-Repeat: Use command: # avrdude -c arduino -p m328p -P /dev/cuaU0 -v avrdude: Version 5.10, compiled on Aug 3 2010 at 23:59:35 Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/ Copyright (c) 2007-2009 Joerg Wunsch System wide configuration file is "/usr/local/etc/avrdude.conf" User configuration file is "/root/.avrduderc" User configuration file does not exist or is not a regular file, skipping Using Port : /dev/cuaU0 Using Programmer : arduino avrdude: stk500_recv(): programmer is not responding At the time the timeout message comes out Arduino's bootloader LED blinks once indicating firmware restart. >Fix: >Release-Note: >Audit-Trail: Date: Wed, 4 Aug 2010 18:39:30 +0200 From: Hans Petter Selasky To: freebsd-usb@freebsd.org, Marcin Cieslak Subject: Re: avrdude unable to talk to Arduino board (via uftdi) Hi, What happens if you use "-P usb" ? --HPS Date: Wed, 4 Aug 2010 17:18:29 +0000 From: Marcin Cieslak To: Hans Petter Selasky Subject: Re: avrdude unable to talk to Arduino board (via uftdi) > What happens if you use "-P usb" ? # ldd /usr/local/bin/avrdude /usr/local/bin/avrdude: libusb.so.2 => /usr/lib/libusb.so.2 (0x80068e000) libm.so.5 => /lib/libm.so.5 (0x80079c000) libreadline.so.8 => /lib/libreadline.so.8 (0x8008bb000) libncurses.so.5.7 => /usr/local/lib/libncurses.so.5.7 (0x8009f7000) libncurses.so.8 => /lib/libncurses.so.8 (0x800b14000) libc.so.7 => /lib/libc.so.7 (0x800c5e000) libtinfo.so.5.7 => /usr/local/lib/libtinfo.so.5.7 (0x800e91000) # avrdude -c arduino -p m328p -P usb -v avrdude: Version 5.10, compiled on Aug 3 2010 at 23:59:35 Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/ Copyright (c) 2007-2009 Joerg Wunsch System wide configuration file is "/usr/local/etc/avrdude.conf" User configuration file is "/root/.avrduderc" User configuration file does not exist or is not a regular file, skipping Using Port : usb Using Programmer : arduino avrdude: ser_open(): can't open device "usb": No such file or directory --Marcin Date: Wed, 4 Aug 2010 20:33:46 +0200 From: Hans Petter Selasky To: Marcin Cieslak Subject: Re: avrdude unable to talk to Arduino board (via uftdi) I think you need to define one more parameter when using USB. -t stk600 --HPS Date: Wed, 4 Aug 2010 20:14:29 +0200 From: Joerg Wunsch To: Marcin Cieslak Subject: Re: avrdude unable to talk to Arduino board (via uftdi) As Marcin Cieslak wrote: > Checked with the same hardware (dual-boot) and Microsoft > Vista (with arduino-0018 IDE) and the board can be > contacted and programmed without any problems. Your check on Windows has been using a stock AVRDUDE (e.g., a WinAVR compilation), too? Or another tool? IIRC, the Arduino bootloader requires some special tricks in order to talk to it. I think AVRDUDE v5.10 still lacks that feature. Could you try the SVN version of AVRDUDE? (I don't see a GNATS ID in the subject. Has this been actually filed via send-pr?) -- cheers, J"org .-.-. --... ...-- -.. . DL8DTL http://www.sax.de/~joerg/ NIC: JW11-RIPE Never trust an operating system you don't have sources for. ;-) From: Marcin Cieslak To: Joerg Wunsch Cc: FreeBSD-gnats-submit@freebsd.org, freebsd-usb@freebsd.org Subject: Re: usb/149283: avrdude unable to talk to Arduino board (via uftdi) Date: Wed, 4 Aug 2010 20:21:32 +0000 On Wed, 4 Aug 2010, Joerg Wunsch wrote: > As Marcin Cieslak wrote: > >> Checked with the same hardware (dual-boot) and Microsoft >> Vista (with arduino-0018 IDE) and the board can be >> contacted and programmed without any problems. > > Your check on Windows has been using a stock AVRDUDE (e.g., a WinAVR > compilation), too? Or another tool? On Windows I have used arduino Java IDE. Arduino IDE distribution actually includes a whole WinAVR stack including avrdude.exe, but I didn't pay attention what is actually used. I will reboot to Windows now and check the commandline invocation. On FreeBSD arduino the Java IDE tries to use avrdude and fails the same was as from commandline. > IIRC, the Arduino bootloader requires some special tricks in order to > talk to it. I think AVRDUDE v5.10 still lacks that feature. Could > you try the SVN version of AVRDUDE? AVRDUDE is mentioned for example here http://www.arduino.cc/playground/FreeBSD/CLI as the tool to use. I have tried "-c arduino" or "-c stk500v1" with trunk and I get still the same affect as with 5.10 (Programmer timeout). What maybe important: TX/RX LED on the board don't react at all when trying to use avrdude (there is only a single blink on firmware LED - which means bootloader start). With Windows - TX/RX indicated clearly some activity. > (I don't see a GNATS ID in the subject. Has this been actually filed > via send-pr?) Hm, yes, sorry... You were copied on the original send-pr. --Marcin Date: Wed, 4 Aug 2010 21:07:37 +0200 From: Joerg Wunsch To: Hans Petter Selasky Subject: Re: avrdude unable to talk to Arduino board (via uftdi) As Hans Petter Selasky wrote: > I think you need to define one more parameter when using USB. The Arduino bootloader is /not/ an USB device from AVRDUDE's point of view. AVRDUDE wants to see it as a generic tty device (/dev/cua*). -- cheers, J"org .-.-. --... ...-- -.. . DL8DTL http://www.sax.de/~joerg/ NIC: JW11-RIPE Never trust an operating system you don't have sources for. ;-) Date: Wed, 4 Aug 2010 21:29:01 +0200 From: Hans Petter Selasky To: Joerg Wunsch Subject: Re: avrdude unable to talk to Arduino board (via uftdi) On Wednesday 04 August 2010 21:07:37 Joerg Wunsch wrote: > As Hans Petter Selasky wrote: > > I think you need to define one more parameter when using USB. > > The Arduino bootloader is /not/ an USB device from AVRDUDE's > point of view. AVRDUDE wants to see it as a generic tty device > (/dev/cua*). And what USB protocol is it running? If raw, then the ID should be added to the ugensa driver instead. --HPS Date: Wed, 4 Aug 2010 21:44:20 +0200 From: Joerg Wunsch To: Hans Petter Selasky Subject: Re: avrdude unable to talk to Arduino board (via uftdi) As Hans Petter Selasky wrote: > > AVRDUDE wants to see it as a generic tty device > > (/dev/cua*). > > And what USB protocol is it running? Whatever is hidden behind a /dev/cua*. ;-) I suppose it's CDC. AVRDUDE simply doesn't want to know that. Those programmers where AVRDUDE accepts a -P usb option are programmers where AVRDUDE talks directly to using an application-specific protocol. For all other programmers, the parameter to -P must be a device node under /dev. -- cheers, J"org .-.-. --... ...-- -.. . DL8DTL http://www.sax.de/~joerg/ NIC: JW11-RIPE Never trust an operating system you don't have sources for. ;-) From: Hans Petter Selasky To: freebsd-usb@freebsd.org Cc: Marcin Cieslak , Joerg Wunsch , FreeBSD-gnats-submit@freebsd.org Subject: Re: usb/149283: avrdude unable to talk to Arduino board (via uftdi) Date: Wed, 4 Aug 2010 22:53:39 +0200 On Wednesday 04 August 2010 22:21:32 Marcin Cieslak wrote: > On Wed, 4 Aug 2010, Joerg Wunsch wrote: > > As Marcin Cieslak wrote: > >> Checked with the same hardware (dual-boot) and Microsoft > >> Vista (with arduino-0018 IDE) and the board can be > >> contacted and programmed without any problems. > > > > Your check on Windows has been using a stock AVRDUDE (e.g., a WinAVR > > compilation), too? Or another tool? > > On Windows I have used arduino Java IDE. Arduino IDE distribution > actually includes a whole WinAVR stack including avrdude.exe, > but I didn't pay attention what is actually used. > I will reboot to Windows now and check the commandline invocation. > > On FreeBSD arduino the Java IDE tries to use avrdude and fails the same > was as from commandline. > > > IIRC, the Arduino bootloader requires some special tricks in order to > > talk to it. I think AVRDUDE v5.10 still lacks that feature. Could > > you try the SVN version of AVRDUDE? > > AVRDUDE is mentioned for example here > http://www.arduino.cc/playground/FreeBSD/CLI as the tool to use. > > I have tried "-c arduino" or "-c stk500v1" with trunk and I get still > the same affect as with 5.10 (Programmer timeout). > > What maybe important: TX/RX LED on the board don't react at all > when trying to use avrdude (there is only a single blink > on firmware LED - which means bootloader start). > > With Windows - TX/RX indicated clearly some activity. > > > (I don't see a GNATS ID in the subject. Has this been actually filed > > via send-pr?) > You can try to comment out: /* clear stall at first run */ mtx_lock(&sc->sc_mtx); usbd_xfer_set_stall(sc->sc_xfer[UFTDI_BULK_DT_WR]); usbd_xfer_set_stall(sc->sc_xfer[UFTDI_BULK_DT_RD]); mtx_unlock(&sc->sc_mtx); In uftdi_attach in sys/dev/usb/serial/uftdi.c. --HPS From: Marcin Cieslak To: Hans Petter Selasky Cc: freebsd-usb@freebsd.org, FreeBSD-gnats-submit@freebsd.org Subject: Re: usb/149283: avrdude unable to talk to Arduino board (via uftdi) Date: Thu, 5 Aug 2010 09:35:10 +0000 On Wed, 4 Aug 2010, Hans Petter Selasky wrote: > You can try to comment out: > > /* clear stall at first run */ > mtx_lock(&sc->sc_mtx); > usbd_xfer_set_stall(sc->sc_xfer[UFTDI_BULK_DT_WR]); > usbd_xfer_set_stall(sc->sc_xfer[UFTDI_BULK_DT_RD]); > mtx_unlock(&sc->sc_mtx); > > In uftdi_attach in sys/dev/usb/serial/uftdi.c. That did not fix it ... --Marcin Date: Wed, 4 Aug 2010 14:57:44 -0600 (MDT) From: Warren Block To: Marcin Cieslak Subject: Re: avrdude unable to talk to Arduino board (via uftdi) Steven Kreuzer and I had that type of problem when working on the devel/arduino port, but eventually ironed them out (AFAIK). If you install the port and set build.verbose=true and upload.verbose=true in ~/.arduino/preferences.txt, you should be able to see what options it uses. My hunch is a 19200 or 57600 baud rate, but I can't swear to that, and it's been some time since I tried it. From: Marcin Cieslak To: FreeBSD-gnats-submit@freebsd.org Cc: freebsd-usb@freebsd.org Subject: Re: usb/149283: avrdude unable to talk to Arduino board (via uftdi) Date: Tue, 10 Aug 2010 15:15:58 +0000 The problem got solved. I got: hw.usb.ucom.cons_unit=0 Resetting this value to -1 enabled the communication. The problem was because ucom_get_data() didn't fetch user-supplied data. Please close this PR. --Marcin >Unformatted: