lpcware

no data with WriteEP custom USB link

Discussion created by lpcware Employee on Jun 15, 2016
Content originally posted in LPCWare by david35 on Fri Jun 19 07:11:17 MST 2015
Hi

I am working on a retro-design conception with a custom USB link based on a LPC1825. The host side is a PC with a Cypress driver (CyUSB3.sys, Cypress USB console). I need to configure a communication link using Endpoint2 in interrupt transfer.

All the EP0 transfers (SETUP_PACKET) seem to be good and the device is well enumerated by the host. Using USBVIEW.exe, I have the same device descriptor as the old product to be retro-designed.

At the beginning, I started with the VCOM example and I suppressed all the VCOM functions.

The problem is with the EP2_IN interrupt transfert. There is no data transfer from the device to the host. I use a USB analyzer to record data transfer.

The Endpoint2 is initialized with:
/* register endpoint interrupt handler */
ep_indx = ((EP2_IN & 0x0F) << 1) + 1;    // EP2_IN=0x82
ret = USBD_API->core->RegisterEpHandler(g_hUsb, ep_indx, EP2_hdlr, 0);


I Program transfer descriptors for given endpoint using bwtest_USB_Prog_DTD function from usbd_rom_bwtest example with:
usb_param.USB_Configure_Event = bwtest_ConfigureEvent;


The EP2 Handler is defined as:
ErrorCode_t EP2_hdlr(USBD_HANDLE_T hUsb, void *data, uint32_t event)
{
switch (event)
{
case USB_EVT_IN:
{
g_u32_CptItEP2IN++;
USBD_API->hw->WriteEP(g_hUsb, EP2_IN, (uint8_t*)g_tu8_TabEcp, 1024);
break;
}
default: break;
}

return LPC_OK;
}


With this code, when the host initiates a data transfer, an event USB_EVT_IN is well detected in the EP2_Hdlr function but no data is transferred to the host. This behavior is confirmed with the USB analyzer.

Something is missing. But what?
Thanks for your help.
David

Outcomes