SoftwareSerial did not working

Post here first, or if you can't find a relevant section!
Post Reply
moelski
Posts: 7
Joined: Mon Jan 18, 2021 5:15 am

SoftwareSerial did not working

Post 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
mrburnette
Posts: 633
Joined: Thu Dec 19, 2019 1:23 am
Answers: 7

Re: SoftwareSerial did not working

Post 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.
Bambo
Posts: 75
Joined: Wed Jan 15, 2020 8:36 pm

Re: SoftwareSerial did not working

Post 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?
Post Reply

Return to “General discussion”