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.

2 Likes

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

which exactly line to use to connect to boron board from linux terminal? for serial debug? via usb cable?


[71823.418726] usb 1-2.4: New USB device found, idVendor=2b04, idProduct=c00d
[71823.418872] usb 1-2.4: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[71823.418881] usb 1-2.4: Product: Boron CDC Mode
[71823.418890] usb 1-2.4: Manufacturer: Particle
[71823.418896] usb 1-2.4: SerialNumber: ------------------------------
[71823.484579] cdc_acm 1-2.4:1.0: ttyACM0: USB ACM device
[71823.485837] usbcore: registered new interface driver cdc_acm
[71823.485843] cdc_acm: USB Abstract Control Model driver for USB modems and ISDN adapters
[75867.062869] nvgpu: 17000000.gv11b                 tpc_pg_mask_store:843  [INFO]  no value change, same mask already set
[75873.457849] nvgpu: 17000000.gv11b             railgate_enable_store:297  [INFO]  railgate is disabled.

However,

screen /dev/ttyACM0 

returns nothing

Hi,
The best way will be to use CLI

particle serial monitor --port /dev/ttyACM0

I don’t use screen but maybe try with specified baud rate (exactly the same as in your setup) e.g:

screen /dev/ttyACM0 9600

1 Like

Thank you for your reply. It worked but only after writing the custom usb serial test firmware the output appeared