Skip to content

feature request: add BREAK detection #328

Description

@gicking

Hello,

if I may, can I ask you for an additional feature? I am currently developing a LIN slave library for Arduino. It aims at supporting multiple boards and interfaces, also SoftwareSerial.

In LIN, frame synchronization is via a BREAK signal, e.g. 0x00 at 1/2 baudrate (--> 0x00 without stop bit --> framing error). This is used by the slave to reset the protocol handler. If I have access to the FE information, e.g. in ESP32 HardwareSerial, I use that information for frame synchronization. In other cases I simply use the inter-frame pause, which is ugly but seems to work.

However, for ESP32 and ESP8266 with your EspSoftwareSerial, I have a problem: seemingly your library drops bytes without stop bits. Thus my lib doesn't receive the BREAK and thus cannot react on it.

Therefore my kind request is to:

  1. add an additional argument to your constructor and set the default to current behavior for backward compatibility. For example "bool dropFE = true"
  2. in the receive handler, where you check the stop bit, keep the received byte if dropFE==false (new), else drop it (current)
  3. Ideally set a corresponding framing error flag via XOR, either in a 2nd buffer, or just for the last received byte (for simplicity)

For your consideration thanks a lot in advance and have a great day :-)

Georg

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions