Page 1 of 1

Nucleo-32 STM32L432 Serial Port Mapping Wrong?

Posted: Sat Oct 30, 2021 9:35 pm
by imk
Hello,
Just tried testing little app on a Nucleo STM32L432 and serial data is coming out of pin A7 (22/ADC7) not Tx pin (31,PD1)

So i just decided to test out this Nucleo STM32L432 as a (more storage/faster) replacement for the Arduino Nano's I have.
It is supposed to be pin comparable as the Nano so thought I would test it.
I put this LED flash app in it that writes to Serial monitor which display the data correctly.
In the past when i have written to serial monitor on the Nano I am sure Tx data comes out of Tx pin 31,D1
So i put the scope lead on Tx pin 31,D1 and no data, so i scoped out all the other pin and found Tx data on pin A7.

Anyone any ideas, am i wrong or is the STM32 Arduino library messed up?

Many thanks imk

#define LED_PIN D13

//#define LED_PIN LED_BUILTIN
void setup()
{
Serial.begin(9600);
delay(1000);

pinMode(LED_PIN, OUTPUT);
}

void loop()
{
Serial.println("Initialize Sensor OK");

digitalWrite(LED_PIN, HIGH);
delay(100);
digitalWrite(LED_PIN, LOW);
delay(100);
}

Re: Nucleo-32 STM32L432 Serial Port Mapping Wrong?

Posted: Sun Oct 31, 2021 1:26 am
by hobbya
You have quite a few posts regarding serial operations.

For STM32L432 board, the default Serial is actually mapped to the 2nd serial port of the chip. This port is wired to the on-board ST-link. You can then plug your PC to the USB-port of the ST-link and get Serial Monitor on Arduino IDE right away.

So effectively if you debug via the Serial Monitor, you just connect the PC to the USB port and do not need to worry how the pins are mapped. If however you need to monitor the signals on the pins, you need to check the header files to understand what the mapping is. STM32, unlike Arduino Nano, has multiple hardware serial ports which is another beautiful feature.