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

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 these 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 the USART1 (Serial1). The Serial1 TX pins are available on D8 (= PA_9) and D10 (= PB_6). The Serial1 RX pins are available on D2 (= PA_10) and on the Morpho connector. We can also select the USART6 as well but for the purpose of this example we continue with USART1 D2/D10 pins.

  • Put a wire between D2 (RX) and CN3-TX, and another wire between D10 (TX) and CN3-RX. The CN3 connector is placed on the PCB upper-part.
  • In your program, declare a Serial object and use it as a standard printf:

Serial my_serial(D10, D2); // TX, RX

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 also these 2 files and change the USART name and pins you have choosen:

  • PinNames.h

    SERIAL_TX   = PB_6,
    SERIAL_RX   = PA_10,
    USBTX       = PB_6,
    USBRX       = PA_10,
  • PeripheralNames.h

#define STDIO_UART_TX  PB_6
#define STDIO_UART_RX  PA_10
#define STDIO_UART     UART_1