2024-09-26 07:33 PM
I use Arduino IDE and "STM32 MCU based boards" library to program Nucleo32. Here are the settings:
I connect it directly using USB to computer.
Here is my code:
#include <SoftwareSerial.h>
SoftwareSerial mySerial(PB6, PB1); // RX, TX
void setup() {
Serial.begin(115200);
Serial.println("Hi");
mySerial.begin(115200); // When I add this line, nothing works anymore
}
void loop() {
if (Serial.available()) {
String command = Serial.readStringUntil('\n');
Serial.print("Just received a Serial from PC: ");
Serial.println(command);
}
}
I reset it and it writes "Hi" in the Serial monitor, but when I begin() the software serial (line 8), nothing works anymore. Unable to toggle pins, no output appears in the Serial monitor and everything gets stuck.
When I remove line 8, it works without any problems.
2024-09-26 08:16 PM
Sounds like it faults the MCU.
Debug it, or engage with the Arduino developers.
Can you use a regular UART based serial port.
Check mySerial is not NULL.
2024-09-27 12:52 AM
Since you're using Arduino IDE with an Arduino type library, you should be asking for help in the Arduino forum.