2020-07-09 09:12 AM
Is there anybody out there who got the USB running as VCP on a STM32L552 ?
We have problems to get the system running with USB attached to a PC via VCP. We used the MXCube release 5.6.1 and created a small project with USB VCP. The VDD-USB Pin is connected to 3.3V, the system boots, but USB is not detected on the PC side.
We have USB as VCP working on several other processors before (STM32F4, STM32F7, STM32H7) without any issues. But on L552 there must be something different which is not working when using the same firmware handling and hardware layout.
Any comments are very much appreciated.
Solved! Go to Solution.
2021-08-02 11:38 AM
Hi RDKS,
good to know for eventual future use. We always use HSE and therefore did not encounter the problem you described.
BR GS
2021-08-17 10:51 AM
Good evening,
It seems I just see the problem to use CDC class with a new project created with latest HAL Version 1.4.0.
In my previous project with identical hardware setup and HAL Version 1.2.0 I got USB CDC class working seemlessly. But in the new project I am stuck currently.
The HAL sets the USB connection to "Suspended".
As soon as the call to "USB_DevConnect" (in HAL_PCD_Start) is processed my PC tells me "USB Device can not be detected...".
Comparing the difference between the 2 version is actually not possible as too many changes have been done by ST.
Did you find a solution in your project meanwhile?
2021-08-18 07:58 AM
HAL 1.4.0 works for me.
I created a demo project here in case you are interested: https://github.com/tickelton/stm32l562_usb_cdc_demo
There are a couple of caveats, though:
--- a/USB_Device/App/usbd_cdc_if.c 2021-08-18 16:39:03.489377113 +0200
+++ b/USB_Device/App/usbd_cdc_if.c 2021-08-02 17:19:28.353500125 +0200
@@ -284,11 +284,15 @@
uint8_t result = USBD_OK;
/* USER CODE BEGIN 7 */
USBD_CDC_HandleTypeDef *hcdc = (USBD_CDC_HandleTypeDef*)hUsbDeviceFS.pClassData;
- if (hcdc->TxState != 0){
- return USBD_BUSY;
+ if (hcdc) {
+ if (hcdc->TxState != 0){
+ return USBD_BUSY;
+ }
+ USBD_CDC_SetTxBuffer(&hUsbDeviceFS, Buf, Len);
+ result = USBD_CDC_TransmitPacket(&hUsbDeviceFS);
+ } else {
+ result = USBD_BUSY;
}
- USBD_CDC_SetTxBuffer(&hUsbDeviceFS, Buf, Len);
- result = USBD_CDC_TransmitPacket(&hUsbDeviceFS);
/* USER CODE END 7 */
return result;
}
2021-08-18 10:56 AM
Hello RDKS,
thank you very much for your post.
I copied your implementation just the same way - also had a look at alle GPIO inits etc., but still this does not get the USB to work. PC refuses to detect the device.
I also tried to create the project with version 6.2. and HAL 1.2.0 (which works with a former system), but this doesn't work either with the new board.
I guess the hardware development department has to check all lines again...
Thank you anyway!
Have a good evening. BR.
GS
2021-08-18 11:30 AM
Ok, we found the reason:
There was a 10k resistor on the VDD_USB line, which had to be removed. This resistor was introduced in the new project due to a recommendation - but this was obviously a wrong one.
So now my USB port is working!