AnsweredAssumed Answered

stm32f105 usg otg problem when send 64 byes on IN transaction

Question asked by ye.heikii on Nov 1, 2012
hi

 ST experts,  i am testing Virtual COM Port  function using stm32F105(connect line),the USB OTG FULL SPEED  library is 3.3.0 and PC driver is VCP_1.3.1 on Win7,i find when send just 64 bytes(Max packets size) from stm32 device to PC, PC can not receive until stm32 device send less 64 bytes packets, and i found following disccustion :
[DEAD LINK /public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/USB to transmit real-time data in the least time possible&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD06506F5B&currentviews=2715]https://my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=%2Fpublic%2FSTe2ecommunities%2Fmcu%2FLists%2Fcortex%5Fmx%5Fstm32%2FUSB%20to%20transmit%20real%2Dtime%20data%20in%20the%20least%20time%20possible&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD06506F5B&currentviews=2715

Before starting detailed explanation of the Virtual COM Port example, we pick up a simplified case.

Suppose that you have a large data on a buffer to transfer over the bulk IN endpoint (EP) on your firmware. This transfer is split into wMaxPacketSize (64 bytes) transactions.

1) Your code fills the first packet (**1) to the EP buffer using USB_SIL_Write() (and SetEPTxValid() -- **2)
2) The USB engine (SIE: Serial Interface Engine) on the chip waits for an IN transaction from host.
3) When an IN transaction comes on the bulk IN EP, SIE sends the EP buffer to host. At the completion of this transaction, SIE puts interrupt.
4) For this EP interrupt, the USB library calls EPn_IN_Callback(). In this callback,
- your code fills the next packet to the bulk IN EP, using USB_SIL_Write() (and SetEPTxValid()).
OR
- your code fills USB_SIL_Write() (and SetEPTxValid()) with size 0, NULL buffer for ZLP, if required.
OR
- when you have nothing to send, your code just returns from this callback.

  according above information, in EPn_IN_Callback function, i always send a ZLP packets use USB_SIL_Write, the first  64 bytes packet can  be received by PC now , but next 64 bytes or less pakets will not be received.
 can you give some help about it?

Outcomes