Hello, I am currently trying to make my stm32 + FTDI so make the serial port working.
with the following circuit:
I managed to make it working on the arduino IDE with the following configration:
And using Serial1 in the code.
Note that for uploading I use a ST-LINK V2 adapter
Now this is my platformIO config for this project
PlatfromIO does show the good serial port but I cannot find how to print anything
You explicitly enable the USB Serial (CDC), so by default Serial
will go to USB device. Not via UART (PA9/10).
What src/main.cpp code are you running on the STM32?
This is my code, nothing complicated
The constructor arguments look wrong, shouldn’t they be PA9
and PA10
instead of PA_9
, PA_10
?
To my knowledge, they are the same, but replacing them changes nothing
Okay, indeed both the int
version (PA9) and PinName
enum (PA_9
) are accepted. But RX and TX are reversed.
PA9 = Serial1 TX and PA10 = Serial1 RX
the constructor wants
aka, RX first, then TX.
So you should write
HardwareSerial Serial1(PA10, PA9);
Okay yes, my mistake.
how should I fix that ?
When I remove the problematic line, the code doesn’t compile
I wonder what should my platform.ini look like