Gentoo Archives: gentoo-user

From: Stefan Mark <mark@××××××××.de>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] USB device (ATtiny86 w. mcronucleus bootloader) not recognized ?
Date: Mon, 07 Aug 2017 16:11:22
Message-Id: 20170807181053.2032107b@vdhh-linux
In Reply to: Re: [gentoo-user] USB device (ATtiny86 w. mcronucleus bootloader) not recognized ? by tuxic@posteo.de
1 On Mon, 7 Aug 2017 17:44:31 +0200
2 tuxic@××××××.de wrote:
3
4 > On 08/07 11:29, Stefan Mark wrote:
5 > > On Sun, 6 Aug 2017 19:04:09 -0500
6 > > R0b0t1 <r030t1@×××××.com> wrote:
7 > >
8 > > > On Sun, Aug 6, 2017 at 11:50 AM, <tuxic@××××××.de> wrote:
9 > > > > When I plug in such a little board into my PC, demesg
10 > > > > reports:
11 > > > > [ 1429.834140] usb 7-4: new low-speed USB device number 15 using
12 > > > > ohci-pci [ 1429.965142] usb 7-4: device descriptor read/64,
13 > > > > error -62 [ 1430.203151] usb 7-4: device descriptor read/64,
14 > > > > error -62 [ 1430.438161] usb 7-4: new low-speed USB device
15 > > > > number 16 using ohci-pci [ 1430.569151] usb 7-4: device
16 > > > > descriptor read/64, error -62 [ 1430.803174] usb 7-4: device
17 > > > > descriptor read/64, error -62 [ 1431.038184] usb 7-4: new
18 > > > > low-speed USB device number 17 using ohci-pci [ 1431.456157]
19 > > > > usb 7-4: device not accepting address 17, error -62
20 > > > > [ 1431.582204] usb 7-4: new low-speed USB device number 18
21 > > > > using ohci-pci [ 1432.000209] usb 7-4: device not accepting
22 > > > > address 18, error -62 [ 1432.000244] usb usb7-port4: unable to
23 > > > > enumerate USB device
24 > > >
25 > > > >
26 > > > > My first thought was: The micronucleus bootloaed is missing or
27 > > > > is defective...
28 > > > >
29 > > > > But plugging in the board into my Android tablet (the tablet
30 > > > > runs Lollipop and is nothing special at all beside being
31 > > > > rooted) via an OTG cable and using lsusb after that, it shows
32 > > > > Bus 001 Device 003 ID 16d0:0753 MCS Digistump DigiSpark
33 > > > >
34 > > >
35 > > > What the dmesg output is saying is that your USB hardware has
36 > > > reported a communication error to the driver. It is my guess that
37 > > > the ATtiny85 is not meeting the timing requirements for USB.
38 > > >
39 > > > Looking at the board there does not seem to be a crystal
40 > > > oscillator which most people would consider necessary for doing
41 > > > USB communication. This is an oversight on DigiStump's part and
42 > > > it is very likely you will not be able to fix the communication
43 > > > issues. You should contact them and tell them that your computer
44 > > > will not recognize their device and that you suspect it is
45 > > > because the clock is too inaccurate.
46 > > >
47 > > > >
48 > > > > What can I do to make this Digispark being correctly recognized?
49 > > > >
50 > > > > Thank you VERY much for any help in advance!
51 > > > >
52 > > >
53 > > > Three things:
54 > > >
55 > > > 1) Return the one you bought and get a new one. The ATtiny85's
56 > > > internal oscillator might be at the end of the bell curve but
57 > > > within manufacturer tolerance, which isn't enough to produce a
58 > > > USB signal close enough to the specified frequency. Expect the
59 > > > seller to pay for return shipping.
60 > > >
61 > > > 2) You can calibrate the oscillator using instructions in this
62 > > > application note:
63 > > > http://www.atmel.com/Images/Atmel-2555-Internal-RC-Oscillator-Calibration-for-tinyAVR-and-megaAVR-Devices_ApplicationNote_AVR053.pdf.
64 > > > This process still might not get you close enough.
65 > > >
66 > > > 3) Add a crystal oscillator to the ATtiny85 and change its fuses
67 > > > to use the oscillator. You will need to recompile the firmware if
68 > > > the crystal is a different frequency from the internal oscillator.
69 > > >
70 > > > It might work on your phone and not your desktop because of
71 > > > differences in the USB hardware (your phone's serial decoder in
72 > > > the USB hardware performs clock recovery but your PC does not) or
73 > > > because there are multiple things on a USB hub in your PC and the
74 > > > ATtiny85 is less accurate than those already present devices.
75 > > > Admittedly I'm surprised it gets most of the way to registering
76 > > > as a device and then fails, but I don't think the problem is with
77 > > > the drivers or your kernel.
78 > > USB uses a variant of non-return-to-zero for clock synchronisation,
79 > > that should™ take care of timing issues.
80 > > Actually, using microcontrollers without crystal for soft-usb is
81 > > fairly common (i have a bunch myself). As far as i understand (but
82 > > im no expert), trouble usually arises more from the improvised
83 > > level shifters than timing issues.
84 > > Anyway, i neither think there is a driver problem, i had a fair bit
85 > > of the messages myself, usually fixed by fixing the level shifter.
86 >
87 >
88 > Level shifters? What level shifters??? ;)
89 Oh, i see. Then i have to correct me, it seems that your board runs on
90 3v3 anyway (Which means i did not know those, only ones that look much
91 alike). A level shifter wont be necessary then.