Page 1 of 1

SoftwareSerial did not working

Posted: Mon Jan 18, 2021 5:57 pm
by moelski
Hi !

Can anyone tell me whats the problem with this code?

Code: Select all

#include <SoftwareSerial.h>

HardwareSerial Serial1(USART1);   // or HardWareSerial Serial2 (PA3, PA2);
SoftwareSerial mySerial(PA3, PA2, true); // RX, TX

void setup() {
  // Open serial communications and wait for port to open:
  Serial1.begin(57600);
  while (!Serial1) {
    ; // wait for serial port to connect. Needed for native USB port only
  }

  delay(2000);
  Serial1.println("Start");

  mySerial.begin(57600);
}

void loop() { // run over and over
  if (mySerial.available()) {
    Serial1.write(mySerial.read());
  }
}
I only get the letter "S" in the serial monitor and that´s it.
Data is coming in through the attached device.

I try to read data from a FrSky S.Port (receiver). And using the SoftwareSerial has the benefit of inversion.
But so far it will not work :?

Dominik

Re: SoftwareSerial did not working

Posted: Tue Jan 19, 2021 1:29 am
by mrburnette
I have used SS with Maple Mini and Roger's core:


viewtopic.php?p=5596#p5596

A modified copy exists in the zip. Long, long time ago, may have some compiler warnings today.

Re: SoftwareSerial did not working

Posted: Tue Feb 02, 2021 10:42 pm
by Bambo
You may have more luck configuring USART if you use this tool: https://www.st.com/en/development-tools ... ubemx.html to generate clock configurations and then putting them in your code to setup the USART pins to how they match your board?