0
\$\begingroup\$

enter image description here

I have this configuration of MCUs.

I need to know how connect the STlink on NUCLEO to discovery because I need the Virtual com PORT.

\$\endgroup\$
2
  • \$\begingroup\$ The Discovery board has it's own built-in STLink with virtual COM port. Why do you need to use the one on the NUCLEO board? \$\endgroup\$
    – kkrambo
    Commented Jun 3, 2023 at 7:32
  • \$\begingroup\$ Do you want to connect to a virtual COM port on a PC? Or do you want to connect the two boards to each other? \$\endgroup\$
    – kkrambo
    Commented Jun 3, 2023 at 7:34

1 Answer 1

1
\$\begingroup\$

I am assuming you want to connect two boards using USB cable and establish serial communication between them.

The Discovery board has USB Micro-AB port with OTG support (CN5). This can work as USB host. You need USB cable with Micro-A connector on this side. And of course you have to configure USB host in Cube middleware.

On the Nucleo board you have two choices.

First, the STLink Mini-B port (CN1) is connected to on-board STLink MCU, so you cannot use it directly. However STLink pins PA2, PA3 are by default connected via solder bridges to the target F401 USART port. This allows you to use USART without bothering with "virtual" stuff and STLink will create VCP and basically act as USB-to-UART dongle. You would need Mini-B connector on this side of the cable.

Alternatively, you can wire your own USB socket to pins PA11, PA12 and then configure USB device in middleware.

As for actual coding, there are tons of examples on the web, including this site. Here are some examples: configure CDC on F401RE, F401RE as a USB device

And here CDC device and host is almost exactly your setup, with nice detailed video.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.