I am trying to use the example code and USB libraries in Flowcode 5.2 Pro to create a USB Keyboard on the PIC18F14K50, no luck.
The code compiles and loads on the chip fine, Mac OS X 10.7, Windows XP, Windows 7 all see the HID device fine, but no characters are transmitted to the OS. I am using a simplified version of the USB Keyboard demo app from Matrix Multimedia v5 example file, that just send a single character from the PIC to the host when a button is pressed on the PIC. Nothing every comes through.
I note in some form posts from WAY back in 2010/2011 that after considerable work, a HID was working on the PIC18F14K30 chip, however people on this thread seem to call out specifically that that could would not work on the K50. Seem odd.
I have a simple USB serial port program working fine on the PIC18F14K50, works with Windows, OS X and Linux hosts fine.
I have attached a simple flow code test routine that does not work.
Thanks in advance for any help.
Dave
USB HID Keyboard on PIC18F14K50
Moderator: Benj
USB HID Keyboard on PIC18F14K50
- Attachments
-
- program03c.fcf.zip
- Simple Flowcode USB HID test that does not work with PIC18F14K50
- (3.14 KiB) Downloaded 324 times
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: USB HID Keyboard on PIC18F14K50
Hi Dave,
Thanks for letting us know how your getting on with the K50, glad it is working correctly on the USB.
For the keyboard to work you need to be sending the packet of 8 bytes. Look at the example file again and you will see the HID component properties is setup in a way to receive a byte for the LED status and transmits 8 bytes. The HID configuration and example send and receive functions also reflect this number.
I think there also should be a excel document somewhere showing what key press the 8-bytes represent. I have attached it here just incase. Also I found that if you try to send data too soon after the initialise then the host computer will not receive any data. The example should show how we got around this using a delay icon. Another thing to look out for is sending data too often as this can also stop the host from listening, ensure you have a 2nd delay in the loop as shown in the example to ensure this is ok.
Let us know how you get on.
I have moved this post to the v5 forums please visit here for details of how to sign up.
http://www.matrixmultimedia.com/mmforum ... =46&t=9958
Thanks for letting us know how your getting on with the K50, glad it is working correctly on the USB.
For the keyboard to work you need to be sending the packet of 8 bytes. Look at the example file again and you will see the HID component properties is setup in a way to receive a byte for the LED status and transmits 8 bytes. The HID configuration and example send and receive functions also reflect this number.
I think there also should be a excel document somewhere showing what key press the 8-bytes represent. I have attached it here just incase. Also I found that if you try to send data too soon after the initialise then the host computer will not receive any data. The example should show how we got around this using a delay icon. Another thing to look out for is sending data too often as this can also stop the host from listening, ensure you have a 2nd delay in the loop as shown in the example to ensure this is ok.
Let us know how you get on.
I have moved this post to the v5 forums please visit here for details of how to sign up.
http://www.matrixmultimedia.com/mmforum ... =46&t=9958
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Re: USB HID Keyboard on PIC18F14K50
Hi Dave,
There were issues with the 13K50 which were resolved at that time by Ben.
The 14K50 though still doesn't operate correctly but since i wasn't using it I ignored the problem!
James :-}
There were issues with the 13K50 which were resolved at that time by Ben.
The 14K50 though still doesn't operate correctly but since i wasn't using it I ignored the problem!
James :-}
-
- Posts: 45
- Joined: Mon Nov 07, 2011 6:36 pm
- Has thanked: 1 time
- Been thanked: 30 times
Re: USB HID Keyboard on PIC18F14K50
Hi Dave
The problem is that you have not sent a zero data straight after the key data.
So in you flowchart straight after the
Good luck
Gary
The problem is that you have not sent a zero data straight after the key data.
So in you flowchart straight after the
- test[2]=0x59
SendDataDirect[test]
- test[2]=0x00
SendDataDirect[test]
Good luck
Gary
Re: USB HID Keyboard on PIC18F14K50
Gary, thank you very much for your code review and post! That was my problem, as you described. My simple keyboard HID button example is working like a champ on the PIC18F14K50.
-
- Posts: 45
- Joined: Mon Nov 07, 2011 6:36 pm
- Has thanked: 1 time
- Been thanked: 30 times