AnsweredAssumed Answered

2 strange packets from double-buffered bulk tx endpoint

Question asked by kubok on May 23, 2012
Hello.
Please give me some knowledge about the topic.
Now I use STM32F103, and I found 2 strange packets transfer
after initializing endpoint as double-buffered bulk tx.

I found this problem after trying the following steps, 1,2 and 3.

---
1.
I initialize endpoint as the following,
almost same as "AudioSpeaker" Demo in STM USB-FS LIBRARY.
(but this is not Isochronous)

     SetEPType(ENDP1, EP_BULK);
     SetEPDoubleBuff(ENDP1);
     SetEPDblBuffAddr(ENDP1, ENDP1_BUF0Addr, ENDP1_BUF1Addr);
     SetEPDblBuffCount(ENDP1, EP_DBUF_IN, 0x40);
     ClearDTOG_TX(ENDP1);     // for usb peripheral
     ClearDTOG_RX(ENDP1);     // SW_BUF for application
     ToggleDTOG_RX(ENDP1);
     SetEPTxStatus(ENDP1, EP_TX_VALID);
     SetEPRxStatus(ENDP1, EP_RX_DIS);

Toggle conditions are also cleared equally
when usb request (Set Configuration, Set Interface, etc.) is received.

2.
I connect a Device to PC via USB analyzer.

3.
I found 3 strange packets when a device starts.
All of them are max-packet-size, first one and second one are different,
but first one and third one are same.
---

To improve this strange-packet-transfer, I try to do the following steps, 4 and 5.

---
4.
I delete "ToggleDTOG_RX(ENDP1);" at any phase to make toggle bit even.
(No Problem to transfer a packet because SW_BUF can be toggled when it is transferred.)
Then I found 2 strange packets when a device starts.
These 2 packets are max-packet-size, first one and second one are different.

5.
I change a packet size from "0x40" to "0x00" in initialize phase.
(No Problem to transfer a packet because its size can be changed when it is transferred.)
Then I found 2 strange "NULL" packets when a device starts.
---

After all, the packets are NULL but I cannot avoid strange-packets-transfer.
Do I have some mistakes or misunderstanding?

Outcomes