Content originally posted in LPCWare by srinivasR on Wed Dec 02 01:25:00 MST 2015
Hi,
I am struggling to understand the USB API from LPC to get the host to device vendor command transfer. With my libusbK host application, sending control command data to device , but always get stall PID. where as device to host works.
Not able to get the flow of ROM APIs to acheive my goal. I am using the VCOM example given from LPC. Below is my code in ENDPOINT0 Handler.
static ErrorCode_t CDC_ep0_override_hdlr(USBD_HANDLE_T hUsb, void *data, uint32_t event)
{
..................
else if(event == USB_EVT_SETUP && pCtrl->SetupPacket.bRequest ==BM_COMMAND_GET_STATUS_CONTROLLER )
{
pCtrl->EP0Data.Count=8; // send response to HOST [ DEVICE-TO-HOST] ...WOKRING
memset(buff,'3',8);
pCtrl->EP0Data.pData=(uint8_t *) buff;
USBD_API->core->DataInStage(pCtrl);
ret = LPC_OK;
}
else if(event == USB_EVT_SETUP && pCtrl->SetupPacket.bRequest ==BM_COMMAND_SET_STAUTS_CONTROLLER )
{
// NOT CLEAR AS WHAT TO BE DONE
////USBD_API->core->StatusOutStage(pCtrl); >>>> did not help?????????????????
}
Please advise.