Pages: [1]   Go Down
Author Topic: 20MHz NewSoftSerial DELAY_TABLE  (Read 620 times)
0 Members and 1 Guest are viewing this topic.
SF Bay Area
Offline Offline
Edison Member
*
Karma: 11
Posts: 1244
Arduino Ninja
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Using a combination of Excel, semi-intelligent guessing, and iteration, I created a DELAY_TABLE for use in NewSoftSerial.cpp on an Arduino using a 20MHz crystal. I don't have a logic analyzer and only have about 20 minutes of testing on this, but it seems to be pretty reliable up to 115200 baud RX and TX. Definitely welcome feedback, additional testing, and tweaks to any of the values.

Code:
#elif F_CPU == 20000000

static const DELAY_TABLE PROGMEM table[] =
{
  //  baud    rxcenter   rxintra    rxstop    tx
  { 115200,       3,        21,       21,      18,  },
  { 57600,       20,        43,       43,      41,  },
  { 38400,       37,        73,       73,      70,  },
  { 31250,       45,        89,       89,      88,  },
  { 28800,       46,        98,       98,      95,  },
  { 19200,       71,       148,      148,     145,  },
  { 14400,       96,       197,      197,     194,  },
  { 9600,       146,       297,      297,     294,  },
  { 4800,       296,       595,      595,     592,  },
  { 2400,       592,      1189,     1189,    1186,  },
  { 1200,      1187,      2379,     2379,    2376,  },
  { 300,       4759,      9523,     9523,    9520,  },
};

#define XMIT_START_ADJUSTMENT 6
« Last Edit: January 05, 2010, 12:19:29 am by macegr » Logged

Unique RGB LED Modules and Arduino shields: http://www.macetech.com/store

Austin, TX USA
Offline Offline
God Member
*****
Karma: 4
Posts: 997
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Nice work, macegr!  This is a very useful contribution.

I have taken your work and incorporated it into NewSoftSerial 10 (currently available for testing at http://www.arduiniana.org).

Mikal
Logged

0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 94
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

can we also get this to work on a 12mhz clock?

can i help in any way?

Thanks
Jeff
Logged

Pages: [1]   Go Up
Jump to: