2015-08-14 12:35 AM
Hi!
I used CubeMx to generated USB HID Device example code and update to F4_Discovery Kit.The default endpoint address is 0x01 and 0x81. I could send data from PC to STM32F4 via USB. and STM32F4 also could send data to PC.But. when I modified the endpoint address to 0x02 and 0x82, the PC could not received data form STM32F4.Is anyone has the same experience can help me solve this issue?I just modified below defines &sharpdefine CUSTOM_HID_EPIN_ADDR 0x82&sharpdefine CUSTOM_HID_EPOUT_ADDR 0x02the file is ''usbd_customhih.h''Stm32CubeMX version: V4.8.0
STM32CubeF4 Firmware Package V1.6.0 Thanks.Chansong #usb-endpoints-change2015-08-14 01:59 AM
Hi lee.chansong,
I tried the example under STM32Cube_FW_F4 package:STM32Cube_FW_F4_V1.7.0\Projects\STM324x9I_EVAL\Applications\USB_Device\HID_Standalone.I make the following modifications: 1. In usbd_hid.h file I modified the endpoint address:#define HID_EPIN_ADDR 0x822. In usbd_conf.c file:In the function USBD_StatusTypeDefUSBD_LL_Init(USBD_HandleTypeDef *pdev):I modified: HAL_PCDEx_SetTxFiFo(&hpcd, 1, 0x80); => HAL_PCDEx_SetTxFiFo(&hpcd, 2, 0x80);I did a test and it works correctly. -Syrine-2015-08-14 02:26 AM
Have a look to the FIFO RAM allocation paragraph in the
, it can be useful.-Syrine-2015-08-14 02:42 AM
Hi! Syring
Thanks for your quickly reply.I followed your suggestion and it work fine.I also did another test, to keep ''HAL_PCD_SetTxFiFo(&hpcd_USB_OTG_FS, 1, 0x80); '', and add ''HAL_PCD_SetTxFiFo(&hpcd_USB_OTG_FS, 2, 0x80); ''The PC can not received data for USB EP2. What is the reason to cause the PC can not receive USB data?ThanksChansong2015-08-14 04:01 AM
I don't understand why do you keep ''HAL_PCD_SetTxFiFo(&hpcd_USB_OTG_FS, 1, 0x80); ''
What is the reason from this modification? What do you think doing?-Syrine-2015-08-16 06:52 PM
Hi!
Because I went to try Implement USB Composite device and declare 2 endpoint.Does CubeMx can generate USB composite device sample code?And could you please provide some suggestion about USB composite? ThanksChansong2015-08-24 06:31 AM
Hello Chansong,
STM32CubeMX does not support code generation for composite classes as it is not yet supported by the USB middleware library coming with STM32Cube embedded software packages. Best regards.