Skip to content

Garbage @ 115200 #4

@anfebit

Description

@anfebit

First of all, I wanted to thank you for the library, very helpful. It is unbelievable that Arduino has so many constraints in terms of communication.

Right now, I'm using your library, but I'm having troubles with the baudrate. I can only have good data a 9600 bps. Changing to 115200 everything is just garbage. Unfortunately, my application does not allow something less that 115200 bps. In order to test the library, I did the following program. The following code uses the default pins (0,1) to transmit the word "Hello world". But I only get reliable data at 9600. Any answer will be much appreciated it.

#include <CustomSoftwareSerial.h>
CustomSoftwareSerial* customSerial;               // Declare serial
CustomSoftwareSerial* customSerial1;


//#include <SoftwareSerial.h>
#include <stdint.h>

//SoftwareSerial portOne(10, 11); // RX, TX

unsigned int read_val=0;
void setup() 
{
  //Serial.begin(115200);
  while (!Serial) 
  {
    ; // wait for serial port to connect. Needed for native USB port only
  }
  delay(10);

  customSerial = new CustomSoftwareSerial(10, 11); // rx, tx
  customSerial1 = new CustomSoftwareSerial(0, 1); // rx, tx
  customSerial1->begin(14400, CSERIAL_8N1);
  customSerial->begin(115200, CSERIAL_8N1);         // Baud rate: 9600, configuration: CSERIAL_8N1

  //portOne.begin(115200);
  delay(1000);
  //portOne.print(50,HEX);
  customSerial->print(50,HEX);
  customSerial1->print("Hello world");
}

void loop()
{
  while(true)
  {

    if (customSerial->available()) 
    {  
        read_val=customSerial->read();
        Serial.println(read_val);
        //Serial.println("Hello");  
     }  
   }  
 }

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