LPC1837: USB Keyboard/Mouse device updating report

cancel
Showing results for 
Search instead for 
Did you mean: 

LPC1837: USB Keyboard/Mouse device updating report

291 Views
gvk51
Contributor III

Hi All,

I am working on LPC1837 based development board, with "lpcopen_2_18_lpcxpresso_nxp_lpcxpresso_1837" SDK as start point. I am working on examples "usbd_rom_hid_keyboard" & "usbd_rom_hid_mouse" they work fine as USB keyboard/mouse device to host machine.

I see from the below logic of the code

pastedImage_1.png

even if the g_keyBoard.report is empty it is still writing to endpoint, this is creating a continuous stream of packets to host machine, I observed this using Bus-Hound software. Please give your inputs and how to fix this. I would like to send report only if valid data is present.

Thanks & Regards,

Vamshi G.

Labels (3)
0 Kudos
2 Replies

55 Views
jeremyzhou
NXP TechSupport
NXP TechSupport

Hi vamshi krishna,

Thank you for your interest in NXP Semiconductor products and 
the opportunity to serve you.

You can add  the function to detect whether report changes between the Keyboard_UpdateReport() and  USBD_API->hw->WriteEP(g_keyBoard.hUsb, HID_EP_IN, &g_keyBoard.report[0], KEYBOARD_REPORT_SIZE), if report keep same you can ignore the  USBD_API->hw->WriteEP(g_keyBoard.hUsb, HID_EP_IN, &g_keyBoard.report[0], KEYBOARD_REPORT_SIZE), otherwise, execute it.

Hope it helps.
Have a great day,
TIC

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

55 Views
gvk51
Contributor III

Hi jeremyzhou,

I tried the mechanism as you mentioned, I believe there is some issue in USB ROM driver. once key is pressed, a report with key event is sent, after that I see its keep on sending the same event even if the keyboard report entries (g_keyBoard.report[]) are zero.

kbd_event_test.png

Please give your inputs.

Thanks & Regards,

Vamshi G.

0 Kudos