cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F070 USB CDC Example

Muhammad Moiz khan
Associate II
Posted on October 07, 2016 at 13:13

Hello,

I am using STM32F070 microcontroller and current implementing USB CDC, I was searching a basic example of USB CDC on STM32F0, but not able to find any appropriate one, any help in this regard would be highly appreciated. 

7 REPLIES 7
Nesrine M_O
Lead II
Posted on October 07, 2016 at 14:11

Hi khan.muhammad_moiz,

You can start from USB example under the STM32F0 cube firmware package, it may be helpful:

STM32Cube_FW_F0_V1.6.0\Projects\STM32072B_EVAL\Applications\USB_Device\CDC_Standalone

 

-Syrine-

Muhammad Moiz khan
Associate II
Posted on October 09, 2016 at 13:04

Thanks for the reply,  I have used the USB driver and its library on Coocox IDE, after compiling it successfully when I connect my USB on my hardware, the message pops up USB Device not recognized. I saw my hardware it seems to be fine, Can anybody suggest me what might be the case of this problem?

Muhammad Moiz khan
Associate II
Posted on October 13, 2016 at 11:52

Hello sir,

I have followed CDC standalone example and used the same libraries of CDC, USB library and USB driver for STM32F070 microcontroller but the issue is that after getting implemented on my microcontroller when I connected USB my PC is not recognizing my hardware. 

It is showing as ''Unknown device'' and giving warning:

''Windows has stopped this device because it has reported problems (Code:43)''

Any help in this regard would be appreciated.

Mon2
Senior III
Posted on December 11, 2016 at 05:26

Noting the same while testing for DFU mode using BOOT0 strapping to VDD. Still under review but can confirm that if you test using the STM32F072 DISCOVERY board (DISCO board offers 2 x USB connectors so makes CDC example testing a breeze), the CubeMX generated code works. Tested on Friday using only the Device Manager and no user code was inserted. Quite nice on how this wizard tool works - should save weeks of time for quick prototyping.

Summary: DISCOVERY STM32F072 board works as-is using the CubeMX wizard for the CDC auto-generated example.

On Monday, will review the same against a STM32F070 Nucleo board, weather permitting

rwmao
Senior
Posted on December 11, 2016 at 05:52

Hello Moiz,

you may check this link, there is pdf file there. 

https://bitbucket.org/rwmao/cdc_onstm32f411rc/src

The problem may be caused by the hardware setting or the setting in code.

Please read through the pdf file to see if it fixes your problem.

That is the note I summarized when I study the CDC on STM32 chip.

Posted on December 11, 2016 at 06:05

Thanks mao for your valuable post. See the 1k5 PU for the USB D+ line. According to the ST datasheets, this resistor should not be required. We will experiment next week but you found the 1k5 external resistor must be applied for a working solution ?

Here is a post of a PCB with the STM32F070F6P6 (20 pin TSSOP) that is shown to be working and does not have the 1k5 pull-up. So far, our testing with the STM32F070 (on the Nucleo) board is not working in the DFU mode (control panel = 'Unknown Device'); have the external 8 mhz clock / crystal. Wonder if there are different firmware releases inside the STM32F070 ? A detailed review will follow for us next week.

http://e.pavlin.si/2016/02/03/stm32f070-usb-miniature-dongle-for-prototyping/

 
Posted on December 11, 2016 at 06:44

https://www.silabs.com/Support%20Documents/TechnicalDocs/AN0046.pdf

 

On page 6, there is instruction for microcontroller as a device(CDC). 

In the instruction, it also tells it may work even it doesn't have an external R. I believe you can enable the pull-up resistor in the code(enable the pin as pull-up). it may not be fully compatible with usb2.0 but it will work mostly.

In my case, I don't enable the pull-up, instead adding an extern 1.5k resistor to it.

Please note that it is for CDC, i.e. device only. For using the chip as a host, it is different.

btw, in terms of usb, the chips are pretty much same.