2017-11-09 01:37 AM
Hi,
I am trying to start with USB CDC on stm32h7. I create new project with CubeMx + STM32Cube_FW_H7_V1.1.0 (cubemx file attached). After compile usb device doesnt appear on the system.
Regards
Mike
#stm32h743 #virtual-comport-stm32 #cdc #stm32h7 #usb-device #usb-fs-cdcSolved! Go to Solution.
2017-11-09 07:12 AM
Hi Mikolaj,
I had the same problem, this function solved it :
HAL_PWREx_EnableUSBVoltageDetector() .
Please add this function call to usb_device.c file like this.
void MX_USB_DEVICE_Init(void)
{ /* USER CODE BEGIN USB_DEVICE_Init_PreTreatment */ /* USER CODE END USB_DEVICE_Init_PreTreatment */ /* Init Device Library,Add Supported Class and Start the library*/ USBD_Init(&hUsbDeviceFS, &FS_Desc, DEVICE_FS);USBD_RegisterClass(&hUsbDeviceFS, &USBD_CDC);
USBD_CDC_RegisterInterface(&hUsbDeviceFS, &USBD_Interface_fops_FS);
USBD_Start(&hUsbDeviceFS);
/* USER CODE BEGIN USB_DEVICE_Init_PostTreatment */
HAL_PWREx_EnableUSBVoltageDetector(); /* USER CODE END USB_DEVICE_Init_PostTreatment */}Hope it helps!
Marina
2017-11-09 07:12 AM
Hi Mikolaj,
I had the same problem, this function solved it :
HAL_PWREx_EnableUSBVoltageDetector() .
Please add this function call to usb_device.c file like this.
void MX_USB_DEVICE_Init(void)
{ /* USER CODE BEGIN USB_DEVICE_Init_PreTreatment */ /* USER CODE END USB_DEVICE_Init_PreTreatment */ /* Init Device Library,Add Supported Class and Start the library*/ USBD_Init(&hUsbDeviceFS, &FS_Desc, DEVICE_FS);USBD_RegisterClass(&hUsbDeviceFS, &USBD_CDC);
USBD_CDC_RegisterInterface(&hUsbDeviceFS, &USBD_Interface_fops_FS);
USBD_Start(&hUsbDeviceFS);
/* USER CODE BEGIN USB_DEVICE_Init_PostTreatment */
HAL_PWREx_EnableUSBVoltageDetector(); /* USER CODE END USB_DEVICE_Init_PostTreatment */}Hope it helps!
Marina
2017-11-11 05:34 PM
Its now workingk. Thank you Marina.
2017-11-16 06:40 AM
Hello,
Thank you to share this issue. I raised it internally to the appropriate team for work and fix it.
Best Regards
Imen
2017-11-28 11:34 PM
May be you know how to resolve, I worked with nucleo144 board (stm32f767) and I had some problem. Windows define board how unkown usb device. But Keil debuger stopped in irq handler 'void OTG_FS_IRQHandler(void)'. May be I dont`t initialize any option.
2017-12-11 10:38 AM
I'm having this same issue with my nucleo144 (F767) board.
I get interrupts going to OTG_FS_IRQ_Handler, which calls HAL_PCD_IRQHandler.
BUT, none of the functions hooked using USBF_Interface_fops_FS are ever called. CDC_Init_FS never gets called.
I have been tracing the code for the last week and the functions get hooked into hpcd-> pData properly, but I can't figure out where the HAL_PCD routines actually call the routines that are pointed at.
I tried putting in the call to
HAL_PWREx_EnableUSBVoltageDetector
, which didn't make sense,
but it doesn't seem to exist in F7 HAL version 1.8.0.It's like the CDC/PCD connection is broken in 1.8.0.
Andrei
2017-12-12 01:08 PM
Hi Andrei,
I was using this function because the usb voltage on stm32h7 comes from VDD33 voltage level detector.
So the code is actually:
void HAL_PWREx_EnableUSBVoltageDetector(void)
{
/* Enable the USB voltage detector */
SET_BIT(PWR->CR3, PWR_CR3_USB33DEN);
}
Is stm32f767 has a USB regulator that needs to be enabled?
2018-05-08 04:12 AM
Thank you for sharing! I am working on a recently designed STM32H743II board and faced the same issue! Even the latest CubeMX4.25.0 and STM32H7Cube 1.2 dont fix this issue.
Next problem I am facing is to detect a USB memory stick attached to the USB HS HOST port using the MSC class. The USBH_Process() is always in the HOST_IDLE state.
Best regards
Dirk
2018-05-08 04:39 AM
Hello
Handzic.Dirk
,ST team is aware about the issue ofmissing call to HAL_PWREx_EnableUSBVoltageDetector( ) and should fix this limitation in the coming release, but all
depends on releases planning and expected fixes or new features to embed.
It should be better to start a new discussion for new issue with more details even if the topic is the same.
Best Regards,
Imen.
2018-05-08 09:16 AM
Hi Dirk,
Glad it helped!
I need to support a host mode as well as device mode.
How did you connect a usb host side cable to the nucleo board?
Thanks,
Marina