I've been puttering around with an Arduino, using it to adapt an IBM Model M keyboard to a USB port. I started with the V-USB library and some other PS2 keyboard library (which I basically rewrote in order to make it robust.)
If you aren't familiar, the PS2 keyboard communicates with a data & clock pin, serially. The standard implementation is to have the clock tied to an interrupt, so you get an interrupt per bit. Makes good sense to me. To "make it robust", I add start/stop and parity checking and added the ability to send NACK commands back to the keyboard to get it to re-send on error.
I think I'm dead in the water. Even with the re-send requests, the adapter works almost all the time. That is, in a normal day of typing it makes about one mistake every 15 minutes. That one mistake is enough. I can reproduce the problem reliably just by mashing keys wildly for several seconds. Somewhere in all that flailing, I can get some kind of bit error that feels like dropped interrupts. If I disable the USB send, I don't get any errors no matter how much I flog the keyboard.
I believe what's going on is that while the USB is processing its interrupt it's skipping handling the PS2's interrupt. The USB code is fantastically timing-critical, and the PS2 is too - you have very few instructions after each clock tick interrupt to get the data line read or written.
What makes matters worse is that the USB interrupt is relatively long - as it processes the entire message in a single interrupt event... Well, I say that like a bad thing, but, from what I understand of the V-USB implementation, it has to be like that.
It just looks to me like it's just not possible to have USB communications and any other microsecond-resolution real-time process going on in a single Arduino.
I could fix it: I could use another Arduino to handle the PS2 and present a buffered stream to the USB-facing Arduino. I could go low-tech and get a shift register to do the same...
But before I chase down those options, I thought I'd ask if anybody thinks I've misread things. I'm pretty new to the Arduino, so I could be making a fundamental mistake.