2020-10-10 08:34 PM
Hi there!
I have a Nucleo F746ZG board that I was going to use to get started with USB programming.
I've read every tutorial, every correction suggested to the HAL library (which is, as per usual, full of issues) and absolutely nothing will even get the VCP to show in windows in device manager at all.
Here are my steps:
STM32CubeIDE
New project for the Nucleo.
In the device configuration tool:
Turn off ethernet:
Connectivity->ETH->Mode->Disable (because we aren't using it and it calls Error_Handler which just makes debugging more confusing than necessary.
Turn on the USB Middleware:
Middleware->USB_DEVICE->Class For FS IP->Communication Device Class (Virtual Port Com)
leave everything else as is.
Turn on USB_OTG_FS:
Connectivity->USB_OTG_FS->Device_Only
Leave everything else as is.
Change clock configuration:
Clock Configuration->ensure To USB (MHz) is at 48MHz by whatever means you want to.
File->Save
Allow code gen.
Upload to device,
Plug in user usb cable.
Upload again for good measure.
Nothing.
The STLink VCP appears under Ports (COM & LPT) in Windows 10 Device Manager, but no reference at all to the user USB VCP.
So what is going wrong?
And where are the tutorials that actually work?
I've read everything I can find online from both STM32 and random people on the internet. None of them work. I've tried every patch to the HAL code for the CDC_Control_FS issue to do with the CDC_SET_LINE_CODING and CDC_GET_LINE_CODING issues that HAL has with the windows settings hand-shaking. No good.
I've literally tried everything I can find online, and none of it works. Trying to manually install the Windows 8 VCP STM drivers doesn't help either.
Can anyone who has this working PLEASE let me know the steps you made EXACTLY to ACTUALLY get this working and just appear?
Once I have it appearing I'm more than happy to go through the slog of getting actual data transfer myself. But that's a bit hard without even getting it to appear at all.
Thanks!
Solved! Go to Solution.
2020-10-11 02:46 AM
OK, I'm feeling stupid as I now know the answer and it's REALLY dumb, BUT, I figured I'd share since it's good to know....
DON'T USE A CHARGING CABLE FOR THE USER USB PORT....
I didn't even realize the USB cable I was using was charge-only, but it was.
So yeah....
2020-10-11 12:06 AM
After further investigation I can say the following:
In usb_device.c the MX_USB_DEVICE_Init, function calls USBD_Init, USBD_RegisterClass, USBD_CDC_RegisterInterface, USBD_Start and they all return 0, which means they all initialized correctly (i.e. USBD_OK).
However, the USBD_Interface_fops_FS functions, CDC_Init_FS, CDC_DeInit_FS, CDC_Control_FS, CDC_Receive_FS, CDC_TransmitCplt_FS never get called at all, no matter how much plugging and unplugging and uninstalling and replugging you do.
Basically, it looks completely dead after initialization is successful.
Anyone have any ideas?
2020-10-11 02:46 AM
OK, I'm feeling stupid as I now know the answer and it's REALLY dumb, BUT, I figured I'd share since it's good to know....
DON'T USE A CHARGING CABLE FOR THE USER USB PORT....
I didn't even realize the USB cable I was using was charge-only, but it was.
So yeah....