USB Voltage Sag

I received a couple of reports that Retro USB doesn’t work correctly with the Apple Aluminum Keyboard, model A1243 and its smaller sibling A1242. This is Apple’s standard wired USB keyboard, so it’s fairly common. The A1243 has an integrated hub with two USB ports for other devices. I don’t have one myself, but I was able to borrow an A1243 from a neighbor so I could take a look. What I found was not good.

During the USB enumeration process, there’s a huge voltage sag on the VUSB +5V supply. This is true whether VUSB is fed from the Macintosh’s ADB +5V supply, or from an external 5V supply. During USB enumeration, VUSB abruptly drops from 5V down to about 2.7V over a period of half a millisecond. Then it recovers, drops again, and repeats the process three or four times. Meanwhile the microcontroller starts reporting USB “bus turnaround” errors. Eventually the voltage bouncing stops after about 6 ms, but the keyboard never enumerates successfully.

At first I thought this was a simple problem: I just needed a bigger capacitor on VUSB. When the A1243 enumerates, it must switch on some internal power-hungry circuit that momentarily draws a lot of current, dragging down VUSB. The Retro USB board has a single 10 uF ceramic capacitor on the +5V USB supply. But when I tried larger capacitors up to 220 uF, they barely made a dent in the degree of voltage sag. With the 220 uF cap, the voltage sags bottomed out at 3.4V instead of 2.7V, but I still got lots of USB errors and failure to enumerate. 220 uF is already a jumbo-sized capacitor, and I can’t imagine fitting something even larger on the Retro USB PCB.

My second thought was to add an inline inductor between the VUSB supply and the USB connector. That would prevent too much current from being drawn all at once. I only had a single suitable inductor on on hand, with an uncertain value: the bag said 22uH, but the component was labeled 223 which I believe means 22mH. At any rate, it didn’t help much, and VUSB still sagged down to 3.2V while the keyboard failed to enumerate. With failures of both the capacitor and inductor techniques, I’m out of other ideas for ways I can minimize or eliminate this VUSB sag.

But wait, there’s more to this mystery. The A1243 actually enumerates OK, with no VUSB sag at all, if nothing is connected to its USB ports. It’s only when a mouse or a flash drive is connected to the A1243 that the big voltage sag occurs. And these same mice and flash drives don’t cause any voltage sag when they’re connected through a different unpowered hub. I’ve come to the conclusion that the A1243 contains a big capacitor that only gets charged during USB enumeration, and only if something is connected to one of its hub ports, so that the hub function is enabled.

I was sometimes able to get the A1243 with an attached mouse to enumerate successfully, if I powered the Retro USB board from an external 5V supply instead of the Macintosh ADB 5V supply. The same degree of voltage sag was still there, so I’m not even sure why it worked, and success seemed to depend on exactly which mouse I tried.

The A1243 also causes problems in other scenarios, even where no voltage sag is observed. It works OK when it’s connected through a separate unpowered hub. But if a mouse is also connected to that same hub, there’s no voltage sag, but there are large numbers of USB errors and none of the devices ever enumerate successfully.

There’s clearly something strange about the A1243’s power requirements, as evidenced by this Apple forum thread full of complaints. A hundred people all agree that their computer wasn’t recognizing their A1243 anymore, until they used the USB extension cable that’s bundled with the keyboard, then it magically began working again. A few people said a 3rd-party USB extension cable also solved their problems. It sounds bizarre, but if the extension cable is acting as a small source of additional inductance and capacitance, I could imagine it having a beneficial effect. However, when I tried using the extension cable with Retro USB and the A1243, the voltage sag was still just as bad and the problems remained.

If the A1243 weren’t such a common keyboard, I’d simply write it off as an unknown incompatibility. But given how common this keyboard is, I really want to find a way to make it work.


This post was originally published on this site.