Main Site Documentation

Trouble successfully initializing keyboard device on USB0 or USB1 on F40 ALFAT OEM board


Using the F40 ALFAT OEM board attached to the Eval Kit, after verifying that I can successfully initialize and talk to flash drives on both of the USB ports (so they’re working for storage devices), I tried attaching a known working USB keyboard, and used ALFAT Explorer to send a custom command to initialize the keyboard device. I have not been able to get the F40 OEM board to respond with anything but !02 (incorrect parameters). I am following the documentation on page 4 of Rev. 3.1 of the File System User Manual.

With the keyboard attached to USB0, I have tried:
I K0:
I K0:K

both with the same results of !02.

With the keyboard attached to USB1, I have tried:
I K1:
I K1:K

both with the same results of !02.

The keyboard is very generic, and does not require any driver on a PC. I have also tried another USB keyboard, with the same results.

I’m sure I am missing something simple. Any advice would be greatly appreciated.


I: K0: A
I: K0: R
are the two options for the keyboard filter (manual P35). I don’t know where you got “K” from.

Not sure why you’re getting invalid command returns for what seems valid request, without the filter option… so I’d suspect the keyboard isn’t a generic HID keyboard. Do you have a few other USB keyboards you can try?


@ Brett -

Thanks very much for your reply.

Apparently, I must be working from the wrong version of the documentation. I followed the links from the Eval Kit’s product page through to . (The attached screen shot with highlights shows where I got the idea that I needed to place a K parameter after the colon.) Could you point me to the “P35” manual you’re referring to? I’d really like to be working from the correct documentation.

I see in your examples that you’re placing a colon after the I command character itself. I don’t see this in the documentation I have or in the behavior of the ALFAT Explorer for the storage initialization commands. I have been using only a space after the command character.

I have tried three completely generic USB keyboards, from three different manufacturers, and they all behave identically. None of them require any driver. They all appear, when attached to a PC, in Device Manager under Keyboards as “HID Keyboard Device”.

Based on your message and trying several different combinations, I have achieved partial success now. If I do NOT use the colon after the I command, and I USE the either the A or R parameter with NO intervening spaces after the last colon, I get a success code. Otherwise, I get the !02 error:

I K0:A works!
I K0:R works!
I K0: gets an !02 error (no A or R parameter)
I K0: A gets an !02 error (space before A)
I K0: R gets an !02 error (space before R)
I: K0: gets an !02 error (colon after I)
I: K0:A gets an !02 error (colon after I)
I: K0:R gets an !02 error (colon after I)

Ditto for K1.

So, thank you…I’m no longer blocked…I’ll just be sure to use the A or R parameter, no spaces before them, and I’m good to go.

I also wonder why using no parameter generates the error. Open to any ideas of what might be going on.

Incidentally, the V command reports v2.0.0.


The K is a parameter, and you supply either A or R for filtered ASCII characters, or raw key codes.

The manual says “optional”. I am guessing that’s incorrect :slight_smile: Perhaps @ Dat or someone from GHI can comment


@ Brett -

Thanks for the link to the correct manual.

In the manual I had, it never says anything about a value for the K parameter, so I assumed K was the value. All it does Is define “K” as “For media K0 or K1 only, return an ASCII-mapped key-code.” Thanks for clarifying.

I really appreciate your responses and pointing me to the correct documentation.