Boron Serial1/UART issues with Baud 1200 and SERIAL 7E1 format

Hi,

I am interfacing an UART sensor with Boron LTE with target OS 1.1.0 using the Serial1 Port but am getting issues. So, I decided to check whether Serial1 is functioning as I want it to with UART settings:
1200 Baud and 7E1 frame format.

I hooked up a logic analyzer with the Serial1 Tx pins to verify my Boron is writing what I expect it to write. And to my surprise, Boron isn’t writing anything at all. So I tweaked the baud rate and frame settings (8N1, 8E1 etc.) and it seemed to be working perfectly fine.

Attached are the screenshots of logic analyzer output and below is my simple serial1 test code. Does Boron LTE have specific issues for 7E1 format? Has anyone encountered this strange behavior before?

Thank you,
Vish Powers

byte writeArray[] = {0x01,0x02,0x03,0x04,0x00,0x00,0x05,0x00};
int byteaval, byteswritten;


/* PRINT FUNCTION TO PRINT HEX BYTES WRITTEN TO SERIAL PORT*/
void printFrameHeSerial(unsigned char modbusFrame[], int frameLength, Stream *stream)
{
    stream->print("{");
    for (int i = 0; i < frameLength; i++)
    {
        stream->print("0x");
        if (modbusFrame[i] < 16) stream->print("0");
        stream->print(modbusFrame[i], HEX);
        if (i < frameLength - 1) stream->print(", ");
    }
    stream->println("}");
}

void setup() {

    Serial.begin();
    Serial1.begin(1200, SERIAL_7E1);
    //Serial1.setTimeout(10);
    delay(10);
    Serial1.flush();
}

void loop() {
    
    byteaval = Serial1.availableForWrite();
    Serial.print("Bytes available for Writing to Serial1 Port:");
    Serial.println(byteaval);
    Serial.print("Testing Serial1 Print command.... Bytes Written :");
    Serial.println(Serial1.println(0x55));
    Serial1.flush();
    delay(10);
    if (Serial1){
        
        byteswritten = Serial1.write(writeArray,sizeof(writeArray)/sizeof(writeArray[0]));
        Serial.print("Bytes written to Serial1 (");
        Serial.print(byteswritten);
        Serial.print(") = ");
        if (byteswritten > 0) printFrameHeSerial(writeArray,sizeof(writeArray)/sizeof(writeArray[0]), &Serial);
        else Serial.println();
        Serial1.flush();
        delay(10);
    }
    else Serial.println("Serial not available");    
    delay(2000);
    
}

@vpowar, from the Boron docs:

Pre-defined Serial configurations available:

  • SERIAL_8N1 - 8 data bits, no parity, 1 stop bit (default)
  • SERIAL_8E1 - 8 data bits, even parity, 1 stop bit

Other options, including odd parity, and 7 and 9 bit modes, are not available on the Boron.

3 Likes

Is there a way to use 7 bit modes on Boron? Any core library changes or does it need some extra hardware interfacing?

There is an open issue as feature request but its priority is considered low.

1 Like

Do you know if any other UART configuration has been added to Boron in 2.0.0-rc.1? I can’t find anything on this anywhere else in the docs.

There are no additional serial configuration options in 2.0.0-rc.2. The documentation for 2.0.0 will be out in a few weeks.

1 Like