2016-11-20 10:04 PM
i have tryed to make working an usb hid mouse program (simulating mouse move) from cubemx: usb_otg_fs
folowing youtube stm sample:https://www.youtube.com/watch?v=XRocqTfUxbo
my platform is STM32F746DISCO
cubemx 1.5.1i have also added blinking led: this part is working, the usb part don't do anything, the mouse isn't view when i connect it on the PC (no enumeration) and of course no mouse movement
i have tryed to add # USE_USB_FS in the Precompiler but nothing more!
then i tryed other platform stm32f3 discoand stm32f4disco and it's working!
could you help me please i am out of idea.
2016-11-21 04:01 AM
Hello,
It seems you are confusing CubeMx/firmware versions: STM32CubeMx version 4.17.0 and fimware package version 1.5.1Make sure that you've configured the right pins compared to the datasheet of used .You can refer to your product datasheet and reference manual for more clarification about your product.I Suggest you start with a working USB example similar to your application for your used discovery to identify what is going wrong in your case. In the STM32CubeF7 package, you may find a HID example in this folder: STM32Cube_FW_F7_V1.5.1\Projects\STM32746G-Discovery\ApplicationsRegards2016-11-22 11:55 PM
hi,
yes sorry for confusion cube mx 4.0 & firmware 1.5.1
i have worked on the usb example (working) i have looked on the configuration of the gpio and dont find difference. i also look the clock seem to be nearly the same.
i have tryed to modify the little things that differ from the sample but no result.
my collegue got the same result on hisbench with another stm32f7disco.
maybe its a configuration in cube mx but dont see where.
i attach the main.c if you want to look.
________________ Attachments : main.c : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006HzKY&d=%2Fa%2F0X0000000bNw%2FlkhZgFAG3UC7PBqmihZfnHw_CI.X7FT.nKsL6SBchb0&asPdf=false2016-11-24 05:32 AM
Eureka!!
i have find the problem: its coming from the usbd_conf.c
2 values are wrong in the file generated by the cube!
USBD_StatusTypeDef
USBD_LL_Init (
USBD_HandleTypeDef
*pdev)
{
/*
Init
USB_IP */
if
(pdev->
id
== DEVICE_FS) {
/* Link The driver to the stack */
hpcd_USB_OTG_FS.
pData
= pdev;
pdev->
pData
= &hpcd_USB_OTG_FS;
hpcd_USB_OTG_FS.
Instance
= USB_OTG_FS;
hpcd_USB_OTG_FS.Init.dev_endpoints = 6;//<--Wrong value should be 4
hpcd_USB_OTG_FS.
Init
.
speed
= PCD_SPEED_FULL;
hpcd_USB_OTG_FS.
Init
.
dma_enable
=
DISABLE
;
hpcd_USB_OTG_FS.
Init
.
ep0_mps
= DEP0CTL_MPS_64;
hpcd_USB_OTG_FS.
Init
.
phy_itface
= PCD_PHY_EMBEDDED;hpcd_USB_OTG_FS.
Init
.
Sof_enable
=
DISABLE
;
hpcd_USB_OTG_FS.
Init
.
low_power_enable
=
DISABLE
;
hpcd_USB_OTG_FS.
Init
.
lpm_enable
=
DISABLE
;
hpcd_USB_OTG_FS.Init.vbus_sensing_enable = ENABLE;//Wrong value should be
DISABLE
hpcd_USB_OTG_FS.
Init
.
use_dedicated_ep1
=
DISABLE
;
if
(HAL_PCD_Init(&hpcd_USB_OTG_FS) !=
HAL_OK
)
{
Error_Handler();
}
HAL_PCDEx_SetRxFiFo(&hpcd_USB_OTG_FS, 0x80);
HAL_PCDEx_SetTxFiFo(&hpcd_USB_OTG_FS, 0, 0x40);
HAL_PCDEx_SetTxFiFo(&hpcd_USB_OTG_FS, 1, 0x80);
}
return
USBD_OK
;
}