ST


A world leader in providing the semiconductor solutions that make a positive contribution to people’s lives, both today and in the future.

You are viewing an older revision! See the latest version

Use of D0D1 Arduino pins

On Nucleo 64-pins boards, the D0 and D1 pins are not available per default as they are used by the STLink Virtual Comm Port (used for printf for example).

If you want to use these pins (instead of the default Virtual Comm Port) you need to close SB62/SB63 and open SB13/SB14 solder bridges.

More information in the board user manual.


To use another USART for the Virtual Comm Port, follow this steps:

  • Check in the pinout image (described in the platform page), which USART (= Serial) is used per default on the D0/D1 pins. For example on the NUCLEO_F401RE it is USART2 (= Serial2).
  • Select another USART of your choice (but not the same as the default one). For example on the NUCLEO_F401RE we can select USART1 (Serial1) which is available on pins D2 (Serial1 RX) and D10 (Serial1 TX).
  • Put a wire between D2 and CN3-TX, and another wire between D10 and CN3-RX. The CN3 connector is placed on the PCB upper-part.
  • In your code declare a Serial object and use it as a standard printf:

Serial my_serial(D10, D2); // TX, RX
my_serial.printf("Hello!\n");

For Advanced users
If you want that remaining printf present in mbed core files (to print errors, debug information etc...) continue to be displayed, you will need to update these 2 files by changing the USART and pins you have choosen:

  • PinNames.h

    SERIAL_TX   = PA_2,
    SERIAL_RX   = PA_3,
    USBTX       = PA_2,
    USBRX       = PA_3,
  • PeripheralNames.h

#define STDIO_UART_TX  PA_2
#define STDIO_UART_RX  PA_3
#define STDIO_UART     UART_2

All wikipages