huanhuanhdu 发表于 2017-3-11 21:08:05

F407 USB使用多个端口无法与PC通信

USB MSC例程中使用的是
EPIN_ADDR = 0x81;
EPOUT_ADDR = 0x01;
程序里做了这样的修改:
EPIN_ADDR = 0x86;
EPOUT_ADDR = 0x02;
在usb_conf.c 中增加:
HAL_PCDEx_SetTxFiFo(&hpcd, 6, 0x200);

这样的程序,F407 可以接收到PC 发过来的数据,但是不能将数据发送到PC。
看到文档 UM1734 有如下描述:我觉得我都已经修改了,有哪位同学指导我一下,怎么样才能同时使用endpoint2 和endpoint6

5. How can the used endpoints be changed in the USB device class driver?
To change the endpoints or to add a new endpoint:
a) Perform the endpoint initialization using USBD_LL_OpenEP().
b) Configure the TX or the Rx FIFO size of the new defined endpoints in the
usb_conf.c file using these APIs in the USBD_LL_Init() function
– For STM32F2 and STM32F4 series (FS and HS cores):
HAL_PCD_SetRxFiFo()
HAL_PCD_SetTxFiFo()
The total size of the Rx and Tx FIFOs should be lower than the total FIFO size of the
used core, that is 320 x 32 bits (1.25 Kbytes) for USB OTG FS core and 1024 x 32 bits
(4 Kbytes) for the USB OTG HS core.
– For STM32F0, STM32L0, STM32F1 and STM32F3 series (FS core only):
HAL_PCD_PMA_Config()


衔胆栖冰 发表于 2017-3-12 22:52:44

不明白为什么那么多人要用多端口。你一个端口调通了吗?

衔胆栖冰 发表于 2017-3-12 22:56:22

本帖最后由 衔胆栖冰 于 2017-3-13 09:29 编辑

这个不叫多端口。只是用不同的端点进行收发而已。

huanhuanhdu 发表于 2017-3-13 12:37:13

衔胆栖冰 发表于 2017-3-12 22:56
这个不叫多端口。只是用不同的端点进行收发而已。

使用0x01/0x81 端口已经调试通了。但是之前的设计是0x02/0x86 端口上通信的,从CY7C68013A 到STM32F103 上都使用的是0x02/0x86 端口。这次F407 需要和之前的做兼容,还请老师指教!@衔胆栖冰

衔胆栖冰 发表于 2017-3-13 15:02:49

huanhuanhdu 发表于 2017-3-13 12:37
使用0x01/0x81 端口已经调试通了。但是之前的设计是0x02/0x86 端口上通信的,从CY7C68013A 到STM32F103...
我是菜鸟,这个看不出个啥:D
页: [1]
查看完整版本: F407 USB使用多个端口无法与PC通信