Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 6 of 6

Thread: Does SoftwareSerial work on Teensy 4.1?

  1. #1
    Junior Member
    Join Date
    Dec 2018
    Posts
    13

    Does SoftwareSerial work on Teensy 4.1?

    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());
      }
    }

  2. #2

    Another thread which discusses use of SoftwareSerial

    Quote Originally Posted by Zane470 View Post
    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

  3. #3
    Junior Member
    Join Date
    Dec 2018
    Posts
    13
    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.

  4. #4
    Senior Member+ MichaelMeissner's Avatar
    Join Date
    Nov 2012
    Location
    Ayer Massachussetts
    Posts
    3,743
    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.

  5. #5
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    22,082
    So far, SoftwareSerial is transmit only on Teensy 4.x, when not using pins which are a real hardware serial port.

  6. #6
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    6,896
    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...
    Click image for larger version. 

Name:	screenshot.jpg 
Views:	4 
Size:	243.5 KB 
ID:	20756

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •