Pages: [1]   Go Down
Author Topic: Serial problems at 115200 baud  (Read 550 times)
0 Members and 1 Guest are viewing this topic.
Brisbane, Australia
Offline Offline
Newbie
*
Karma: 0
Posts: 13
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,

The following sketch produces garbage at 115200 but at 9600 it works fine. This is just when running the ports into two (2) PC USB serial ports running a terminal program that have been tested to work fine at 115200 on other serial devices, but when connected together like this on the Due, it doesn't work at 115200. I get correct mirror behaviour of terminal talking to terminal at 9600 baud.

I'm using a MAX 3232 to convert the TTL Serial2 signals to RS232 and this is rated at well beyond 115200baud. I can send someone the schematic if required of the TTL to RS232 convertor I'm using if required.

Code:
void setup() {
  SerialUSB.begin(115200);
  Serial2.begin(115200);
}

void loop() {
  if (SerialUSB.available()) {   
    Serial2.write((byte)SerialUSB.read());
  }
   
  if (Serial2.available()) {   
    SerialUSB.write((byte)Serial2.read());
  }
}

I can only assume that some kind of timing or buffer issue, but I'm not sufficiently clear on the details to understand why/what. The odd part is that I can run this next script and the results looks fine on both ports.

Code:
void setup() {
  SerialUSB.begin(115200);
  Serial2.begin(115200);
}

int c = 0;

void loop() {
  SerialUSB.write('A' + c );
  c++;
  if (c == 26) {
    SerialUSB.println();
  }
 
  Serial2.write('a' + c );
  if (c == 26) {
    Serial2.println();
    c = 0;
  }
}

If I disconnect and reconnect the Serial2 port while it is running, I get synchronisation issues, and get garbage. If I continue to randomly disconnect and connect, sometimes it will re-synch and work fine again. Could this be something???

I was hoping to be able to use the Due in this configuration and can't for the life of me figure out why the serial ports on the board are being so stubbon at this baud rate?
Logged

Brisbane, Australia
Offline Offline
Newbie
*
Karma: 0
Posts: 13
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Perhaps I've posted in the wrong place? I'll re-post into the correct section under "Interfacing w/ Software on the Computer" as there is more chat and discussions re Serial there. Sorry for any issues re cross-posting.
Logged

Pages: [1]   Go Up
Jump to: