AVR programming on 11-CURRENT
Jonathan Anderson
jonathan at FreeBSD.org
Mon Jan 11 13:25:18 UTC 2016
Good morning,
I'm attempting to program a Pololu 3pi AVR-based robot [1] using an
STK500v2-compatible programmer [2] on 11-CURRENT. I'm not having a lot
of success. I've seen a discussion from 2012 on this list [3], but that
seems to be a different issue: I'm using the same command lines that
apparently worked then with no success now.
I've tried using the same avrdude command line as I would use from a
Linux workstation, but with /dev/ttyACM0 replaced with /dev/cuaU0:
```
$ avrdude -p m328p -c stk500v2 -P /dev/cuaU0 -Uflash:w:assign0.hex:a
```
This command hangs indefinitely. When I enable more verbosity I see:
```
$ avrdude -vvvv -pm328p -c stk500v2 -P /dev/cuaU0 -t
avrdude: Version 6.1, compiled on Oct 24 2015 at 06:47:13
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2014 Joerg Wunsch
System wide configuration file is
"/usr/local/etc/avrdude.conf"
User configuration file is "/home/jon/.avrduderc"
User configuration file does not exist or is not a regular
file, skipping
Using Port : /dev/cuaU0
Using Programmer : stk500v2
avrdude: Send: . [1b] . [01] . [00] . [01] . [0e] . [01] . [14]
```
Using trace, I can confirm that the relevant bytes are being written to
the file descriptor, but then avrdude goes into a loop of `select()`'ing
the descriptor and reading 0 bytes:
```
8440 avrdude GIO fd 2 wrote 65 bytes
"avrdude: Send: . [1b] . [01] . [00] . [01] . [0e] . [01] . [14]
"
8440 avrdude RET write 65/0x41
8440 avrdude CALL write(0x3,0x7fffffffdad0,0x7)
8440 avrdude GIO fd 3 wrote 7 bytes
0x0000 1b01 0001 0e01 14 |.......|
8440 avrdude RET write 7
8440 avrdude CALL select(0x4,0x7fffffffdae8,0,0,0x7fffffffdb68)
8440 avrdude RET select 1
8440 avrdude CALL read(0x3,0x7fffffffdbef,0x1)
8440 avrdude GIO fd 3 read 0 bytes
""
8440 avrdude RET read 0
8440 avrdude CALL select(0x4,0x7fffffffdae8,0,0,0x7fffffffdb68)
8440 avrdude RET select 1
8440 avrdude CALL read(0x3,0x7fffffffdbef,0x1)
8440 avrdude GIO fd 3 read 0 bytes
""
```
For reference, here is my dmesg output when I first plug in the
programmer:
```
ugen2.8: <Pololu Corporation> at usbus2
umodem0: <Pololu Corporation Pololu USB AVR Programmer, class 239/2, rev
2.00/1.07, addr 8> on usbus2
umodem0: data interface 1, has no CM over data, has no break
umodem1: <Pololu Corporation Pololu USB AVR Programmer, class 239/2, rev
2.00/1.07, addr 8> on usbus2
umodem1: data interface 3, has no CM over data, has no break
```
After I kill avrdude, the USB device disconnects and re-connects:
```
umodem0: at uhub5, port 3, addr 8 (disconnected)
umodem1: at uhub5, port 3, addr 8 (disconnected)
umodem0: <Pololu Corporation Pololu USB AVR Programmer, class 239/2, rev
2.00/1.07, addr 8> on usbus2
umodem0: data interface 1, has no CM over data, has no break
umodem1: <Pololu Corporation Pololu USB AVR Programmer, class 239/2, rev
2.00/1.07, addr 8> on usbus2
umodem1: data interface 3, has no CM over data, has no break
```
Any ideas what might be going wrong here? Does anybody use 11-CURRENT
with STK500v2-compatible programmers successfully?
Thanks,
Jon
[1] https://www.pololu.com/product/975
[2] https://www.pololu.com/product/1300
[3] http://comments.gmane.org/gmane.os.freebsd.questions/288334
--
Jonathan Anderson
jonathan at FreeBSD.org
More information about the freebsd-questions
mailing list