Page 1 of 1

Serial1 seem to work but no output

Posted: Sun Jan 16, 2022 10:50 pm
by capotti
Hello,

I got my own pcb running with blink example.
CPU: STM32G030K6T6
I have connected a USB to Serial Adpater (for Wemos D1) to TX (PA9) AND RX (PA10)
each Second a Text is send with Serial1.println().
The LED of the Adapter blinks if data is sending (each second)
but in the Serial Monitor (Arduino IDE) There is no output at all (Baud 9600)
Script:


int ledPin = PB5;
HardwareSerial Serial1(PA10, PA9); // RX, TX

void setup() {
pinMode(ledPin, OUTPUT);
Serial1.begin(9600);
while (!Serial1) { }
}

void loop() {
Serial1.println("Test Text ");
delay(1000);
digitalWrite(ledPin, HIGH);
delay(1000);
digitalWrite(ledPin, LOW);
}

Can anyone help me?

Re: Serial1 seem to work but no output

Posted: Mon Jan 17, 2022 9:41 am
by ABOSTM
Hello @capotti,
I tested on my nucleo_G071 which is close to STM32G030K6T6 (no differences regarding UASRT)
And your sketch is well working, output is displayed on Arduino serial monitor (through an external st-link connected to PA9/PA10).

Just to be sure, can you confirm the following:
* your USB to serial is connected to PA9/PA10 and not PA11/PA12 (there is a remap capability on this chip, so that PA12 pin is behaving as PA10)

* TX (PA9) AND RX (PA10) this is correct on STM32 part, but for proper communication connection should be crossed with serial adapter:
STM32 USART TX <--> USB2serial RX
STM32 USART RX <--> USB2serial TX
So can you invert connections on USB2serial and check ?

* Are you sure your USB to Serial adapter from Wemos D1 is working properly?

Re: Serial1 seem to work but no output

Posted: Mon Jan 17, 2022 1:40 pm
by capotti
Thank you very much!
I really forgot to crosswire RX TX.
Now it works as intended.

Funny background: I used an Pro Mini Clone from Ali with wrong Pin-Labeling. Because the UART Adapter should be sticked direckty on the board the manufacturer meant it should get the same PIN labels like the adapter...