User avatar
impsnldavid
Posts: 1
Joined: Mon May 28, 2012 3:14 pm
Location: Edinburgh, UK
Contact: Website

Report: Apple Wired Keyboard Incompatible

Mon May 28, 2012 3:32 pm

For the benefit of new users, I thought I would post my experiences today when setting up my newly arrived pi. My conclusion at the end of today is that the Apple Wired Keyboard which I was using initially has problems working with the pi due to the excess power required by the two-port unpowered hub contained within the keyboard.

My first unsuccessful configuration was:
HDMI to TV
Apple iPhone USB adapter
Apple Wired Keyboard (with Numpad)
Standard Debian image

The result of this was the pi booting, showing a large number of errors in the process, then not responding to any key presses. Suspecting that this was due to a insufficient power supply, I measured the voltage across TP1 & 2 to be 4.88V with everything except the keyboard connected, and 4.74 when the keyboard was added. I tried this same configuration with an iPad USB adaptor but the result was the same, with similar voltages.

I then went to purchase a 5.2 volt USB adapter in the hope that this would provide sufficient voltage to power the keyboard and the pi. The voltage without the keyboard was now 4.9V and with the keyboard 4.8V. Unfortunately the result was the same. No response from any key presses.

I then borrowed a generic HP USB keyboard and tried again using the 5.2 volt adapter. This time, success. The voltage drops from 4.9V to around 4.89V when the keyboard is connecting, and the pi now responds to key presses.

Finally, I tested this new keyboard with the original iPhone power supply. With the generic keyboard connected, the voltage drop is barely detectable, flickering around 4.87V from a steady 4.88V without the keyboard.

I can't be totally sure that the keyboard's power requirements are the cause of the incompatibility, but it would make sense from the above data. I'd advise new users to avoid the Apple keyboards (as well designed as they are) or any other keyboard containing unpowered USB hubs.

User avatar
Grumpy Mike
Posts: 934
Joined: Sat Sep 10, 2011 7:49 pm
Location: Manchester (England England)
Contact: Website

Re: Report: Apple Wired Keyboard Incompatible

Mon May 28, 2012 4:32 pm

I had exactly the same problem
http://www.raspberrypi.org/phpBB3/viewt ... =28&t=6592
However the current is not the issue as it only draws 22mA, I measured it.

It is the software that is wrong or the way the poly fuses mess about with the supply regulation.

thom_thumb
Posts: 21
Joined: Tue May 29, 2012 9:21 pm

Re: Report: Apple Wired Keyboard Incompatible

Thu Jun 07, 2012 1:51 pm

So I plugged in an Apple USB keyboard and got a bunch of dmesg errors. I would have thought it's a driver problem (although one would think there aren't driver issues with a simple USB keyboard...)

Here's some of the dmesg output.... It keeps repeating so I lost the very beginning when the device is first plugged in.

https://gist.github.com/2888871

mcbain
Posts: 10
Joined: Wed May 23, 2012 10:14 am

Re: Report: Apple Wired Keyboard Incompatible

Thu Jun 07, 2012 1:55 pm

Ehm, I'm using the white Apple keyboard (MB110) without any problem connected to my RPi. But I haven't tried to use the internal usb hub so far.

From that point it seems not to be a general problem with Apple keyboards.

bredman
Posts: 1415
Joined: Tue Jan 17, 2012 2:38 pm

Re: Report: Apple Wired Keyboard Incompatible

Thu Jun 07, 2012 2:23 pm

Grumpy Mike wrote:I had exactly the same problem
http://www.raspberrypi.org/phpBB3/viewt ... =28&t=6592
However the current is not the issue as it only draws 22mA, I measured it.

It is the software that is wrong or the way the poly fuses mess about with the supply regulation.
If the polyfuse has tripped, you will get a low current. It would be much better to measure the voltage across each polyfuse. Any significant voltage will show the the polyfuse is blocking the current.

thom_thumb
Posts: 21
Joined: Tue May 29, 2012 9:21 pm

Re: Report: Apple Wired Keyboard Incompatible

Thu Jun 07, 2012 2:56 pm

confirmed - I found a powered USB hub. Once I used the keyboard through the hub it works perfectly. Now I know!

User avatar
mahjongg
Forum Moderator
Forum Moderator
Posts: 12872
Joined: Sun Mar 11, 2012 12:19 am
Location: South Holland, The Netherlands

Re: Report: Apple Wired Keyboard Incompatible

Thu Jun 07, 2012 5:46 pm

The apple wired keyboard has a built in 2 port hub, so you can plug in two other USB devices, such as a mouse. The keyboard is rated 200mA, therefore its not a "single current unit" device (with "current unit" being the technical term for 100mA in "USB speak"). As a side effect it also doesn't have to (according to USB specs) behave well when "powered" by an unpowered hub, which only feeds the device 4,4 Volt instead of the normal minumum of 4.75 Volt.

The RPI is designed to be only compatible with "single current unit devices", due to the fact that each USB port has a 140mA fuse (actually a "polyfuse", which is an auto resetting fuse), due to the choice to use these fuses, there is an approximate 0.3 to 0.6 volt drop over them when the device draws 100mA through the fuse, so that in worst case (and @ 100mA) there is only between 4.7 and 4.4Volt behind the fuse.

If you draw 200mA this drops to between 4.4 and 3.8 Volt!
But these keyboards are probably also designed to need 4.75 volt, (which is legitimate for devices drawing more than 200mA).

So that is why they do not work, they are not single current unit devices, and the RPI is designed to be only compatible with single current unit device.

A hub that is externally powered is technically a "single current unit device", as it draws less than 100mA from the upstream device (the RPI) in fact it draws no current at all (so it would even work when the fuse is removed or blown). Devices after the hub may draw whatever the hub can provide (technically up to five current unit's or 500mA but in practice often as much as the hub's power supply can deliver), so one trick that is often used is to use the hub to power the PI, that also avoids problems that can occur when the hub tries to "backfeed" the PI through the 140mA fuse. Which then blows, but puts some voltage on the board, causing all kinds of havoc.

Note that "single current unit" isn't synonymous with "USB 1.1", it can be just as well be an USB 2.0 device.

User avatar
Grumpy Mike
Posts: 934
Joined: Sat Sep 10, 2011 7:49 pm
Location: Manchester (England England)
Contact: Website

Re: Report: Apple Wired Keyboard Incompatible

Thu Jun 07, 2012 8:47 pm

mahjongg wrote:The apple wired keyboard has a built in 2 port hub, so you can plug in two other USB devices, such as a mouse. The keyboard is rated 200mA, therefore its not a "single current unit" device (with "current unit" being the technical term for 100mA in "USB speak").
Look you keep saying this like it was some sort of truth. It is not. The keyboard in not rated at 200mA it shows up in the USB probe as requiring 50mA and so does the hub. BUT when I measured it the whole thing only takes 22.9mA - the whole thing! Yes I had nothing connected into the hub just the keyboard. Are you saying the Pi knows that potentially it can take more current and so crashes early to save time?

This 22.9mA was with a voltage of 4.83V across the keyboard and I measured 0.14V drop across the poly fuse, and confirmed a 4.98V supply the other side of the fuse.
I have even powered the keyboard directly from the 5V supply by using a special cable with a break in the +5V line, the same cable I used to measure the keyboard's current. I confirmed these readings with a scope to see if there were any current / voltage noise and there was none.

What part of it is not a power issue do you not understand.

The fact that some people report it working through a powered hub suggested to me something wrong with the timing in the software that, going through a hub, fixes.

thom_thumb
Posts: 21
Joined: Tue May 29, 2012 9:21 pm

Re: Report: Apple Wired Keyboard Incompatible

Thu Jun 07, 2012 9:16 pm

Grumpy Mike wrote: What part of it is not a power issue do you not understand.

The fact that some people report it working through a powered hub suggested to me something wrong with the timing in the software that, going through a hub, fixes.
Hi Mike,

Thanks for contributing to the conversation. I think you're the first person (in this thread) to suggest it's not a power issue. That would actually be great if that's the case.

So personally I've found two devices which didn't work when plugged in directly, but do work through a powered USB hub - first is the Apple kbd (obviously) the second is a rtl8192-based wifi dongle. One similarity I've seen in both of these cases is the following output in dmesg:

Code: Select all

DEBUG:handle_hc_chhltd_intr_dma:: XactErr without NYET/NAK/ACK
repeated many times... Does that mean anything to you? Do you think it's worth opening an issue in the rpi kernel tracker on github?

User avatar
Grumpy Mike
Posts: 934
Joined: Sat Sep 10, 2011 7:49 pm
Location: Manchester (England England)
Contact: Website

Re: Report: Apple Wired Keyboard Incompatible

Thu Jun 07, 2012 10:00 pm

I think there is already an issue raised here:-
https://github.com/raspberrypi/firmware/issues/19

This thread seems to suggest that it is an issue with Debian Squeeze drivers
http://www.raspberrypi.org/phpBB3/viewt ... 99&p=92778
As they say:-
this is definitely a Debian Squeeze driver issue. My keyboard & mouse work fine on the RasPi on both Arch & Fedora Remix 17.

User avatar
mahjongg
Forum Moderator
Forum Moderator
Posts: 12872
Joined: Sun Mar 11, 2012 12:19 am
Location: South Holland, The Netherlands

Re: Report: Apple Wired Keyboard Incompatible

Fri Jun 08, 2012 1:07 am

Not claiming there isn't a firmware issue too, but -my- apple keyboard claims to need 200 mA! That it reports requiring less at that moment isn't relevan (its built in hub knows there is no more budget needed, as there are no devices connected ), what is relevant is to which standard it was designed, if it says on the back that its a "200 mA device", it is not designed to be a "single current unit device"!

Its not even important that it might not draw that much in reality, (especially if you connect nothing to its USB ports) it just that this means it doesn't have to obey the "100 mA rule", which states that if an USB device its using less than 100mA it is also required to work with 4.4 Volt! Otherwise it in all probability will be a device that needs 4.75 Volt!

With a polyfuse that might be 7 ohm, and a power supply that might only provide 4.9 Volt to begin with, even when the keyboard really only draws (an average current of) 22.9 mA a keyboard with a microcontroller that needs 4.75 Volt simply might not get "enough juice" to work reliably. I stress, might because if you happen to have a good PSU, and a "good polyfuse" and you plug nothing into the keyboard (so the hub stays dormant), then you might get away with it, but that doesn't mean there isn't a potential problem!

Again, I'm not claiming there might not be a software issue too, it seems evident there is one if the keyboard works with one piece of software (distro), but not another, I'm just concerned about people who claim that Apple keyboards are "fine", because he doesn't happen to see the problem.

tufty
Posts: 1456
Joined: Sun Sep 11, 2011 2:32 pm

Re: Report: Apple Wired Keyboard Incompatible

Fri Jun 08, 2012 7:06 am

mahjongg wrote:Not claiming there isn't a firmware issue too, but -my- apple keyboard claims to need 200 mA! That it reports requiring less at that moment isn't relevan (its built in hub knows there is no more budget needed, as there are no devices connected ), what is relevant is to which standard it was designed, if it says on the back that its a "200 mA device", it is not designed to be a "single current unit device"!
It might say 200mA on the back, but that's not what it's telling your system. It's telling your system it needs *up to* 50mA + 50mA (unless you have a model that's radically different to any of mine)

Using a good power supply shoving out 2.1A, and Raspbian (as the default debian may have some issues), 2 Apple branded and one Apple-style keyboards work fine on my board that won't even boot "naked" off a 700mA wall wart. http://www.raspberrypi.org/phpBB3/viewt ... 799#p94619

tufty
Posts: 1456
Joined: Sun Sep 11, 2011 2:32 pm

Re: Report: Apple Wired Keyboard Incompatible

Fri Jun 08, 2012 7:10 am

tufty wrote:
mahjongg wrote:Not claiming there isn't a firmware issue too, but -my- apple keyboard claims to need 200 mA! That it reports requiring less at that moment isn't relevan (its built in hub knows there is no more budget needed, as there are no devices connected ), what is relevant is to which standard it was designed, if it says on the back that its a "200 mA device", it is not designed to be a "single current unit device"!
It might say 200mA on the back, but that's not what it's telling your system. It's telling your system it needs *up to* 50mA + 50mA (unless you have a model that's radically different to any of mine)

Using a good power supply shoving out 2.1A, and Raspbian (as the default debian may have some issues), 2 Apple branded and one Apple-style keyboards work fine on my board that won't even boot "naked" off a 700mA wall wart. http://www.raspberrypi.org/phpBB3/viewt ... 799#p94619
The problem isn't the keyboard. Yes, plugging stuff into its hub is a potential problem, but - y'know, "don't do that, kids." The actual and major problem is the USB (and overall) power policy taken on the Pi boards.

Simon

User avatar
Grumpy Mike
Posts: 934
Joined: Sat Sep 10, 2011 7:49 pm
Location: Manchester (England England)
Contact: Website

Re: Report: Apple Wired Keyboard Incompatible

Fri Jun 08, 2012 9:27 am

mahjongg wrote:Not claiming there isn't a firmware issue too, but -my- apple keyboard claims to need 200 mA! That it reports requiring less at that moment isn't relevan (its built in hub knows there is no more budget needed, as there are no devices connected ), what is relevant is to which standard it was designed, if it says on the back that its a "200 mA device", it is not designed to be a "single current unit device"!
No ... you totally misunderstand what that rating value means. I have worked for a large company with it's own compliance department and I have been responsible for putting such ratings on devices. This has involved me discussing the labeling requirements with the experts, people who have a full time job reading and interpreting the legislation.
It dose not mean it can take up to 200mA what it means is that it will not take more. The device is capable of taking 100mA so you can't put that as a rating figure on the label, you need a bit of margin, so what is normally done is that the next round number up is put on as a rating. This is what is expected by safety legislation. It has nothing to do with what we are talking about here which is the amount of power actually drawn by the device which is what is important.
The hub in the keyboard can only power low current devices. When it works on my apple for instance, it will shut down if you try an plug a memory stick in that hub connection. The hub can not supply over the 50mA it is rated for.
Yes I have a good power supply, I have even bypassed the micro USB power socket to remove the voltage drop from that. My supply can supply up to 3A.

While too much power for the Pi, is a nice neat theory and using a powered hub seems to fix it and confirm it the theory does not hold up to more thorougher investigation. In science when that happens the original "nice" theory must be abandoned in search for the truth. The history of science is littered with such events.
Please stop peddling this line because it is wrong and you are doing no one any service by continuing to stick to this disproved line of thinking.

User avatar
mahjongg
Forum Moderator
Forum Moderator
Posts: 12872
Joined: Sun Mar 11, 2012 12:19 am
Location: South Holland, The Netherlands

Re: Report: Apple Wired Keyboard Incompatible

Fri Jun 08, 2012 10:13 am

Sigh !
I never claimed that the label meant it could draw 200mA, what the label means IMHO is that its not the same class of device as a simple keyboard that is in the "less than 100mA class", AKA a "single current unit device".

there are two "classes" of USB devices:
Single current unit devices
and
Multiple current unit devices.

Single current unit devices are required to work with 4,4 Volt
Multiple current unit devices are not, and thus may require 4.75 Volt.

When drawing the same current, the first call may work, while the second class may fail in a situation where they receive a voltage between 4.4 and 4.75 volt.

The polyfuses, that can have a resistance between 3 and seven Ohm can cause this voltage to be lower than 4.75 volt, so that the first class of devices work, and the second class of devices doesn't.

That is not a "disproved theory", its a fact, and the consequences of it can be found in the troubleshooting section of this forum everyday.

User avatar
markb
Posts: 124
Joined: Thu Nov 17, 2011 8:09 am

Re: Report: Apple Wired Keyboard Incompatible

Fri Jun 08, 2012 11:45 am

Hmm, mahjongg's arguement is pretty convincing, but then again so is Grumpy Mike's. There's only one way to resolve this........

thom_thumb
Posts: 21
Joined: Tue May 29, 2012 9:21 pm

Re: Report: Apple Wired Keyboard Incompatible

Fri Jun 08, 2012 12:07 pm

markb wrote:Hmm, mahjongg's arguement is pretty convincing, but then again so is Grumpy Mike's. There's only one way to resolve this........
Fight to the death? :)

So someone mentioned (can't remember where) that there might be USB driver issues with Debian specifically, but Arch and Fedora were unaffected. Maybe I'll put Arch on an SD card later and see if the keyboard doesn't magically start working...

User avatar
mahjongg
Forum Moderator
Forum Moderator
Posts: 12872
Joined: Sun Mar 11, 2012 12:19 am
Location: South Holland, The Netherlands

Re: Report: Apple Wired Keyboard Incompatible

Fri Jun 08, 2012 12:59 pm

One fact doesn't rule out another fact, in this case they both can be true at the same time.
I'm not the one saying that my findings disprove that there isn't a software issue, but grumpy mike seems to think that my findings are "distracting" from his claims that there is a software issue, and that therefore I need to be silent about them, and even goes so far as to dismiss them.

I'm very interested in any further facts, this isn't a "turf war", it truth finding. So thom_thumb please do try another distro, and see if that solves the problem.

thom_thumb
Posts: 21
Joined: Tue May 29, 2012 9:21 pm

Re: Report: Apple Wired Keyboard Incompatible

Fri Jun 08, 2012 1:35 pm

mahjongg wrote:So thom_thumb please do try another distro, and see if that solves the problem.
Yup! The same Apple keyboard works fine when I boot up the Arch distro. So this is a USB issue with Debian.

User avatar
Grumpy Mike
Posts: 934
Joined: Sat Sep 10, 2011 7:49 pm
Location: Manchester (England England)
Contact: Website

Re: Report: Apple Wired Keyboard Incompatible

Fri Jun 08, 2012 1:42 pm

mahjongg wrote: Multiple current unit devices are not, and thus may require 4.75 Volt.

When drawing the same current, the first call may work, while the second class may fail in a situation where they receive a voltage between 4.4 and 4.75 volt.
Again you seem to be missing the point and that point is my measurements of the voltage show that I have 4.83V across the not working correctly keyboard. So what ever class it is in there is enough voltage to operate it. So it is not a power issue!!!!!
How many times do you need telling.
I can't vouch for other situations, or other people's setup because I have not measured them. Indeed if the voltage was low that would cause a problem.
I never claimed that the label meant it could draw 200mA,

But you said:-
apple keyboard claims to need 200 mA
Which sounds to me like you are.

Anyway while I was composing this thom_thumb came up with the definitive answer.
It looks like the USB is dropping packets. When it drops them on a key down not much happens but when it drops them on a key up you get the repeating key problem.
My money is this being the problem with all the repeating keys keyboard not the spurious power argument.
Thanks thom_thumb, I am in the process of downloading the Arch distro so I can see for myself. I had to go out and buy another SD card this morning for it.

User avatar
mahjongg
Forum Moderator
Forum Moderator
Posts: 12872
Joined: Sun Mar 11, 2012 12:19 am
Location: South Holland, The Netherlands

Re: Report: Apple Wired Keyboard Incompatible

Fri Jun 08, 2012 5:30 pm

My only beef was that I still fear that in such cases it -can- be a power issue. I did see that you had measured the voltage as 4.83 Volt, (Your large banner that in your case it wasn't a power issue was a bit hard to miss) ;) but that is in your case, like I said the polyfuses can be anywhere between 2 and 7 ohm, that in your case it happened not to be seven ohm doesn't mean that another person cannot catch one that is seven ohm. It seemed to me that you were trying to dismiss that power issues couldn't have anything to do with the fact that apple keyboards misbehave. Perhaps it isn't a big factor in the specific case of apple keyboards (I would be glad if its true), but that polyfuses can drop the output voltage to way below 4.75 volt is still a valid observation.
apple keyboard claims to need 200 mA
Yes I used an unfortunate way to put that mine is labeled as "200mA" I grant you that, I should have said "-my- apple keyboard is labeled as a 200mA device" but you could probably distill from all my other remarks (like "therefore its not a "single current unit" device") that I wasn't concerned by the actual current consumption of the device, only it's class.

I wish I had an RPI, so I could check if bridging the polyfuse would solve the problems, as a definitive way to prove or disprove the reason of the many types of problems with USB, I would be very happy if in the end the polyfuses have nothing to do with it, and all problems can be solved with software. However I really doubt it. But only time will tell.

User avatar
mahjongg
Forum Moderator
Forum Moderator
Posts: 12872
Joined: Sun Mar 11, 2012 12:19 am
Location: South Holland, The Netherlands

Re: Report: Apple Wired Keyboard Incompatible

Fri Jun 08, 2012 7:15 pm

P.S.
Grumpy Mike, reading your other posts, I realized we both have the identical Wired Apple keyboard, the Model A 1048! if you look at the back to the right of the compliance logo's it says "rated 5V DC, 200mA max", that is the rating I was talking about.

I truly hope that this device, even when it's "rated 200mA" still behaves like a "100mA device", in that it can work with 4,4 Volt. Because it would be ideal for use with a PI. Knowing Apple it just might be that they did indeed ensure this would be the case, one can only hope.

User avatar
Grumpy Mike
Posts: 934
Joined: Sat Sep 10, 2011 7:49 pm
Location: Manchester (England England)
Contact: Website

Re: Report: Apple Wired Keyboard Incompatible

Fri Jun 08, 2012 7:44 pm

thom_thumb wrote: Yup! The same Apple keyboard works fine when I boot up the Arch distro. So this is a USB issue with Debian.
I can confirm this. I downloaded an Arch distro and the Apple Keyboard ran sweet as a nut all afternoon, just plugged directly into the Pi. I even tried it on an unpowered hub with no problems.

So it is back to the Debian crew to fix this. How do we tell them?

I suspect this will be the root of all the repeating keyboard problems.

marsman2020
Posts: 72
Joined: Sun May 20, 2012 11:26 pm

Re: Report: Apple Wired Keyboard Incompatible

Fri Jun 08, 2012 8:44 pm

Based on this keyboard issue being resolved in Arch, I'm going to be checking out the 'gpm/X+LXDE kills networking when using a USB hub' issue there as well.

The latest kernel in the Arch distribution for the Pi is a custom kernel that they compiled themselves, not one of the ones provided by the Foundation on github, so kernel differences might play a roll as well.

dom
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5478
Joined: Wed Aug 17, 2011 7:41 pm
Location: Cambridge

Re: Report: Apple Wired Keyboard Incompatible

Fri Jun 08, 2012 9:43 pm

Grumpy Mike wrote:
thom_thumb wrote: So it is back to the Debian crew to fix this. How do we tell them?
First thing I need to know. If you copy the kernel.img from Arch to Debian image, does it still boot? Does it make the keyboard reliable?

Return to “Troubleshooting”