Arduino at 11.0592Mhz; Modify SoftwareSerial

Hello

I modified my Arduino Uno with a crystal at 11.0592MHz. This nice values will improve UART communication. I also modified boards.txt with this line: uno11.build.f_cpu=11059200L

But now I realized that the SoftwareSerial is not working at this frequency. The delay table for this frequency is missing. Does somebody know how the delay table can be calculated?

I found a nice Perl script to calculate the table based on the values of 8Mhz and 16MHz, but the Perl script is not working on my computer (Perl V. 5.14.2). Does somebody knows a solution? Here is the script: http://wiblocks.luciani.org/docs/app-notes/software-serial.html

Thank you for any hints! Felix

you might check my work on formula driven SWserial and derive your specific formula. http://forum.arduino.cc/index.php?topic=138497.0

Perfect!

With the posted script I received the following correction:

// 11.0592MHz support 
#elif F_CPU == 11059200

static const DELAY_TABLE PROGMEM table[] = 
{
  //  baud    rxcenter   rxintra    rxstop        tx
  { 115200,          1,       10,       10,        6, },
  {  57600,          4,       23,       23,       21, },
  {  38400,         11,       37,       38,       35, },
  {  31250,         16,       47,       47,       44, },
  {  28800,         20,       51,       51,       48, },
  {  19200,         33,       79,       79,       76, },
  {  14400,         47,      106,      106,      103, },
  {   9600,         74,      161,      161,      158, },
  {   4800,        157,      325,      325,      322, },
  {   2400,        322,      655,      655,      652, },
  {   1200,        651,     1313,     1313,     1310, },
  {    600,       1313,     2625,     2625,     2620, },
  {    300,       2625,     5263,     5263,     5260, },
};

const int XMIT_START_ADJUSTMENT = 4;

On Ubuntu 12.04 the following Ubuntu package had to be installed:

sudo apt-get install libtie-ixhash-perl

Cheers

and does it work? (I assume yes ;)

Yes, but I haven't tested into detail. I tried a short "HELLO WORLD" program and it worked. I borrowed my board to a colleague so I can not do more tests right now. But I already ordered some more crystals and I will do some tests when they arrived and then I will report them here.

Can you recommend some testing scenario? e.g. print hundreds of identical characters and look for errors?

I often use 0x55 0xAA patterns as these are 0101010101 and 0x66 is also a good one 0110011001100110

YOu should make a sender that sends a char and a reciever that echos it if the send char == echoed char then party!!! otherwise debugging ;)

Hi

My crystalls arrived and I tried to make the "performance" test. But I have some trouble. I tried your code hint from this post http://forum.arduino.cc/index.php?topic=138497.0 (master, slave example).

Only to be sure. The two Arduinos communicate through SoftwareSerial: pin 2 slave = pin 3 master pin 3 master = pin 2 slave

The debug report will printed on HardwareSerial of the master. Am I right? This has not worked in my case; I have not received anything.

But in general the SoftwareSerial output works at 11.0592MHz.

Felix

what is important with that master slave is that they are synchronized well, you must first start the slave and then the master, if you do not do that order if fails instantly. (it is prototype code and it should be extended to have code to auto synchronize, and to handle time out.)

Hi

I was still not able to find out the problem. Finally I wrote a simple sender and receiver script on my own. The sender sends every second this line over Software Serial to the receiver.
000111000111 000111000111
The receiver responds to the sender who is printing the output into the terminal

At the beginning I received a lot of wrong ECHOS. Then I started to write the two scripts very symmetrically (same number of serial.print commands) and connected both boards with ground. Then I realized, that my magic numbers must be wrong. I had a really high error rate. Then I started with your formulas. I tried a lot and not I ended with this:

rxcenter = rxstop/2 – 5;
rxintra = rxstop; 
rxstop = 11059200/(6 * baudrate)-2 ;
tx = rxstop – 7;
adjust = 5

Here are two examples of 115200baud and 57600baud. I have still errors but small ones.

baudrate 115200:
->000111000111 000111000111<- 000111000111 000b1ñ00`b1b

->000111000111 000111000111<- 000111000111 0001ba0``1bb
->000111000111 000111000111<- 000111000111 000b1á00À11Ä
->000111000111 000111000111<- 00011Î?00111 0001ba00À11Ä
->000111000111 000111000111<- 000111000111 0001ba0``1bb
->000111000111 000111000111<- 000111000111 000b1á00À11Ä
->000111000111 000111000111<- 000111000111 000b1á00À11Ä
->000111000111 000111000111<- 000111000111 0001ba00À11Ä

baudrate 57600:
->000111000111 000111000111<- 000111000111 0001110001q1
->000111000111 000111000111<- 000111000111 0001110001q1
->000111000111 000111000111<- 000111000111 0001110001q1
->000111000111 000111000111<- 000111000111 0001110001q1
->000111000111 000111000111<- 000111000111 000111000111
->000111000111 000111000111<- 000111000111 0001110001q1

Do you have a hint how I could improve the results (formula improvement)?

Felix

I found a formula which seems a little bit better (rxcenter + 2). At 57600 baud without errors.

rxcenter = rxstop/2 – 5;
rxintra = rxstop; 
rxstop = 11059200/(6 * baudrate)-2 ;
tx = rxstop –3;
adjust = 5

Testscript

baudrate 115200: (rx=2, rxc=14, rxi=14, tx11 (ad: 5))
->000111000111 000111000111<- 000111000111 000q1â0À0bq1
->000111000111 000111000111<- 000111000111 000b01`0pqbb
->000111000111 000111000111<- 000111000111 0001p1`00ñ1Ä
->000111000111 000111000111<- 000111000111 000b010ppbb1
->000111000111 000111000111<- 000111000111 0001p1`00á1Ä
->000111000111 000111000111<- 000111000111 00`0b10à0bq1
->000111000111 000111000111<- 000111000111 0001qq0`0Â1b
->000111000111 000111000111<- 000111000111 000q1â0`p1Ã1
->000111000111 000111000111<- 000110000111 000q1â0`p1Â1
->000111000111 000111000111<- 000111000111 000q1â0`p1Â1
->000111000111 000111000111<- 000111000111 000q0b8p`bb1


baudrate 57600: (rxc=6, rxin=22, rxs=22, tx=19 (ad: 5))
->000111000111 000111000111<- 000111000111 000111000111
->000111000111 000111000111<- 000111000111 000111000111
->000111000111 000111000111<- 000111000111 000111000111
->000111000111 000111000111<- 000111000111 000111000111
->000111000111 000111000111<- 000111000111 000111000111
->000111000111 000111000111<- 000111000111 000111000111
->000111000111 000111000111<- 000111000111 000111000111

This are the magic numbers:

// 11.0592MHz support 
#elif F_CPU == 11059200

static const DELAY_TABLE PROGMEM table[] = 
{
  //  baud    rxcenter   rxintra    rxstop        tx
  { 115200,          2,       14,       14,       11, },
  {  57600,         10,       30,       30,       27, },
  {  38400,         18,       46,       46,       43, },
  {  31250,         24,       57,       57,       54, },
  {  28800,         26,       62,       62,       59, },
  {  19200,         42,       94,       94,       91, },
  {  14400,         58,      126,      126,      123, },
  {   9600,         90,      190,      190,      187, },
  {   4800,        186,      382,      382,      379, },
  {   2400,        378,      766,      766,      763, },
  {   1200,        762,     1534,     1534,     1531, },
  {    600,       1530,     3070,     3070,     3067, },
  {    300,       3066,     6142,     6142,     6139, },
};

const int XMIT_START_ADJUSTMENT = 5;

One thing I does not understand. Now my Serial send-> receive script works really nice. But when I make a simple mySerial.println(“TEST”) in the terminal with one single Arduino, I only receive garbage.
So the first magic numbers from my second post, seems to be the best solution for the general case.

Cheers