Problem with trinket , usbtiny device on ubuntu

For other supported Arduino products from Adafruit: Shields, accessories, etc.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
User avatar
sys_spud
 
Posts: 23
Joined: Sun Aug 31, 2008 9:34 pm

Re: Problem with trinket , usbtiny device on ubuntu

Post by sys_spud »

Do you have anything connected to pins 3 and 4? That can throw a wrench into the USB communication.
Sorry about long time responding. Nothing on pins 3/4. I learned from the Trinket Audio Player about that problem and made sure nothing was connected to 3/4 in testing.

Could the bootloader be corrupted? I could give reloading it a try...

UPDATE:
1) Reflashed bootloader - OK
2) Uploaded trinket blink example - OK
3) Disconnect trinket; reconnect - OK
4) Reload problem program (either Trinket Audio Player or Trinket Volume Control) - OK
5) Disconnect/Reconnect - FAIL to enumerate as USB device

Here's the dmesg:

Code: Select all

[15938.728765] cdc_acm 2-1.3.4.4:1.0: ttyACM0: USB ACM device  ===> Arduino UNO used as ISP programmer
[15979.268570] usb 2-1.3.4.4: USB disconnect, device number 116  ===> Bootloader uploaded to Trinket, disconnect Uno
[15985.094420] usb 2-1.3.3: new low-speed USB device number 117 using ehci_hcd ===> Trinket recognized
[16109.012350] usb 2-1.3.3: USB disconnect, device number 117
[16109.468446] usb 2-1.3.3: new low-speed USB device number 118 using ehci_hcd ===> Load Trinket Blink
[16162.240833] usb 2-1.3.3: USB disconnect, device number 118
[16166.789076] usb 2-1.3.3: new low-speed USB device number 119 using ehci_hcd  ====> Load Audio Player or Volume Control Sketch
[15868.961396] usb 2-1.3.3: device not accepting address 115, error -32  ===> After disconnecting/reconnecting with problem sketch loaded
[15868.961747] hub 2-1.3:1.0: unable to enumerate USB device on port 3

User avatar
adafruit_support_mike
 
Posts: 67454
Joined: Thu Feb 11, 2010 2:51 pm

Re: Problem with trinket , usbtiny device on ubuntu

Post by adafruit_support_mike »

Hmm... that retrograde device number for the failure caught my eye. The sequence goes 116 (works), 117 (works), 118 (works), 119 (works), 115 (fails). That strikes me a suspicious, but I don't know enough about the internals of the Ubuntu USB stack to say whether that's normal or not.

Searching for an answer led me to this thread though: http://ubuntuforums.org/showthread.php?t=1610142 . The speculation there is that there's some kind of setting that gets held while the USB port has power, so the solution is to shut the computer down, unplug it for about five minutes so stray charges can dissipate, then replug and try again.

I have no idea whether that will work for you, but it isn't hard to try.

User avatar
sys_spud
 
Posts: 23
Joined: Sun Aug 31, 2008 9:34 pm

Re: Problem with trinket , usbtiny device on ubuntu

Post by sys_spud »

adafruit_support_mike wrote:Hmm... that retrograde device number for the failure caught my eye. The sequence goes 116 (works), 117 (works), 118 (works), 119 (works), 115 (fails). That strikes me a suspicious, but I don't know enough about the internals of the Ubuntu USB stack to say whether that's normal or not.

Searching for an answer led me to this thread though: http://ubuntuforums.org/showthread.php?t=1610142 . The speculation there is that there's some kind of setting that gets held while the USB port has power, so the solution is to shut the computer down, unplug it for about five minutes so stray charges can dissipate, then replug and try again.

I have no idea whether that will work for you, but it isn't hard to try.
Mike-

Yeah, you're right on the retrograde sequence. Apologies, I think that was a copying error on my part. Here's another set, don't see the retrograde:

Code: Select all

[ 9582.248727] usb 2-1.3: device descriptor read/64, error -32
[ 9582.424666] usb 2-1.3: device descriptor read/64, error -32
[ 9582.600440] usb 2-1.3: new low-speed USB device number 44 using ehci_hcd
[ 9582.672595] usb 2-1.3: device descriptor read/64, error -32
[ 9582.848533] usb 2-1.3: device descriptor read/64, error -32
[ 9583.024458] usb 2-1.3: new low-speed USB device number 45 using ehci_hcd
[ 9583.432129] usb 2-1.3: device not accepting address 45, error -32
[ 9583.504270] usb 2-1.3: new low-speed USB device number 46 using ehci_hcd
[ 9583.911968] usb 2-1.3: device not accepting address 46, error -32
[ 9583.912150] hub 2-1:1.0: unable to enumerate USB device on port 3
Sadly, the power off/ pull the plug/ wait/ power up sequence had the same results.

Also, in the Verify/Upload for the Trinket Volume Control sketch, I'm seeing warning errors as below. Is this to be expected?
Thanks for your help!

Code: Select all

In file included from  /Arduino/sketchbook-1/libraries/TrinketHidCombo/usbdrvasm_includer.S:24:
 /Arduino/sketchbook-1/libraries/TrinketHidCombo/usbdrv/usbdrvasm.S:17:1: 
warning: "__SFR_OFFSET" redefined           <===========
In file included from  /Arduino/arduino-1.0.3/hardware/tools/avr/bin/../lib/gcc/avr/4.3.2/../../../avr/include/avr/io.h:99,
                 from  /Arduino/sketchbook-1/libraries/TrinketHidCombo/cmdline_defs.h:26,
                 from  /Arduino/sketchbook-1/libraries/TrinketHidCombo/usbdrvasm_includer.S:22:
 /Arduino/arduino-1.0.3/hardware/tools/avr/bin/../lib/gcc/avr/4.3.2/../../../avr/include/avr/sfr_defs.h:141:1: 
warning: this is the location of the previous definition       <===========
Binary sketch size: 3,868 bytes (of a 5,310 byte maximum)

User avatar
adafruit_support_mike
 
Posts: 67454
Joined: Thu Feb 11, 2010 2:51 pm

Re: Problem with trinket , usbtiny device on ubuntu

Post by adafruit_support_mike »

Well, the power thing was worth a shot.

WRT the compiler warnings, I don't think those are normal, but I'll need to check. The USB code contains much deep wizardry.

User avatar
frank26080115
 
Posts: 126
Joined: Fri Jun 15, 2007 1:04 am

Re: Problem with trinket , usbtiny device on ubuntu

Post by frank26080115 »

ignore the compiler warnings, they mean exactly what they say, a symbol was defined twice but defined as the same thing, it's harmless

I am wondering if you can get a dump of the USB traffic using usbmon. It might help, although I am skeptical since it seems like it's failing enumeration. To use usbmon, try following the instructions here: http://dan3lmi.blogspot.ca/2012/10/snif ... erent.html (a raw text dump will work, you don't really need Wireshark)

User avatar
sys_spud
 
Posts: 23
Joined: Sun Aug 31, 2008 9:34 pm

Re: Problem with trinket , usbtiny device on ubuntu

Post by sys_spud »

frank26080115 wrote:ignore the compiler warnings, they mean exactly what they say, a symbol was defined twice but defined as the same thing, it's harmless

I am wondering if you can get a dump of the USB traffic using usbmon. It might help, although I am skeptical since it seems like it's failing enumeration. To use usbmon, try following the instructions here: http://dan3lmi.blogspot.ca/2012/10/snif ... erent.html (a raw text dump will work, you don't really need Wireshark)
Hi Frank-

Forgive me if I make any bad assumptions. I'm just trying to explain what
I think I am seeing.

I finally got the code from the blog http://dan3lmi.blogspot.ca/ working.
Unfortunately, the code shows a device object when the bootloader is active,
but returns "None" once the hand off from the bootloader to the loaded sketch
is made. I think this code is for debugging misbehaving USB devices that at
least id themselves. The problem in this case seems to be the Trinket is not
id'ing itself properly.

I'll attach the Wireshark capture here. I've exported it in plain text which
seems to capture expanded packet information, so perhaps the same info you
were trying to get with the blog post code.

I do see:

"64 GET DESCRIPTOR Response STRING[Malformed Packet]"

in the log at Time 94 14.284303. This may be related to the error message in dmesg:

device descriptor read/64, error -32

To recap the problem, since this thread is getting long:
1) Can get Trinket Blink to work, LED is blinking
2) Any V-USB sketch (eg. Trinket Volume Knob) will load but my system won't
mount it after the bootloader cycle. Bootloader mounts on my system fine.
3) Happens on Ubuntu 10.04LTS 64 bit; Ubuntu 12.04 LTS 64 bit; 12.04 32 bit;
Mac OS/X Lion; Windows 7 Home Premium 64 bit.
4) Can reload Trinket Blink after that, LED is blinking

This may sound elementary, but my assumption is that a V-USB sketch needs to
mount the device on the system to work, correct? I mean, there's no magic
here where it doesn't mount but the system will recognize it as an HID device?

I have several 5V Trinkets. If the WireShark log doesn't help, I can send one
of my Trinkets with the Volume Knob sketch on it back to you at adafruit.

Thanks for all the adafruit help on this.
trinket_wireshark_log.txt
(335.99 KiB) Downloaded 98 times

User avatar
frank26080115
 
Posts: 126
Joined: Fri Jun 15, 2007 1:04 am

Re: Problem with trinket , usbtiny device on ubuntu

Post by frank26080115 »

Thanks for the log, your system made a get descriptor request to string descriptor index 0xEE, with an expected length of 1024 bytes. The Trinket replied back with a malformed packet.

That request is extremely odd, if 0xEE is the LANGID, it's not listed in the official list. The length of the request is simply too long to be normal.

I will take a look at why Ubuntu is sending this.

Djhg2000
 
Posts: 1
Joined: Thu Oct 31, 2013 6:36 pm

Re: Problem with trinket , usbtiny device on ubuntu

Post by Djhg2000 »

I'm having the same exact issue on Debian Jessie (updated today). The strange thing is that I get different errors depending on which USB controller I connect it to:

USB 2.0 port (starting with packet 39 in attached Wireshark dump):

Code: Select all

[30408.182266] usb 3-1.2: new low-speed USB device number 8 using ehci-pci
[30408.283133] usb 3-1.2: New USB device found, idVendor=1781, idProduct=0c9f
[30408.283140] usb 3-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[30408.283145] usb 3-1.2: Product: Trinket
[30408.283147] usb 3-1.2: Manufacturer: Adafruit
[30419.518054] usb 3-1.2: USB disconnect, device number 8
[30419.971942] usb 3-1.2: new low-speed USB device number 9 using ehci-pci
[30420.043885] usb 3-1.2: device descriptor read/64, error -32
[30420.220077] usb 3-1.2: device descriptor read/64, error -32
[30420.396482] usb 3-1.2: new low-speed USB device number 10 using ehci-pci
[30420.468396] usb 3-1.2: device descriptor read/64, error -32
[30420.644555] usb 3-1.2: device descriptor read/64, error -32
[30420.820775] usb 3-1.2: new low-speed USB device number 11 using ehci-pci
[30421.229105] usb 3-1.2: device not accepting address 11, error -32
[30421.301346] usb 3-1.2: new low-speed USB device number 12 using ehci-pci
[30421.709610] usb 3-1.2: device not accepting address 12, error -32
[30421.713653] hub 3-1:1.0: unable to enumerate USB device on port 2
USB 3.0 port (starting with packet 5 in attached Wireshark dump):

Code: Select all

[30758.005336] usb 1-1: new low-speed USB device number 24 using xhci_hcd
[30758.032965] usb 1-1: New USB device found, idVendor=1781, idProduct=0c9f
[30758.032969] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[30758.032971] usb 1-1: Product: Trinket
[30758.032972] usb 1-1: Manufacturer: Adafruit
[30769.322453] usb 1-1: USB disconnect, device number 24
[30769.818757] usb 1-1: new low-speed USB device number 25 using xhci_hcd
[30769.819246] usb 1-1: Device not responding to set address.
[30770.023536] usb 1-1: Device not responding to set address.
[30770.227235] usb 1-1: device not accepting address 25, error -71
[30770.339417] usb 1-1: new low-speed USB device number 26 using xhci_hcd
[30770.339930] usb 1-1: Device not responding to set address.
[30770.544159] usb 1-1: Device not responding to set address.
[30770.747798] usb 1-1: device not accepting address 26, error -71
[30770.859993] usb 1-1: new low-speed USB device number 27 using xhci_hcd
[30770.860535] usb 1-1: Device not responding to set address.
[30771.064752] usb 1-1: Device not responding to set address.
[30771.268451] usb 1-1: device not accepting address 27, error -71
[30771.380583] usb 1-1: new low-speed USB device number 28 using xhci_hcd
[30771.381124] usb 1-1: Device not responding to set address.
[30771.585363] usb 1-1: Device not responding to set address.
[30771.789055] usb 1-1: device not accepting address 28, error -71
[30771.789085] hub 1-0:1.0: unable to enumerate USB device on port 1
The code being run on the Trinket (5V version) is pretty simple:

Code: Select all

#include <TrinketKeyboard.h>

uint8_t ledStates;

void setup()
{
  pinMode(1, OUTPUT);
  digitalWrite(1, HIGH);

  TrinketKeyboard.begin();

  digitalWrite(1, LOW);
}

void loop()
{
  TrinketKeyboard.poll();
  ledStates = TrinketKeyboard.getLEDstate();

  digitalWrite(1, (ledStates & KB_LED_CAPS));
}
Using any of the example sketches yields the same result.

I'm sorry for the wall of text but I wanted to give as much help as possible in debugging this.
Attachments
trinketkeyboard USB3.txt
Connected to USB 3.0 port (rename extension to .pcapng)
(13.12 KiB) Downloaded 103 times
trinketkeyboard USB2.txt
Connected to USB 2.0 port (rename extension to .pcapng)
(20.95 KiB) Downloaded 128 times

User avatar
adafruit_support_mike
 
Posts: 67454
Joined: Thu Feb 11, 2010 2:51 pm

Re: Problem with trinket , usbtiny device on ubuntu

Post by adafruit_support_mike »

There seems to be something in the Linux USB stack that doesn't like the minimal USB interface built into the Trinket bootloader.

Any fix would involve changes to the main Linux codebase, and that's a big deal for something as important as USB. Our little device isn't important enough to risk breaking all the other devices out there, so for now, we officially don't support the Trinket on Linux.

User avatar
sys_spud
 
Posts: 23
Joined: Sun Aug 31, 2008 9:34 pm

Re: Problem with trinket , usbtiny device on ubuntu

Post by sys_spud »

Slightly OT here, but I think it's helpful.

If you're really committed to making a volume control knob, get the Leonardo that adafruit stocks (http://www.adafruit.com/products/849. Use the code as indicated on the Stefan Jones blog: http://stefanjones.ca/blog/arduino-leon ... edia-keys/. I ran this on a Leonardo clone (LeoStick) with changes for a rotary encoder and it works on: Windows 7 64 bit Home Premium and Windows XP (after installing LeoStick Drivers); Mac OS/X 10.7.5 (and, presumably above); Ubuntu 12.0.4 LTS 64 bit.

Hope this helps...

User avatar
phermansson
 
Posts: 1
Joined: Sun Apr 20, 2014 1:38 am

Re: Problem with trinket , usbtiny device on ubuntu

Post by phermansson »

I've been working a bit with Linux and V-usb, I think thats the source of the Trinkets USB code. With V-usb and Linux you also see a lot of theese errors, like those in this thread. Indeed it seems like a Linux USB bug that hasn't got fixed in years.
A work-around I found is connecting the device through a USB hub. I just had trouble with my Trinket and found this thread. Remembered the "hub trick", connected the Trinket to a hub and voilá, it works! So connect your Trinkets to a hub if it doesn't work with Linux. It can also help to reset manually before uploading.

User avatar
fnorkn
 
Posts: 1
Joined: Fri Apr 29, 2016 3:55 pm

Re: Problem with trinket , usbtiny device on ubuntu

Post by fnorkn »

I had the same error on ubuntu linux (broken pipe error). It was working ok on an Arduino Uno, but when I hooked it up to a huge Ultimaker board (atmega2560) the error came up.

The AVR pocket programmer was connected to the PC front usb port.

When I switched the usb cable to the BACK of the PC, the problem went away....

It seems indeed that you should not connect the AVR programmer to a USB hub (internal or external).

Hope this helps.

Locked
Please be positive and constructive with your questions and comments.

Return to “Other Arduino products from Adafruit”