2016-05-11 02:36 AM
I found a very interesting situation, I can't explain (so no solution). We have a project and the USB connection is lost. Disconnecting and reconnecting the cable will not solve the situation and after the reconnection the device is not enumerated any more. The interrupt is not generated any more (this explain why the device is not enumerated).
Vsense is not implemented in hardware. So to detect a possible disconnection the SOF (USBx_DEVICE->DSTS & USB_OTG_DSTS_FNSOF) is used. When the situation occured the SOF is changing even the cable is disconnecting. On the PA11 USB_OTG_FS_DM there's next effect as you can see in oscilloscope imageNormally it shall be flat low :) and it's generated from the device sideWhen the situation is generated the descriptor is not fully transferred any more. Adding some code monitoring I found the last call as expected is else{
/* Enable the Tx FIFO Empty Interrupt for this EP */
if (ep->xfer_len > 0)
{
USBx_DEVICE->DIEPEMPMSK |= 1 << (ep->num);
in HAL_StatusTypeDef USB_EP0StartXfer(USB_OTG_GlobalTypeDef *USBx , USB_OTG_EPTypeDef *ep, uint8_t dma)And after there's no interrupt anymore...Any suggestions, solutions, deja-vu, comments, etc. are welcomedThe effect can be very easy reproduce by pressing F5 few times in USBLyzer #usb-device #cube #stm32f205
2016-05-17 02:59 AM
HAL_PCD_SetTxFiFo(&hpcd, 0, 0x40);
was commented out