Skip to content

Correct use of HardwareSerial #2226

Closed Answered by fpistm
brightproject asked this question in Libraries
Discussion options

You must be logged in to vote

By default, in STM32 you can only use serial port 1 and we designate its Serial

No. Serial is simply an alias to the specified Serialx defined in the variant.
Ex for generic F401RB:

// UART Definitions
#ifndef SERIAL_UART_INSTANCE
#define SERIAL_UART_INSTANCE 2
#endif
// Default pin used for generic 'Serial' instance
// Mandatory for Firmata
#ifndef PIN_SERIAL_RX
#define PIN_SERIAL_RX PA3
#endif
#ifndef PIN_SERIAL_TX
#define PIN_SERIAL_TX PA2
#endif

So Serial is Serial1.

But for Generic F412ZG:

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

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

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