How can I tell what U(S)ART is used with setTx() and setRx() when more than one is possible? #2319
-
Using for example STM32L4R5, setting serial Rx and Tx to PC11 and PC10 How do I know what peripheral is beeing used? Also, is there a difference in using setTx() and setRx() and defining a new HardwareSerial using HardwareSerial newSerial(Rx, Tx)? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
Hi @MasteringTheMess To choose the right instance you can use the _ALTx notation. mySerial.setTx(PA2_ALT1);
mySerial.setRx(PA3_ALT1); while using: mySerial.setTx(PA2);
mySerial.setRx(PA3); will use Note that the PeripheralPins.c reference the |
Beta Was this translation helpful? Give feedback.
-
Thanks! ...so, using the Arduino pin numbers will choose the first instance that is found in the PeripheralPins.c file? |
Beta Was this translation helpful? Give feedback.
Hi @MasteringTheMess
You can find the information in the PeripheralPins.c, all possible value are referenced here:
Arduino_Core_STM32/variants/STM32L4xx/L4R5Z(G-I)T_L4R7ZIT_L4S5ZIT_L4S7ZIT/PeripheralPins.c
Lines 208 to 209 in 8f337e8
To choose the right instance you can use the _ALTx notation.
Example to use
USART2
while using:
will use
LPUART1
.Note that the PeripheralPins.c reference the
PinName
(PY_n
). Arduino API …