LPC11U68 USB HID 接收傳送資料

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

LPC11U68 USB HID 接收傳送資料

Jump to solution
1,151 Views
DL1210
Contributor I

Hello,

我使用 LPC11U68 的 BSP(usbd_lib_hid_generic), 做 HID 開發,

使用上位機可以用USB通道傳送資料, 但無法將資料回傳給上位機,

hid_generic.c 內的HID_Ep_Hdlr的event只符合USB_EVT_OUT

並不會有符合USB_EVT_IN的情況, 是否需要做任何設定?

/* HID Interrupt endpoint event handler. */
static ErrorCode_t HID_Ep_Hdlr(USBD_HANDLE_T hUsb, void *data, uint32_t event)
{
USB_HID_CTRL_T *pHidCtrl = (USB_HID_CTRL_T *) data;

switch (event) {
case USB_EVT_IN:
USBD_API->hw->WriteEP(hUsb, pHidCtrl->epin_adr, loopback_report, 64);
break;

case USB_EVT_OUT:
USBD_API->hw->ReadEP(hUsb, pHidCtrl->epout_adr, loopback_report);
break;
}
return LPC_OK;
}

Labels (1)
0 Kudos
Reply
1 Solution
1,087 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

About USB lib HID usage, there is also demo under LPCopen, you can refer to the routine of interrup.

demo name is "usbd_rom_hid_generic".

 

View solution in original post

0 Kudos
Reply
4 Replies
1,128 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello DL1210,

How about test the USB HID Generic domo under LPCopen  first ?

Check how the interrupt work.

 

 

BR

Alice

 

0 Kudos
Reply
1,119 Views
DL1210
Contributor I

你好,

我使用 usbd_lib_hid_generic專案, 當上位機用USB進行通訊時,

接收/傳送資料則會進入, 如下中斷

hid_param.HID_EpOut_Hdlr = HID_Ep_Hdlr;

hid_param.HID_EpIn_Hdlr = HID_Ep_Hdlr;

但傳送資料至上位機時, 並未發生此中斷 <hid_param.HID_EpIn_Hdlr = HID_Ep_Hdlr;>

是否需要做額外的設定?

 

0 Kudos
Reply
1,088 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

About USB lib HID usage, there is also demo under LPCopen, you can refer to the routine of interrup.

demo name is "usbd_rom_hid_generic".

 

0 Kudos
Reply
1,081 Views
DL1210
Contributor I

Hi Alice,

感謝你的回覆, 使用這個例程做修改, 

其動作是我所預期的, 謝謝。

0 Kudos
Reply