cancel
Showing results for 
Search instead for 
Did you mean: 

USB CDC example for STEVAL-WINBOX1 (STM32U585AI)

Adeuga
Associate II

Hi all,

I'm new in programming STM32U585AI.

Bought the STEVAL-WINBOX1 and as first step tried to have working USB CDC.

Since didn't find code example in STM32CubeIDE for this specific dev kit, create a new new project based on example Ux_Device_CDC_ACM for board NUCLEO-U575ZI-Q.

Code is running successful in WINBOX1 however, PC doesn't recognised CDC device.

All project is in https://github.com/adeuga/stm_USB 

Thank you for any help.

1 ACCEPTED SOLUTION

Accepted Solutions
Adeuga
Associate II

Probably I discovered the problem.

When CAD_Check_HW_SNK is called, none of conditions to change CurrentHWcondition to HW_Attachment is fulfilled. This is happening because CC1 and CC2 in WINBOX1 is not connected to STM32.

See schematic: 

Adeuga_0-1689011755022.png

The question is then how can I put this working or do I'm missing something else?

 

 

View solution in original post

7 REPLIES 7
Stefano Oliveri
ST Employee

Hi,

I gave a look at your code, there is not a project file so it is not possible to build and run the project.

One thing that I noted is that the configuration of the USB FiFo is missing. Something like this:

  HAL_PCDEx_SetRxFiFo(&hpcd_USB_OTG_FS, 0x100);
  HAL_PCDEx_SetTxFiFo(&hpcd_USB_OTG_FS, 0, 0x10);
  HAL_PCDEx_SetTxFiFo(&hpcd_USB_OTG_FS, 1, 0x20);
  HAL_PCDEx_SetTxFiFo(&hpcd_USB_OTG_FS, 2, 0x10);

Maybe I just missed it in your code.

To look at that code fragment in a context you can give a look at the NUCLEO-U575ZI-Q UxDeviceCDCDemo demo inside eLooM_tx-SDK

That is an application framework that we use for complex embedded applications, but the CDC demo is a simple example. Also note that, even if the demo runs on the NUCLEO-U5, the USB and USBX configuration works fine also for the STWIN.box board because the peripheral is the same and the MCU belong to the same STM32U5 family and it is compatible. The USB related configurations are:

  • inside the UxDeviceCDCDemo/USBX folder
  • UxDeviceCDCDemo/mx/src/usb_otg.c file
Adeuga
Associate II

Hi,

Thank you for your fast reply.

I implemented yours proposal's changes but unfortunately didn't work. Meanwhile, found another example here https://github.com/STMicroelectronics/STM32CubeU5/tree/main/Projects/B-U585I-IOT02A/Applications/USBX/Ux_Device_HID_CDC_ACM and adapt code for STEVAL-WINBOX1 hardware.

Code is in a zip file https://github.com/adeuga/stm32_Ux_Device and can be imported to STM32CubeIDE as new file from an Existing STM32CubeMX Configuration file (*.ioc)

I would like to know what is missing since the problem persists.

MM..1
Chief III

If you import some as new from ioc, then result is complete empty project with only hw config and libs.

Real usb or other projects need more files and advanced config in files , that isnt generated.

Use other right way to import project , i prefer unzip on some place without spaces in path and double click .project file in STM32IDE folder...

Following MM..1 indications, made changes in code but still unsuccessful. Just update zip file in github.  

MM..1
Chief III

When you follow the you need see structure 

MM1_0-1688034961714.png

i dont see it in your zip file

Opened the project from https://github.com/STMicroelectronics/STM32CubeU5/tree/main/Projects/B-U585I-IOT02A/Applications/USBX/Ux_Device_HID_CDC_ACM and also don't see your structure. 

Compiled it successful. Made changes in GPIO for WINBOX1 and USB still failed (not recognised in PC).

Adeuga
Associate II

Probably I discovered the problem.

When CAD_Check_HW_SNK is called, none of conditions to change CurrentHWcondition to HW_Attachment is fulfilled. This is happening because CC1 and CC2 in WINBOX1 is not connected to STM32.

See schematic: 

Adeuga_0-1689011755022.png

The question is then how can I put this working or do I'm missing something else?