Maixduino: trick for 300 & 600 baud, no 1200, 2400, 4800, and OK is 9600


#1

Something a tad absurd, but not all that new: “high-speed” boards - and also these - not rarely have a problem with low baud speeds. What works, however, is to tell the board some “useable wrong” speed, which, however, is accepted by a terminal as the “correct” baud rate. How do you find such interesting “wrong” speeds? By trying out all speeds of a reasonable range, and having set your terminal to the desired speed, and simply seeing “what works” - I wrote a while ago, if anybody needs this, such a program which tries to print its present baud rate at different baud rates:


void setup() {

int i;

  for(i=1; i<28800; i++){

  // Open serial communications and wait for port to open:
  Serial.begin(i);
  while (!Serial) {
    ; // wait for serial port to connect. Needed for native USB port only
  }

  Serial.print("\n\n");
  Serial.print("XXX");
  Serial.print(i);
  Serial.print("YYY");
  Serial.print("\n\n");

  Serial.end();

  }

}

void loop() { // run over and over

}

For 300 baud I found these regions:
95?
1516?
2012?
1216?

And quite certain:

2013-2014
2991-2996
5823-5846

600 baud is commonly not a good idea for Arduino, as for some boards, as the Zero, a 600 baud signal is seen as “reset” (yeah, WHAT a genius idea…); however, the ranges accepted in TeraTerm and in the Windows CMD-test described below were exactly the same (a tad strange).

An interesting problem I found was that the terminal sometimes got “reset”. To get a “clean” log, you might do, e.g. with 1200 baud on Windows’ CMD.EXE:

mode com3: baud=1200 parity=N data=8 stop=1

type com3: >> data.log

And then reset the board, so it starts “spitting serial prints”.

You will have to press Ctrl-C after all is tested to return to the prompt.

You can then issue further mode-commands. For 1200, 2400 and 4800 I found nothing, so this trick does not necessarily “always” work.

By default, the “lowest correct” speed (i.e. where these tricks are not needed) for this board seems to be 9600… which is pretty high if you ask me.


#2

Update: using Serial1 (i.e. the pins), baudrate can go down to 4800 from 9600, but has no way to show 300, 600, 1200 or 2400 baud.


#3

I agree that it’s an odd way of doing things, but it may be worth remembering that even 9600 baud is a fairly slow speed in modern terms - less than 1 KiB/s.


#4

Yeah, but… I am driving an actual 80s’ terminal with it, and THAT demands that you have 300/600/1200 baud speed, and a 70s’ terminal demands that I have 300. Yeah, or LESS, down to 75. 😁 I am aware that I can use one more Arduino as “speed translator”, basically “taking input” from one port and “writing output” to another, but that’s an extra hardware step. — If I want large size & speed, I will obviously take an RPi or whatever… But uLisp is great for “that retro supercomputer feeling”… really, nothing ever compares. (An RPi is a “weak modern” device. uLisp is ingeniously “its own thing”.)


#5

OK, finally I “bit the bullet” and used an Arduino UNO as a “serial port go-between” - where it talks to the Maixduino with 9600 and with the terminal (pins 0 & 1) with 300 baud (software serial port, pins 8 & 9). In case anyone else hits such issues…


#include "SoftwareSerial.h"

#define ttt Serial

SoftwareSerial sss(8,9);
// SoftwareSerial ttt(6,7);

void setup() {
  ttt.begin(9600);
  sss.begin(300);
}

void loop() {
  if (ttt.available()) {      // If anything comes in Serial (USB),
    sss.write(ttt.read());   // read it and send it out sss (pins 8 & 9)
  }

  if (sss.available()) {     // If anything comes in sss (pins 8 & 9)
    ttt.write(sss.read());   // read it and send it out Serial (USB)
  }
}

#6

Huh. Yeah, I guess we can’t call that modern anymore.