cancel
Showing results for 
Search instead for 
Did you mean: 

VCP for STM32F3

Posted on February 21, 2018 at 14:09

I'm trying to implement Virtual Com Port on STM32F3. I use IAR.

I've included all files from a demo project.

0690X00000609h4QAA.png

However I have numerous errors while compiling the project. Struggling for hours I came to this question

Is there any compiled project with VCP for STM32F3?

Note: this post was migrated and contained many threaded conversations, some content may be missing.
57 REPLIES 57
Posted on February 22, 2018 at 09:14

I'm pretty sure he means implementing a VCP on the target, not a VCP connection via the ST-Link.

I for myself didn't mess much with USB, though

Posted on February 22, 2018 at 09:14

My English is bad for sure.

The easiest way to have the VCOM working is to generate the project using CubeMX.

Select a nucleo board for a new project, the CubeMX will ask you if you want to pre-initialize the board hardware. For nucleo-64 boards the UART2 will be initialized. UART2 is connected to the ST-LINK so the ST-LINK driver on the PC will emulate COMxx and you be able to use the VCOM through COMxx (putty terminal, etc).

You can select the uart (enable it) manually as well without calling the pre-initialization wizard in CubeMX.

---

 STM32 side: you will need to add UART API to transmit/receive data via UART2. I mean HAL_UART_Transmit()/ HAL_UART_Receive() function.

Posted on February 22, 2018 at 10:17

Perhaps this helps to distinguish the USB connection via the on-board ST-Link from the Target microcontroller's USB connection:

0690X00000609knQAA.png
Posted on February 22, 2018 at 09:18

Probably you are right.

I prefer through the ST-LINK but USB/CDC is also viable solution. Slightly more effort is required when trying to transmit data reliably (need to check if the last piece of data was sent).

Posted on February 22, 2018 at 09:24

meyer.frank

‌ might be right and you prefer direct USB connection without ST-LINK

Download F1 CubeMX package and look into an example in the CubeMX installation folder:

http://www.st.com/content/st_com/en/products/embedded-software/mcus-embedded-software/stm32-embedded-software/stm32cube-mcu-packages/stm32cubef1.html

..\STM32Cube\Repository\STM32Cube_FW_F1_V1.3.0\Projects\STM3210C_EVAL\Applications\USB_Device\CDC_Standalone

Posted on February 22, 2018 at 09:28

erenburg.evgeny.002 wrote:

It's hard to understand what I want?

Yes it is.

It is not clear what, exactly, you mean by 'VCP' here.

As has been pointed out a number of times, all Nucleo boards, and some later Discover boards provide a VCP connection as part of the ST-Link.

Why can you not justuse that?

There is no target software at all required to use the ST-Link's VCP connection - as far as the target STM32 is concerned, it is just a UART connection.

EDIT

See this post for an explanation of the on-board ST-Link:

https://community.st.com/0D50X00009XkX22SAF

Posted on February 22, 2018 at 09:31

AvaTar wrote:

I'm pretty sure he means implementing a VCP on the target, not a VCP connection via the ST-Link.

Me too - I have made that point many times already!

But the OP doesn't seem clear on the difference - which is probably why he failed to explain?

Posted on February 22, 2018 at 09:34

Bogdan Golab wrote:

I prefer through the ST-LINK

Likewise.

And, given the trouble the OP seems to be having, I think it's probably the more appropriate solution here.

USB/CDC is also viable solution.

Maybe that's the key term the OP needs to be searching for - rather than 'VCP' ... ?

Slightly more effort is required

Hugely

more effort is required in getting the USB stack working!!!

:(

Posted on February 22, 2018 at 09:35

I think I also mentioned both approaches so it's up to the Author of the post which one is better. You know my English is really bad and my responses might be misleading.

The best option is to start experimentation and try both options;)

Posted on February 22, 2018 at 10:00

Neil.Andrew wrote:

There is no target software at all required to use the ST-Link's VCP connection - as far as the target STM32 is concerned, it is just a UART connection.

Like this:

0690X00000609miQAA.png