Two Nucleo Serial Communication via TX and RX and vice versa

I would recommend to read the serial data first into a 64 byte receive buffer until the buffer is full or readable is false. Then write the bytes to the other serial, between each byte write check for additional incoming data.

For high speed serial communication you may miss receive characters.

There is as well a BufferedSerial library available here on Mbed, however with faster speeds, e.g. 115200 it misses characters or has buffer overwrites.

I finally switch to DMA serial transfers, which is quite a big development tasks and it works only with my STM32L4 chip.

Regards
Helmut