Does SoftwareSerial work on Teensy 4.1?

Status
Not open for further replies.

Zane470

Member
Hello,

On a custom circuit board I connected a uBlox GPS module to pins 30 & 31. I'm using the 8 hardware serial ports for something else, so I was planning on using the SoftwareSerial library to get the data from this GPS module. I've verified that the GPS module is working -- when connecting the TX from the module to a hardware RX pin, I get data. When I use the software serial library I get nothing...and yes I've tried swapping pins 30 and 31 in my code below.

Code:
#include <SoftwareSerial.h>

SoftwareSerial gpsSerial(30, 31); // RX, TX

#define debugSerial Serial

void setup()
{
  debugSerial.begin(115200);
  gpsSerial.begin(9600);
  delay(2000);
}

void loop()
{
  if (gpsSerial.available()) {
    debugSerial.write(gpsSerial.read());
  }
}
 
Another thread which discusses use of SoftwareSerial

Hello,

[portions snipped] I'm using the 8 hardware serial ports for something else, so I was planning on using the SoftwareSerial library to get the data from this GPS module.

@Zane470:

The following <thread> might have some useful information that you can use to create an additional serial port on a T4.1.

Good luck & have fun !!

Mark J Culross
KD5RXT
 
Thanks! Looks like even the flexio stuff won't work on pins 30 & 31 :/

Oh well, I'm not actually using all of the hardware serial ports at the moment so I'll just solder some wires from 30 & 31 to one of the hardware serial ports for now.
 
I have not used USB Host for anything other than running a mouse to see if I had the pins correctly installed. But it occurs to me, you might be able to use a USB <-> serial converter that is plugged into the USB.

Or switch to a USB GPS device.

As I said, I don't have experience with this, but perhaps it would work if you are already out of serial pins.
 
As mentioned, if the pins you were using had FlexIO pins on them, then could use my FlexIO Serial code to handle it.

Now you mentioned that you were using all 8 other Uarts...

The question is with your 8 Hardware Serial ports all used for both RX and TX?

And do you need to TX to your GPS module?

If not there are a variety of hacks with the current beta code one might be able to get away with.
Depending on things on how big of a hack that is needed...

As mentioned The pins you show are not FlexIO pins... Hate to keep posting image of my Excel document, but...
screenshot.jpg

How big of a Hack?

Suppose you can sort of Share Serial8, where they both use the same Baud rate and you only need the TX for that device.

With the Beta code for Serial ports. You have the option of using any pin that is an XBAR pin for either A CTS pin or an RX pin for the serial port. You can do either, neither but not both.
So you could do something like Serial8.setRX(30);
And it will be used for the RX pin for Serial 8...

But again this would only work for this case if the conditions I mentioned are valid (same baud, one does RX the other does TX)...

If that does not work, but you can live with RX only for GPS, then you might be able to again can try to confiscate one of the other Hardware Serial ports RX pin of a Serial port who has their RX and TX pins on FlexIO pins. You could then create a FlexIO object on those pins ... Again not sure if that makes sense.

Good luck
 
Status
Not open for further replies.
Back
Top