STM32 F429 USB CDC vs USB MSD with USB FS
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2015-10-29 5:58 AM
Hello all,
I have a strange question regarding speed od USB CDC and USB MSD driver for STM32F429.I implemented USB MSD + eMMC with FatFS support and I am getting 0.51 MB/s write and 0.69 MB/s read speed results with USB Flash Benchmark app (on Windows).Now I implemented USB CDC and I am generating 100MB of data and sending out to USB. Write speed (sending from FW to PC) is only 75kB/s .I expected CDC should be faster than result frm MSD + eMMC test. I do not know, what else to check or test to achieve higher speeds.I have USB FS type on the board. HS is not possible due to hardware design.What speed should I normally get from this setups?Thanks, Uros #stm32f429-usb-msd-cdc-speed- Labels:
-
USB
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2015-10-29 6:15 AM
Well the MSC can respond with at least 512 bytes per request, often significantly more. 600-700 KBps would be expected. The CDC likely sends a handful of bytes per packet, with more back-n-forth handshaking, probably not going to hit those kinds of numbers. Look at how you can fill every packet that crosses the wire.
Up vote any posts that you find helpful, it shows what's working..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2015-10-29 6:17 AM
I just benchmarked my STM32F407-based device. It's working at 48MHz, SDIO is at 24MHz, I'm using FatFS + SDIO (2GB SandDisk microSD) + USB FS Mass Storage.
read speed is ~800KB/s write speed is ~460KB/s The speeds are not very different from your case.- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2015-10-29 6:30 AM
I am generating dummy data, buffer size is 64 and I am sending this buffer to CDC.
uint32_t testSize = 100000000; //100MB
uint32_t dummyCounter = 0;
uint8_t APP_TX_DATA_SIZE = 64;
uint8_t buff_TX[APP_TX_DATA_SIZE];
for(uint8_t i = 0; i < APP_TX_DATA_SIZE; i++)
{
buff_TX[i] = i;
}
uint64_t StartTimeStamp = iMos_SysDateTime_Get_SysLiveTime( iMos_TimeUnit_ms );
while(dummyCounter < (testSize / APP_TX_DATA_SIZE))
{
usbStatus = CDC_Transmit_FS(buff_TX, sizeof(buff_TX));
dummyCounter++;
}
uint64_t StopTimeStamp = iMos_SysDateTime_Get_SysLiveTime( iMos_TimeUnit_ms );
StopTimeStamp returns me back current value in miliseconds since the Task is started.
With USB MSD speed, I am satisfied, but not with USB CDC.
The RCC settings I used I posted
/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=https%3a//my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/STM32%20F429%20USB%20MSD%20with%20eMMC%20%2b%20FatFS&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD06506F5B¤tviews=1
. On board I have 32kHz (on LSE) and 24MHz (on HSE) crystal. APB1 and APB2 peripheral clocks are 42 MHz- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2015-10-29 6:41 AM
Tune your parameters in usbd_conf.h (I presume you are using STM32_USB-Host-Device_Lib_V2.1.0.
Try to increase the APP_RX_DATA_SIZE, make it 10240 for example, and decrease the CDC_IN_FRAME_INTERVAL value, for example set it 0. Also, check out this .- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2015-10-29 6:43 AM
Thanks! I will try this settings and I'll post results as soon as I have them.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2015-10-29 6:59 AM
I have usbd_conf.h, usbd_cdc_if.h and usbd_cdc.h . I cannot findCDC_IN_FRAME_INTERVAL setting nowhere. I am using HAL drivers in the project.
The files are in attachment. APP_RX_DATA_SIZE I suspect isCDC_DATA_FS_IN_PACKET_SIZE in my headers. ________________ Attachments : usbd_cdc.h : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006I0wI&d=%2Fa%2F0X0000000bfu%2F5y7ex47SF.fQtq87gYog_TB9qNtZVMitNue3adnc1FQ&asPdf=falseusbd_cdc_if.h : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006I0s1&d=%2Fa%2F0X0000000bfs%2FnZH_wMu8G4Dnyb6CcJT3ErJPnvWMwYOJGkgT1YRMkfA&asPdf=falseusbd_conf.h : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006I0wM&d=%2Fa%2F0X0000000bft%2F_w7ZTo.cWpQGmPNdrvrNbj6EXBjlKgzK4Q8Nv3dcpT4&asPdf=false- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2015-11-04 2:20 AM
Update to the thread:
I learned that the speed of USB CDC is highly depending on what you are doing with data on the PC side. TeraTerm freezes, Terminal by Br@y hangs after receiving large amount of data,... so I made my own terminal app for Windows and I learned that displaying received data takes much longer as only storing received data in temporary file. Result: displaying of data in real time is slowing down the transfer speed.When I was displaying data in my terminal app, speed was only around 15kB/s, then I changed processing, so now, when I am expecting to get large volume of data, I store it to temporary file and then display this file when transmission is done. With this change, I was able to get USB CDC speed around 775 kB/s (+/- 5 kB/s).============================================Test 7 sending 10 MB of data (tested with own terminal app - saving to file)START: 6055 msEND: 18949 ms=============10 MB / 12849 ms = 778 kB/s============================================Test 8 sending 100 MB of data (tested with own terminal app - saving to file)START: 6055END: 134934=============100 MB / 128879 ms = 775 kB/s============================================