Nucleo STM32 L432KC using Arduino- serial config?

I'm trying to see if I can use a STM32 Nucleo board, L432KC with the Arduino 2.2.1 IDE. In the Boards Manager I installed "STEM32 MCU based boards by STMicroelectronics, v2.7.1"
I'm using a Linux host to program. When the USB cable is connected, the L432KC board appears both as a USB mass storage device, and as the /dev/ttyACM0 USB serial port.
I was able to program the "Blink" example into my Nucleo board, with the IDE settings Tools:Board: Nucleo-32 and Tools:Board Part No: "Nucleo L432KC" and "Tools:Upload method: mass storage" and after upload, the green onboard LED blinks just as programmed. So far, so good.
For serial data, in the Tools option, I see there are four choices for "USB Support": 1:None, 2:CDC (generic serial supersedes USART), 3:CDC (no serial) and 4: HID keyboard and mouse. My program won't compile with option 1 or 3 (says Serial not declared in this scope). Option 2 compiles but no serial data appears. Option 4, ("HID keyboard and mouse") rather surprisingly does work!
Is there a good reason for Serial.println() statements to appear on the USB serial device the same way a normal Arduino Uno works, but if and only if this board is configured as USB keyboard/mouse ?

I have used the STM32 nucleo-L0732RZ with the Arduino IDE OK but in the main tend to use STM32cubeIDE
if you do a web search for STM32 Nucleo board L432KC there are plenty of links
is there anything particular you intend to use the board for?

I have switched to the STM32cubeIDE and it is so far working as expected including printf(), so I think I will use it that way going forward. However if anyone else is trying to get Serial.print() working like an Arduino in that framework on this board, maybe my observation about the USB device type will be helpful.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.