cancel
Showing results for 
Search instead for 
Did you mean: 

Basic USB CDC Project

kabla002
Associate
Posted on April 30, 2014 at 08:23

Hi Everybody, 

I'm trying to get a basic USB communications device class device project working using the STM32F429I-Disco board. I'm using  smt32cube application to generate the code for the Keil uVision environment. When I run the code on my board and plug the user usb port into my laptop I get a device not recognized error from windows. I don't think its enumerating correctly because I don't see the device or vendor ids in the device id box when I look at the driver properties. Basically I just use the cube software to generate a project (configure usb, & clock), compile it, and run it. Everything compiles fine, and seems to run ok (no hard faults) on hardware. I don't do any configuration of the cube generated firmware because it's not really clear to me what else I need to configure. Could anybody give me a hint as to what I might be missing? Attached is my stm32cube configuration file so you can recreate my project.

Thanks,

John  

 

#stm32f4-discovery-429-usb-cube
5 REPLIES 5
longTimer
Associate II
Posted on June 23, 2014 at 23:49

Hi,

I am wondering if anyone out there can report this working?  I just got CUBE and an F4 Discovery board and followed about this same process as described here.  The resulting generated project was missing some functions when it linked. I fixed that by adding 'stm32f4xx_hal_pcd_ex.c' to the project. It now compiles (using Keil uVision4) and runs.  The PC however does not know what to make of the device.  I added a COM port '.inf' file to the PC that is keyed to the exact VID/PID of the device but no improvement. 

Any input on this would be appreciated.

Dave

longTimer
Associate II
Posted on June 25, 2014 at 17:12

Updates to question.

I have since gone back to an older, working ST USB CDC project and compaired all the Descriptor blocks byte by byte.  The only change I made was the DeviceClass from 0x00 to 0x02 (CDC) in the main descriptor.  The PC now acts somewhat better.  It detects the device and shows its description string, goes to search Windows Update, appears to find a driver, and FAILS on driver install!

I have kept the CUBE generated code settings of VID=0483 and PID=5740.

Any ideas?

 

chen
Associate II
Posted on June 25, 2014 at 18:12

Hi

I have not used the Cube generated code, worked with the discontinued Peripheral Libraries.

One common cause of un-recognised USB device is the STM USB peripheral is being clocked at the wrong freq. Double check the clock config for AHB bus

longTimer
Associate II
Posted on June 25, 2014 at 19:45

Thanks for the suggestion.

Part of my mission here is to learn and gain confidence in the CUBE tool. So far the confidence part is a little short. I am attaching an image of the cube provided clock settings. It appears that the special 48MHz clock is being properly configured.

I realize that USB starts slow and can increase speed based on device capabilities. Would the PC be able to show the Device Description string from the device if the clock is wrong? That string is appearing on the PC correctly.

Dave

________________

Attachments :

CUBE-Clock.TIFF : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006I04Z&d=%2Fa%2F0X0000000bT6%2FdeFb8cAeM1_wzCnuZlVHvVuMmDD4NhjC7wi7y0Fe3gw&asPdf=false
chen
Associate II
Posted on June 26, 2014 at 10:49

Hi

As I said, I have not used the Cube code generator - so I cannot help with regards configuring STMCube.

''Would the PC be able to show the Device Description string from the device if the clock is wrong?''

No. USB specification for data clocking are very specific.

Hence, my suggestion about checking the STM32 USB peripheral clock.

I found at the start of my project that the USB peripheral clock had not been set correctly and I could not get the PC to enumerate the STM32 USB device.