1
\$\begingroup\$

I've made a desktop application which interfaces with an Arduino board via serial ports. Now as I have completed my project in theory, I want to make a more professional PCB with a higher clock speed, so I chose the STM32F103C8T6 as the MCU which my board revolves around.

The serial communication between my computer and the Arduino board is done via an FTDI chip (like FT232RL or CH340). Do I need to use such a chip on the STM32 board also and connect it to Tx and Rx of the MCU (PA9, PA10), or should I use D+ and D- directly?

\$\endgroup\$
2
  • 3
    \$\begingroup\$ CH340 is not made by FTDI. \$\endgroup\$
    – Justme
    Commented Oct 19, 2022 at 18:05
  • \$\begingroup\$ Thanks for your reply , I will be pleased if your thoughts regarding My problem \$\endgroup\$ Commented Oct 19, 2022 at 18:26

1 Answer 1

1
\$\begingroup\$

If you insist on using an FTDI chip, you will have to attach it to UART of your STM32.

But: stm32F103c8t6 has USB built in. You can do without the FTDI chip alltogether, and attach your USB to the USB peripheral (the D+ and D-). However, you will then have to use / write a firmware for the STM32 that handles all the USB you need to get a serial link (an "ACM peripheral"). There's examples from ST that do that for you. It's still work.

So, it's either:

  • Use an FTDI USB-to-UART adapter IC and connect to the UART Rx and Tx lines, or
  • Directly attach the stm32F103c8t6 to USB, and include the USB functionality in your firmware.
\$\endgroup\$
2
  • \$\begingroup\$ Thank you for your answer I'm not insisting on anything , I only want to know the options that I have I will give you an example for what I want to do for example I want to send A number from the Desktop App to the MCU , the MCU double it and return the value to the serial port it will be something like that Desktop app MySerialport.write(Number); Myserialport.readline(); Arduino side if Serial.available>0 {int x=serial.read() ; x=x*2: Serial.println(x);} the question is , Can I Use the HAL_UART library if I use the USB directly in STM32 or I must create my own function \$\endgroup\$ Commented Oct 19, 2022 at 18:22
  • 1
    \$\begingroup\$ you will have to use a HAL that supports USB, not UART. \$\endgroup\$ Commented Oct 19, 2022 at 18:24

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.