I am trying to communicate to a lantronix server using serial as well as communicate to a ATMega8 MCU using serial. The issue I have is I don’t know how to open 2 serial ports. I have labelled them “serial” and “serial1” but it doesn’t seem to work. I set them up the same way in the main function with the information below:
for a Nucleo_F411 e.g. it looks ok, both serial use different uart and the pins are in the pinmap:
But if your board is a STM Nucleo, the Pins PA_2 and PA_3 are usually not connected to the header pins, they are routed to the virtual COM on the STLink. If that is the case, you should use other pins like in the PinMap.
The default setting for the serial is already 8N1 and you can add the baudrate as third argument to the constructor.