2013-05-30 05:01 AM
Hi,
I use STM32F405RG and the VCP driver from ST. I use USE_USB_OTG_HS, USE_EMBEDDED_PHY The changes I made to the ST driver are as followed:in usbd_conf.h &sharpifdef USE_USB_OTG_HS &sharpdefine CDC_DATA_MAX_PACKET_SIZE 64 /* Endpoint IN & OUT Packet size */ &sharpdefine CDC_IN_FRAME_INTERVAL 5 /* Number of micro-frames between IN transfers */ &sharpdefine APP_RX_DATA_SIZE ((8)*1024) /* Total size of IN buffer: in usb_conf.h &sharpifdef USE_EMBEDDED_PHY &sharpdefine USB_OTG_EMBEDDED_PHY_ENABLED // &sharpdefine USB_OTG_HS_LOW_PWR_MGMT_SUPPORT &sharpendif Also the change suggested by bil.til/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=https://my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Yet%20another%20STM32F1057%20USB%20OTG%20driver%20issue%20%28VCP%20device%29&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD06506F5B¤tviews=1168
I believe it applies to F405 as well. I send 960 bytes every 3.18msec (using VCP_DataTx) but I keep getting USBD_BUSY in VCP_DataTx. I'm communicating with PC, I tried using Docklight, AccessPort and my own application in Visual Studio standard COM port (Readfile of winapi) Any suggestions? and on a different note, what is ''CDC_IN_FRAME_INTERVAL'' mentioned in usbd_conf.h?APP_RX_DATA_SIZE*8/MAX_BAUDARATE*1000 should be > CDC_IN_FRAME_INTERVAL*8 */ Many thanks #maximum-output-speed #usb-vcp2013-05-30 06:23 AM
> #ifdef USE_USB_OTG_HS
> #define CDC_DATA_MAX_PACKET_SIZE 64 /* Endpoint IN & OUT Packet size */ CDC_DATA_MAX_PACKET_SIZE should be 512 for High-speed (HS), because this macro is used to declare wMaxPacketSize (MPS) of the endpoint descriptors. By the USB2.0 spec, HS bulk endpoint should have 512 bytes MPS. Don't change this value on the original example. I'm not sure what occurs on your PC host controller for the out-of-spec MPS, because out-of-spec behavior heavily depends on the implementation of the host controller. > Also the change suggested by bil.til here I believe it applies to F405 as well. Yah, you may delete ST's bad solution, too, as I pointed out in post. > I send 960 bytes every 3.18msec You'll get this transfer rate even on OTG_FS, without the external ULPI HS PHY ;) Tsuneo
2013-06-02 01:28 AM
Thank you for your reply, but as I said, I don't use external ULPI HS PHY. I use HS core with internal PHY (so HS core in full speed). for that reason CDC_DATA_MAX_PACKET_SIZE is 64, if it was 512 it wouldn't work.
So still I don't know why I get USB Busy. Any ideas?2013-07-01 02:13 AM
I found the solution:
The Host (PC) asks to check if there is new data every 1ms (frame) Inusbd_conf.h
CDC_IN_FRAME_INTERVAL
is5
That means that the driver will check if there is new data every 6 frames (the code isif (FrameCount++ == CDC_IN_FRAME_INTERVAL)
) So the VCP speed is reduce by 6 times (instead of 9Mbps it will be about 1.5Mbps) I changedCDC_IN_FRAME_INTERVAL
to1
and now I get much higher speeds without reachingUSBD_BUSY
inVCP_DataTx
function (USBD_BUSY
means I try to write data to the buffer but it is full since the PC didn't take it)CDC_IN_FRAME_INTERVAL
should be0
for max speed but causes higher current consumption and I imagine more interrupts, try to put the value that fits your requirements.