# USBtiny woes.



## je33 (Oct 2, 2012)

I've been trying to get an AVR USBtiny in circuit programmer running on my
	
	



```
FreeBSD tsunami.lan 9.1-PRERELEASE FreeBSD 9.1-PRERELEASE #0: Mon Sep 10 15:15:10 PDT 2012     root@tsunami.lan:/usr/obj/usr/src/sys/LOCAL  amd64
```
 box, without any luck. I've verified that all the USB serial drivers as well as ucom are loaded/compiled in. The kernel is actually a GENERIC config called from LOCAL config which just squashes debug symbols after GENERIC is read.

The relevant line from *usbconfig* reads:

```
ugen7.2: <USBtiny vendor 0x1781> at usbus7, cfg=0 md=HOST spd=LOW (1.5Mbps) pwr=ON
```

About the only thing I'm able to locate with Google is that Amtel's USBasp in circuit programmer works with FreeBSD however, no details supplied. Anyone want to share a success story and formula for the USBtiny? Or is USBtiny a dead end: Get the Amtel USBasp.


----------



## wblock@ (Oct 2, 2012)

I built a USBasp which works.  Please show what you have tried and what happens.


----------



## je33 (Oct 2, 2012)

Hi Warren: The upshot of the work to present consists of loading all the USB facilities/drivers from the command line to verrify that it get 
	
	



```
kldload: can't load uvscom: File exists
```
. Also, checked for creation of USB serial port /dev/cuaU0 with no joy.

When I `# grep 0x1781 /etc/devd/usb.conf` nothing is found.

*Lots* of searching and that's pretty much it.


----------



## wblock@ (Oct 3, 2012)

Back up a second.  What does this show:
`% usbconfig -d 1.2 dump_device_desc`

Replace the 1.2 with the address it gets in your system.


----------



## je33 (Oct 3, 2012)

I get this:
	
	



```
# usbconfig -d 7.2 dump_device_desc
ugen7.2: <USBtiny vendor 0x1781> at usbus7, cfg=0 md=HOST spd=LOW (1.5Mbps) pwr=ON

  bLength = 0x0012 
  bDescriptorType = 0x0001 
  bcdUSB = 0x0101 
  bDeviceClass = 0x00ff 
  bDeviceSubClass = 0x0000 
  bDeviceProtocol = 0x0000 
  bMaxPacketSize0 = 0x0008 
  idVendor = 0x1781 
  idProduct = 0x0c9f 
  bcdDevice = 0x0104 
  iManufacturer = 0x0000  <no string>
  iProduct = 0x0002  <USBtiny>
  iSerialNumber = 0x0000  <no string>
  bNumConfigurations = 0x0001
```


----------



## wblock@ (Oct 3, 2012)

According to /usr/share/misc/usbdevs, that vendor ID is "Metageek".  More importantly, the product ID is not present and would need to be added.

Software-wise, I'm not sure whether it needs a module that specifically recognizes it as a serial device.  If USBasp does, it's built into my kernel.

See the comments at https://www.sparkfun.com/products/9231? about making it work on non-Windows systems.  That's a different device, but based on the same design.


----------



## je33 (Oct 3, 2012)

As suggested in the SparkFun link you provided, I inserted a USB hub between the programmer and my box but, my box still did not create a /dev/cuaUx device.

However, I was able to get *avrdude* to talk to the programmer using it's usb address:
	
	



```
# avrdude -p m328P -P usb:7:2 -c usbtiny -vvvv

avrdude: Version 5.11, compiled on Jan 15 2012 at 13:12:25
         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"

         Using Port                    : usb:7:2
         Using Programmer              : usbtiny
avrdude: usbdev_open(): Found USBtinyISP, bus:device: /dev/usb:/dev/ugen7.2
avrdude: Error: Could not find USBtiny device (0x1781/0xc9f)

avrdude done.  Thank you.
```
Not sure what the error exactly means so I tried duplicating the usbtiny entry in /usr/local/etc/avrdude.conf and changing the programmer id to usbtinyisp. 
	
	



```
programmer
  id    = "usbtiny";
  desc  = "USBtiny simple USB programmer, http://www.ladyada.net/make/usbtinyisp/";
  type  = usbtiny;
;

programmer
  id    = "usbtinyisp";
  desc  = "USBtiny simple USB programmer, http://www.ladyada.net/make/usbtinyisp/";
  type  = usbtiny;
;
```
Which yielded:
	
	



```
# avrdude -p m328P -P usb:7:2 -c usbtinyisp -vvvv

avrdude: Version 5.11, compiled on Jan 15 2012 at 13:12:25
         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"

         Using Port                    : usb:7:2
         Using Programmer              : usbtinyisp
avrdude: usbdev_open(): Found USBtinyISP, bus:device: /dev/usb:/dev/ugen7.2
avrdude: Error: Could not find USBtiny device (0x1781/0xc9f)

avrdude done.  Thank you.
```
Same output from my initial test suggesting, to me, that there might be a protocol difference between the two programmers?


----------



## je33 (Oct 3, 2012)

Looks like I may have this whipped. Reading through the ladyada site I found a step by step procedure to flash the Arduino boot loader into one of the Arduino boards. Tried it and it works. It seems that my ~/.arduino/preferences.txt had *serial.port=* set to /dev/com1 deleting that and leaving an empty field solved the problem.

It's the fix I needed anyway since now I can flash to chip to test from Arduino IDE.

Thank for you interest and help with this Warren.


----------



## tingo (Oct 11, 2012)

Nice that you got it working.


----------

