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

Thread: SlowSoftSerial library for slow baud rates

  1. #1

    SlowSoftSerial library for slow baud rates

    On the Teensy 3.x, standard serial baud rates below 1200 baud are not supported by the hardware UARTs, as documented here. Existing software serial libraries have other limitations, as documented here. So, I have created a new software serial library called SlowSoftSerial. It is available now at https://github.com/MustBeArt/SlowSoftSerial.

    It can handle simultaneous receive and transmit, on any two digital pins of a Teensy 3.x, at any arbitrary baud rate from 1 baud up to, typically, 9600 baud or higher, at any word size (5-8 bits) and parity setting. It has minimal impact on interrupt latency (comparable to AltSoftSerial).

    It uses two of the four Periodic Interrupt Timers, via the IntervalTimer library. It should be usable anywhere the IntervalTimer library works and pin change interrupts are available, but has only been tested on Teensy 3.5 so far. Currently only one SlowSoftSerial port at a time can be active, though you can have multiple ports defined and switch between them cleanly.

    Like other software serial implementations, SlowSoftSerial can be sensitive to interrupt usage by other libraries. At any given baud rate, it is more sensitive than AltSoftSerial, but this is less of a problem at low baud rates.

    In one typical use case, a SlowSoftSerial port can be defined to use the same transmit and receive pins as one of the hardware UARTs. If the requested baud rate is 1200 or higher, the application would use the hardware serial port. If the requested baud rate is lower than 1200, the application would use the SlowSoftSerial port instead. The switch can be completely transparent to the user and to the hardware design.

    This is a newly written library, so it has not yet been battle-proven. Bug reports, comments, questions, and suggestions are welcome!

    -Paul Williamson, paul@mustbeart.com

  2. #2
    Paul - very nice bit of code. This will be VERY useful to those who do Model 28 or 30 TTY interfaces. The 110 baud they ran at was not easy to get without some tricky bit-banging. �� ��

  3. #3
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    20,821
    I've added a link to the AltSoftSerial readme file.

    https://github.com/PaulStoffregen/Al...aebd83f215983a

    Hopefully that will help people find this if they need low baud rates.

  4. #4
    Thanks, Paul!

    The two PJRC.com web pages I linked above might be other places that could benefit from a link.

    -Paul

Posting Permissions

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