2010-06-08 06:59 PM
Hi all,
I am debugging a device which connects to PC through USB cable. On PC side, this USB device has been enumerated as a serial port. It works now, I can see the new COM4 has appeared. The problem is through the Hyperterminal, I can send many key strokes to device, but there is no data been sent back. I am using end point1 to transmit, end point 3 to receive data. Through the JTAG, I can see the end point 1's transmission byte counter been set to 1, 1 byte data been write to PMA end point 1's transmission address, end point 1 register's STAT TX[1:0] been set to '11' which means valid. The code is: u32 VCOM_Send(BYTE* buf, u32 len) { if(len > USBCOMMS_PORT_DATA_SIZE) { remainData = len - USBCOMMS_PORT_DATA_SIZE; len = USBCOMMS_PORT_DATA_SIZE; } UserToPMABufferCopy(buf, ENDP1_TXADDR, len); SetEPTxCount(ENDP1, len); SetEPTxValid(ENDP1); return 0; } But there is no interrupt happens after the VCOM_Send(). At the same time, the bit DTOG_TX and bit CTR TX in end point 1 register are all cleared which should be set by hardware. The end point descriptor is: /*Endpoint 3 Descriptor*/ 0x07, /* bLength: Endpoint Descriptor size */ USB_ENDPOINT_DESCRIPTOR_TYPE, /* bDescriptorType: Endpoint */ 0x03, /* bEndpointAddress: (OUT3) */ 0x02, /* bmAttributes: Bulk */ USBCOMMS_PORT_DATA_SIZE, /* wMaxPacketSize: */ 0x00, 0x00, /* bInterval: ignore for Bulk transfer */ /*Endpoint 1 Descriptor*/ 0x07, /* bLength: Endpoint Descriptor size */ USB_ENDPOINT_DESCRIPTOR_TYPE, /* bDescriptorType: Endpoint */ 0x81, /* bEndpointAddress: (IN1) */ 0x02, /* bmAttributes: Bulk */ USBCOMMS_PORT_DATA_SIZE, /* wMaxPacketSize: */ 0x00, 0x00 /* bInterval: ignore for Bulk transfer */ Is there any one can give any clues that I can go further to find the problem? Thanks in advance! Dawei2010-06-11 07:16 AM
1) Is the bulk IN endpoint enabled and initialized in _Reset() callback?
(ST USB stack does it in bus reset handler, but better USB coding practice is doing it in Set_Configuration handler) 2) Do you have an interrupt IN endpoint on the Communications Class interface? Also, is this endpoint is enabled / initialized ? Even if you don't send any Serial_State notification over the interrupt IN endpoint, this endpoint is required. Without this endpoint, Windows CDC driver (usbser.sys) stops polling on the bulk IN endpoint, too. Tsuneo2010-06-14 05:42 PM
Hi Tsuneo,
Thank you for your reply. This problem has been fixed by some changes in the end point settings. I could not make sure what is the exact change, but it works after I reconfigured the sending and reveiving addresses of end point 0, 1 and 3. Cheers, Dawei