SoftwareSerial

Please do not post requests
zmemw16
Posts: 1685
Joined: Wed Jul 08, 2015 2:09 pm
Location: St Annes, Lancs,UK

Re: SoftwareSerial

Post by zmemw16 » Wed Mar 01, 2017 3:56 pm

check the properties file ? restricted platform ?
stephen

stevestrong
Posts: 2070
Joined: Mon Oct 19, 2015 12:06 am
Location: Munich, Germany
Contact:

Re: SoftwareSerial

Post by stevestrong » Wed Mar 01, 2017 4:24 pm

I also have the problem not receiving signls from space... :mrgreen:

Nutsy
Posts: 260
Joined: Sun Jul 24, 2016 4:26 pm

Re: SoftwareSerial

Post by Nutsy » Wed Mar 01, 2017 4:45 pm

wheres the properties file? cant find it for the library

zmemw16
Posts: 1685
Joined: Wed Jul 08, 2015 2:09 pm
Location: St Annes, Lancs,UK

Re: SoftwareSerial

Post by zmemw16 » Wed Mar 01, 2017 5:00 pm

library.properties - in the libraries folder; in my case /home/stephen/sketchbook/libraries/Adafruit_GFX/library.properties
contents are

Code: Select all

name=Adafruit GFX Library
version=1.1.5
author=Adafruit
maintainer=Adafruit <info@adafruit.com>
sentence=Adafruit GFX graphics core library, this is the 'core' class that all our other graphics libraries derive from.
paragraph=Install this library in addition to the display library for your hardware.
category=Display
url=https://github.com/adafruit/Adafruit-GFX-Library
architectures=*
in your case if the architectures line AVR or something else - it maybe being ignored.
if you haven't got one, it's not.
it was just a thought, however i usually get a warning.
what level of details (compile and upload) have you set in preferences?

stephen

Nutsy
Posts: 260
Joined: Sun Jul 24, 2016 4:26 pm

Re: SoftwareSerial

Post by Nutsy » Thu Mar 02, 2017 11:32 am

im not suing the gfx library... just trying to get softwareserial to be recognised as installed... its really strange

zmemw16
Posts: 1685
Joined: Wed Jul 08, 2015 2:09 pm
Location: St Annes, Lancs,UK

Re: SoftwareSerial

Post by zmemw16 » Thu Mar 02, 2017 4:43 pm

i wasn't saying that, i just put that in to show the architecture line in the library.properties file
srp

asmallri
Posts: 21
Joined: Fri Oct 06, 2017 12:37 am

Re: SoftwareSerial

Post by asmallri » Thu Dec 21, 2017 4:50 am

This multi instance example works fine:...
It does not work correctly. The example showed a corner case where it did work. However if you try to test it the other way around where the other port are trying to receive data it does not work.

User avatar
Rick Kimball
Posts: 1078
Joined: Tue Apr 28, 2015 1:26 am
Location: Eastern NC, US
Contact:

Re: SoftwareSerial

Post by Rick Kimball » Thu Dec 21, 2017 5:04 am

Can you post the code that doesn't work please?
-rick

asmallri
Posts: 21
Joined: Fri Oct 06, 2017 12:37 am

Re: SoftwareSerial

Post by asmallri » Thu Dec 21, 2017 9:31 pm

I have tried the AT and CC drivers, all have issues. Some software Uarts can receive but not transmit, other can transmit but not receive.Here is one simple example that demonstrates the problem. One implementation I tested worked for 19 characters and then stopped working. The code I have posted below code may work for a short period of time (a few minutes) but normally just does not work.

The platform I am using is a BluePill STM32F103 running at 72MHz.

In this example I have used a single hardware Uart (Serial 1) and one software UART. I have added LED on and off statements and a 100ms delay so that you can see when a character has been received by the respective UART.

The symptoms of this example is when the processor is reset, the initial start messages are correctly sent out of both Serial ports. When characters are typed on the terminal connected to the HW UART receive input, the character is echoed both to the terminal attached to the HW Uart and the Software Uart and the LED flashes appropriately indicating a character was received by the HW Uart.

When characters are typed on the terminal connected to the SW UART receive input, the character are NOT echoed to either terminal HOWEVER the LED flashes appropriately indicating a character was received by the SW Uart. My conclusion for this specific example is the timing for the SW read is broken.

Code: Select all

#include "TimerSerial.h"

#define ConsoleSerial Serial1
#define StatusLed PC13
#define StatusLedOn digitalWrite(StatusLed, LOW)
#define StatusLedOff digitalWrite(StatusLed, HIGH)

void setup()
{  
  pinMode(StatusLed, OUTPUT);  
  ConsoleSerial.begin(57600);
 
  // set the data rate for the SoftwareSerial port
  Timer2Serial.begin(9600);    // (PA1,PA0)
}

void loop() // run over and over
{
  ConsoleSerial.println("");
  ConsoleSerial.println("ConsoleSerial is active");
  Timer2Serial.println("Timer2Serial is active");
 
  while (1) {
    if (ConsoleSerial.available()) {
     digitalWrite(StatusLed, LOW);      
      int c = ConsoleSerial.read();
      ConsoleSerial.write(c);
      Timer2Serial.write(c);
      delay(100);
      digitalWrite(StatusLed, HIGH);           
    }
      
    if (Timer2Serial.available()){
      digitalWrite(StatusLed, LOW);
      int c = Timer2Serial.read();
      Timer2Serial.write(c);
      ConsoleSerial.write(c);
      delay(100);
      digitalWrite(StatusLed, HIGH);
    }
  }
}


User avatar
Rick Kimball
Posts: 1078
Joined: Tue Apr 28, 2015 1:26 am
Location: Eastern NC, US
Contact:

Re: SoftwareSerial

Post by Rick Kimball » Tue Feb 06, 2018 5:22 am

I made some slight changes to your code. I don't echo the Timer4Serial . To test I used the local echo option on the putty terminal for Timer4Serial. This allows you to send lots of data without it being overrun.

I also looped until I exhaust the available input instead of grabbing one character at a time from each. I'm assuming your real world usage of this will be a command send and then a response type of situation. Adjust for your case if it isn't

Code: Select all

#include "TimerSerial.h"

#define ConsoleSerial Serial
#define SlaveSerial Timer4Serial
#define StatusLed PC13
#define StatusLedOn digitalWrite(StatusLed, LOW)
#define StatusLedOff digitalWrite(StatusLed, HIGH)

void setup()
{  
  pinMode(StatusLed, OUTPUT);  
  ConsoleSerial.begin(115200);
  // set the data rate for the SoftwareSerial port
  SlaveSerial.begin(115200);    // (PB7,PB6)
 
  while(!ConsoleSerial.isConnected());
 
}

void loop() // run over and over
{
  ConsoleSerial.println("");
  ConsoleSerial.println("ConsoleSerial is active");
  SlaveSerial.println("SlaveSerial is active");
 
  while (1) {
    if (ConsoleSerial.available()) {
     //digitalWrite(StatusLed, LOW);      
      int c;
      while((c = ConsoleSerial.read()) != -1 ) {
        SlaveSerial.write(c&0xff);
        ConsoleSerial.write(c&0xff);
      }
      //digitalWrite(StatusLed, HIGH);           
    }
      
    if (SlaveSerial.available()){
      digitalWrite(StatusLed, LOW);
      int c;
      while( (c=SlaveSerial.read()) != -1 ) {
        //SlaveSerial.write(c);
        ConsoleSerial.write(c);
      }
      digitalWrite(StatusLed, HIGH);
    }
  }
}
BTW: I'm testing this on a bluepill using an stlink as the upload device.
-rick

Post Reply