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

Thread: SoftwareSerial broken for Teensy LC

  1. #1

    SoftwareSerial broken for Teensy LC

    Seems there is a problem with software serial on the Teensy LC.

    When i run the following code my IC just freezes up. Any tips here? I am using pins 1 and 0 to determine if i wired my device backwards.

    Arduino 1.8.7 with Teensyduino 1.44

    I am using library SoftwareSerial at version 1.0 in folder: C:\Program Files (x86)\Arduino\hardware\teensy\avr\libraries\Softwa reSerial

    Code:
    #include <SoftwareSerial.h>
    
    SoftwareSerial mySerial(1, 0); // RX, TX
    
    void setup() {
      mySerial.begin(19200);
    }
    
    void loop() {
      mySerial.write("AT\r");
      Serial.println("...");
      delay(1000);
    }

  2. #2
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    20,171
    Quote Originally Posted by jacky4566 View Post
    Any tips here?]
    Swap the pins, like this:

    Code:
    SoftwareSerial mySerial(0, 1); // RX, TX

  3. #3
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    20,171
    When the pins don't align with a real serial serial port, SoftwareSerial is trying to bigbang. But that code only works on Teensy 3.x. It's using the DWT cycle counter which doesn't exist on Teensy LC.

  4. #4
    Quote Originally Posted by PaulStoffregen View Post
    When the pins don't align with a real serial serial port, SoftwareSerial is trying to bigbang. But that code only works on Teensy 3.x. It's using the DWT cycle counter which doesn't exist on Teensy LC.
    OH. So no software serial on LC? Bummer.

  5. #5
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    20,171
    Sadly, no. AltSoftSerial isn't ported to Teensy LC either.

    But you do have 3 real hardware serial ports on LC, and SoftwareSerial is able to use those 3 if you're stuck with some Arduino lib that's hard coded to require SoftwareSerial.

  6. #6
    OK. Thanks for the quick response Paul.

    I am having trouble communicating with a specific modem on a built pcb and i may have my TX/RX backwards. I was trying to test with software real quick.

    The datasheet isn't exactly the clearest.
    Click image for larger version. 

Name:	Capture.PNG 
Views:	25 
Size:	7.7 KB 
ID:	15198

  7. #7
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    20,171
    Oh that does look confusing.

    One simple test you can try involves a resistor to GND. Usually anything in the 1K to 100K range works. If the pin is being driven (TTL level serial is logic high when idle) it'll stay close to 3.3V even with the extra resistor load. But if it's an input, usually a resistor will bring close to 0 volts, or to some lower voltage you can easily measure if the input has a pullup resistor.

Posting Permissions

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