cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F05 USB No more interrupts

alin1
Associate
Posted on May 11, 2016 at 11:36

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 image

0690X00000604ePQAQ.png

Normally it shall be flat low :) and it's generated from the device side

When the situation is generated the descriptor is not fully transferred any more. 0690X00000604uWQAQ.png

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 welcomed

The effect can be very easy reproduce by pressing F5 few times in USBLyzer

#usb-device #cube #stm32f205
1 REPLY 1
alin1
Associate
Posted on May 17, 2016 at 11:59

HAL_PCD_SetTxFiFo(&hpcd, 0, 0x40);

was commented out