Saturday, March 2, 2019

Adafruit Gemma, Macbook and the dim red light

My partner recently picked up an Adafruit Gemma as an intro to Arduino and embedded. It has not gone according to plan - it turns out there's a known issue where on some systems the Gemma will fail to enter the bootloader properly. The green power light comes on, but the red light stays dimly and constantly lit. If the reset button is pressed it goes out for a moment then returns.

Trying to program it anyway results in an error like

avrdude: Error: Could not find USBtiny device (0x1781/0xc9f)

The issue seems to be somewhat intermittent, too. Occasionally it works on her Macbook Air. It always works 100% of the time on my Lenovo T460 (Linux). So there's something platform related...

Not a great intro. The Gemma doesn't behave like usual Ardiuno systems - it doesn't expose a USB serial port, for example - so answers are also thinner on the ground.

But I think we found something.

There are many reports of the issue on the Adafruit forums. The usual answer is some variant of "It's a problem with some USB 3 controllers, use a USB 2 hub".

Well, I used a USB 2 hub. Same issue.

... but. I got to thinking. I recall hearing about issues with USB spec compliance, Mac laptops, and strict limits on USB power delivery. What if it's refusing to properly power the part? So I tried plugging it straight into a power-only USB charger. Bing, lights, action. OK. What about giving the USB hub its optional auxillary power?

Well, the Gemma works normally if the hub isn't plugged into the Macbook Air at the time the Gemma is plugged into the hub, so the hub is only acting as a power source via its auxillary power socket. If the Macbook Air is plugged into the hub then the Gemma is plugged in ... dim red light, no go.

So the issue is probably not USB power delivery. It's something that OS X or the lower level USB implementation on the hardware/firmware of the Macbook Air is sending to the Gemma at USB attach time.

The workaround appears to be to plug the Gemma into the hub, reset it to put it in bootloader mode, then plug the hub into the Macbook Air. It's a ridiculous dance, but it seems to work.

I imagine this applies to other USBtiny systems

No comments:

Post a Comment

Captchas suck. Bots suck more. Sorry.