本帖最后由 fenjinzhe 于 2013-4-11 01:15 编辑
之前做过了HID程序传输一个12K的文件需要6秒多钟,不知道怎么这么慢,所以改为CDC类,据说速度还可以。
参考了ST官方例程VCP移植,发送和接收都很正常,今天用BusHound软件测试了一下速度,结果很惊讶。
看图
一开始速度在300+K/sec觉得挺正常。可是后来速度不停的上涨
QQ截图20130410235914.jpg (15.99 KB, 下载次数: 4)
下载附件
2013-4-11 01:07 上传
主循环内只有一句 USB_DataTx(&Buff[0], 64);
- #define USBD_CFG_MAX_NUM 1
- #define USBD_ITF_MAX_NUM 1
- #define USBD_SELF_POWERED
- #define USB_MAX_STR_DESC_SIZ 65535
- /** @defgroup USB_VCP_Class_Layer_Parameter
- * @{
- */
- #define CDC_IN_EP 0x81 /* EP1 for data IN */
- #define CDC_OUT_EP 0x01 /* EP1 for data OUT */
- #define CDC_CMD_EP 0x82 /* EP2 for CDC commands */
- /* CDC Endpoints parameters: you can fine tune these values depending on the needed baudrates and performance. */
- #ifdef USE_USB_OTG_HS
- #define CDC_DATA_MAX_PACKET_SIZE 512 /* Endpoint IN & OUT Packet size */
- #define CDC_CMD_PACKET_SZE 8 /* Control Endpoint Packet size */
- #define CDC_IN_FRAME_INTERVAL 40 /* Number of micro-frames between IN transfers */
- #define APP_RX_DATA_SIZE 2048 /* Total size of IN buffer:
- APP_RX_DATA_SIZE*8/MAX_BAUDARATE*1000 should be > CDC_IN_FRAME_INTERVAL*8 */
- #else
- #define CDC_DATA_MAX_PACKET_SIZE 64 /* Endpoint IN & OUT Packet size */
- #define CDC_CMD_PACKET_SZE 8 /* Control Endpoint Packet size */
- #define CDC_IN_FRAME_INTERVAL 5 /* Number of frames between IN transfers */
- #define APP_RX_DATA_SIZE 2048 /* Total size of IN buffer:
- APP_RX_DATA_SIZE*8/MAX_BAUDARATE*1000 should be > CDC_IN_FRAME_INTERVAL */
- #endif /* USE_USB_OTG_HS */
复制代码- #ifdef USB_OTG_FS_CORE
- #define RX_FIFO_FS_SIZE 128
- #define TX0_FIFO_FS_SIZE 64
- #define TX1_FIFO_FS_SIZE 128
- #define TX2_FIFO_FS_SIZE 0
- #define TX3_FIFO_FS_SIZE 0
复制代码请问我这正常吗,高手解答下呗!
你的搞定了?
一周热门 更多>