Skip to content

USART Confusion - NUCLEO-L412KB #2112

Closed Answered by fpistm
LexNastin asked this question in Q&A
Discussion options

You must be logged in to vote

STM32L412KC has 2 USART (USART1 and USART2) and 1 LPUART1:
https://github.com/stm32duino/Arduino_Core_STM32/blob/01e4f0c9a8d20fc20125fd5be539a1ef3bf9d546/variants/STM32L4xx/L432K(B-C)U_L442KCU/PeripheralPins.c#L111C2-L130

By default USART2 is used for the VCP through the STLink using PA2 and PA15 pins.
This prevent to use LPUART1 as only PA2 offered LPUART1 TX.

As only 1 pin can be used for USART2 and LPUART1 TX you could not having 3 SERIAL at the same time. Anyway you can simply switch between then:

Serial2.end();
SerilaLP1.begin();
Serial.LP1.print("something");
SerilaLP1.end();
Serila2.begin();
...

https://github.com/stm32duino/Arduino_Core_STM32/wiki/API#hardwareserial

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@fpistm
Comment options

Answer selected by fpistm
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants