cancel
Showing results for 
Search instead for 
Did you mean: 

USB Device Virtual COM port on STM32F103RBT6 Nucleo CubeMX Keil

john1389
Associate II
Posted on July 22, 2016 at 19:23

Does CubeMX supports the above?

I tried and CubeMX failed on USB selection with error, ''USB device not available. Active only when USB OTG FS IP is configure in Device mode''.

There was a

/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=https://my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Nucleo-F103RB%20%20%2b%20USB&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD06506F5B&currentviews=658

dated 2014. The hardware portion is still valid, right?

When I download the lib 4.0.0 as the post, it advises that I should use CubeMX for new design.

Is it very difficult to mix CubeMX generated HAL code with the 4.0.0 library?

#usb-device-library-stm32f103rbt6 #usb-cubemx-hsi-hse-frequency
3 REPLIES 3
Posted on July 22, 2016 at 20:17

You are not supposed to mix CubeMX/HAL code with the older SPL based code. They are not designed to work together, so you'll have to decide which you want to utilize.

The hardware to get USB connectivity should remain constant, you can review the NUCLEO board ST-LINK portion to see how that F103 is wired up.

CubeMX should supposedly create code for a VCP/CDC type USB device.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
slimen
Senior
Posted on July 23, 2016 at 00:02

Hi,

http://www.st.com/content/st_com/en/products/development-tools/software-development-tools/stm32-software-development-tools/stm32-configurators-and-code-generators/stm32cubemx.html

toolcan help you to generate your necessary initialization code

and develop the basic configuration for your project.

In CubeMx 'Pinout' tab, you should enable the USB_OTG_FS peripheral as Device Only.

Then, in the 'Configuration' tab, enable Midlleware USB_Device with (CDC Virtual Port Com).

Make sure to have the STM32 Virtual COM Port Driver on your PC, downloadable from ST web

http://www.st.com/content/st_com/en/products/development-tools/software-development-tools/stm32-software-development-tools/stm32-utilities/stsw-stm32html

.It should then drive the VCP through ST-Link.

If your board is connected to the USB, a virtual com port is created and it appears in the windows device manager under ''Ports (COM & LPT)''.

For more details about STM32CubeMx, refer to

http://www.st.com/content/ccc/resource/technical/document/user_manual/10/c5/1a/43/3a/70/43/7d/DM001047pdf/files/DM001047pdf/jcr:content/translations/en.DM001047pdf

:''STM32CubeMx User Manual''

I highly recommend you to review

http://www.st.com/content/st_com/en/products/microcontrollers/stm32-32-bit-arm-cortex-mcus/stm32f1-series/stm32f103/stm32f103rb.html

page and ''STM32Cube USB device library'' (

/content/ccc/resource/technical/document/user_manual/cf/38/e5/b5/dd/1d/4c/09/DM00108pdf/files/DM00108pdf/jcr:content/translations/en.DM00108pdf

)

You can also, start from USB example under the

/content/my_st_com/en/products/embedded-software/mcus-embedded-software/stm32-embedded-software/stm32cube-embedded-software/stm32cubef1.license=1469202656html

firmware package, you find the needed include parts for your project.

Maybe you can refer to this CDC application provided within the STM32CubeF1:

STM32Cube_FW_F1_V1.4.0\Projects\STM3210C_EVAL\Applications\USB_Device\CDC_Standalone

This application shows how to use the USB device application based on the Device Communication Class (CDC)and can help you as an implementation example.

Regards

john1389
Associate II
Posted on July 31, 2016 at 18:49

Hi forumstm32,

Many thanks for your reply.

After switching to HSE, CubeMX generates USB code.

I believe HSI frequency tolerance is not enough for USB.

John