cancel
Showing results for 
Search instead for 
Did you mean: 

USB STM32F407 VCP Bidirectional communication bare metal?

waldi
Associate II

I'm sending a continuous data stream from uC to PC via VCP which is implemented as CDC. During stream every responded IN token for EP1 generates DIEPINT_XFRC, so I'm seeing interrupts:

DIEPINT_XFRC

DIEPINT_XFRC

DIEPINT_XFRC

...

Now I send something to uC and get these interrupts:

  1. GINTSTS_RXFLVL (GRXSTS_PKTSTS_OUT_DATA_RECEIVED)

  2.GINTSTS_RXFLVL (GRXSTS_PKTSTS_OUT_TRANSFER_COMPLETED)

  3. GINTSTS_OEPINT (DOEPINT_TRANSFER_COMPLETED)

thereafter again, the stream to PC

...

DIEPINT_XFRC

DIEPINT_XFRC

...

But sometimes (I thing if the OUT token is received at some wrong uC USB stage) i get:

  1. GINTSTS_RXFLVL (GRXSTS_PKTSTS_OUT_DATA_RECEIVED)              //ok

  2. GINTSTS_RXFLVL (GRXSTS_PKTSTS_OUT_TRANSFER_COMPLETED) //ok

  3. GINTSTS_OEPINT (DOEPINT_TRANSFER_COMPLETED)                     //ok

  4. GINTSTS_RXFLVL (SETUP_DATA_PACKET_RECEIVED)

  5. GINTSTS_RXFLVL (SETUP_COMPLETED)

  6. GINTSTS_OEPINT (USB_REQUEST_CLEAR_FEATURE) <---

Why clear feature? It seems that the core is not acknowledging the last OUT transfer and PC tries to reset the device.

With limited transmission blocks from uC to PC:

send command from PC to uC-> receive data block

send command from PC to uC-> receive data block

...

everything is working fine.

10 REPLIES 10