Uart2 on Nucleo L432KC

Hello, I am trying to use UART1 and UART2 on the L432KC development board:
https://os.mbed.com/platforms/ST-Nucleo-L432KC/
In the link above, it shows that UART2 rx is connected to PA3. I attempted to create a buffered Serial line with PA2 and PA3 as shown in the pinout on the STM website. However, this resulted in error. I found that UART2 RX is in fact connected to PA15 which doesn’t have a pinout. Why is it advertised on the STM website as UART2 RX?
I looked through the solder bridge configurations to see if there was some way to connect PA15 and PA3. Am I missing something with PA3 that allows UART2 rx to be passed through it? Thanks in advance for any help!

Hello,

in default configuration of this board is UART2 connected to ST-link for debug console. Pins PA_15 and PA_2 are connected directly to the ST-Link, PA_15 without any connection to any pin.
If you want to use any pin for any peripheral then it must be in pin map of corresponding peripheral. How you can see here, the pin PA_3 is commented out, so it can not be used in any Serial based APIs.

If you not need to use debug console and you want to use both UARTS you need to reconfigure Mbed project for that.

You need to add this to your code before the main.

extern const PinMap PinMap_UART_RX[] = {
    {PA_3,       UART_2,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART2)},
//  {PA_3,       LPUART_1,STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_LPUART1)}, // No LPUART_1 TX
    {PA_10,      UART_1,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART1)},
    {PA_15,      UART_2,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_USART2)}, // Connected to STDIO_UART_RX
    {PB_7,       UART_1,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART1)},
    {NC, NC, 0}
};

And also disable or redirect default debug console

Maybe also change of settings of solder bridge SB3 will be necessary - (section 6.9 of STM32 Nucleo-32 boards (MB1180) - User manual)

BR, Jan

1 Like