Serial baud rate

Hi all,

I would like to know what the maximun serial baud rate is for an arduino and or if someone has any experience working at higher baud rates than 115200bps.

Aditionally i was also wondering what are the clock requirements to do so. Lets immagine I use the built in oscillator on the mega328, running at 8Mhz:

  • Would this be accurate enough to read a few analog sensors and send data reliably over a serial communication?
  • What would the maximun baud rate archievable be using the 8Mhz clock?

used it quite a lot,
you can set the baud rate to 500 000
but the Arduino Serial monitor cannot read at that pace (not supported)
use a terminal program like putty.exe or rterm.exe (or your favo terminal)

casemod:
Aditionally i was also wondering what are the clock requirements to do so. Lets immagine I use the built in oscillator on the mega328, running at 8Mhz:

.. in which case it's unlikely to work. Serial data needs very accurate timing.

Why do you need serial? There's lots of better, faster, more reliable ways to transmit data.

at 8mhz 115k the internal oscillator is capable of providing more accurate timing than a crystal. uart divisors have too much error at exactly 8mhz but with slight adjustment of the internal clock can be right on for that baud rate. 1mhz is mentioned a lot lately but cable issues and operating system incompatibilities often prevent communication with a pc . imo 57k is the best choice for all hardware configurations including 8mhz xtl.

fungus:

casemod:
Aditionally i was also wondering what are the clock requirements to do so. Lets immagine I use the built in oscillator on the mega328, running at 8Mhz:

.. in which case it's unlikely to work. Serial data needs very accurate timing.

Why do you need serial? There's lots of better, faster, more reliable ways to transmit data.

Well I have the SPI bus taken already, so a serial LCD seems to be the way if litle overhead is needed
According to atmel the factory RC can be trimmed to 1%. Has anyone did did on arduino?

Description...
http://forum.arduino.cc/index.php?topic=8553.0

Latest version (which is always available on the project page)...
https://code.google.com/p/arduino-tiny/downloads/list?can=2&q=tinytuner

It was designed to work on ATtiny processors but it should not be too difficult to get it working on an ATmega328.

casemod:
According to atmel the factory RC can be trimmed to 1%. Has anyone did did on arduino?

Yes, lots of people.

Search the forums for "SoftwareSerial", see for yourself how much trouble it causes...even with trimming.

actually using internal osc has nothing to do with uart or softserial. generally 99.9% of new avrs work fine for either w/o any trimming. default osccal is very close to 8mhz. older ones like mega8 which have level 2 type internal osc still pretty close. in my experience 95% require no tuning. calibration is so easy though it dont make too much sense to avoid that step.

fungus:
Yes, lots of people.

Search the forums for "SoftwareSerial", see for yourself how much trouble it causes...even with trimming.

Software serial has issues even running with a crystal, so its not a great comparison to start with.

In addition, over the entire temperature / voltage envelope, a tuned internal oscillator is accurate enough for serial communications. Any problems with SoftwareSerial have nothing to do with a tuned oscillator.

casemod:
Software serial has issues even running with a crystal, so its not a great comparison to start with.

if by twice as accurate as hardware uart (2x resolution), more portable, less code, and more flexible protocols then you are correct. in fact its about the only way to guarantee reliable operation of 115k at 8mhz. the only place where uart excels is when doing many other things concurrently. even then, using pin ints in conjunction w/softserial reduces that problem.

specially comes in handy on avrs that have no uart. lol.

a tuned internal oscillator

Note that the "factory calibration" value is for 8MHz +/-10%, at 3V.
In theory, that could be "not good enough" for serial communications.

john1993:
if by twice as accurate as hardware uart (2x resolution), more portable, less code, and more flexible protocols then you are correct. in fact its about the only way to guarantee reliable operation of 115k at 8mhz. the only place where uart excels is when doing many other things concurrently. even then, using pin ints in conjunction w/softserial reduces that problem.

Care to post your references?

if you dont understand that uart baud is limited to 2 clk resolution while nops adjust to 1, all avrs have a portb but minority have uarts, and hw cant do 3/9/16 bit protocols, etc then references wont help. if you really twist my arm i can post code for serial in that is 3/4 the smallest hw routine.

john1993:
f you really twist my arm i can post code for serial in that is 3/4 the smallest hw routine.

I'm interested in evaluating that, performance wise.

performance...lol. i dont thinks it has any performance advantage except smaller and more accurate for reasons described above.

RxByte: ldi r23,0x80
 ldi r24,15
l1: sbic pinb,3
 rjmp l1
l2: rcall l3
 ldi r24,31
 sbic pinb,3
 sec
 ror r23
 brcc l2
l3: subi r24,1
 brne l3
 ret

this is from a bootloader im working on. iirc we can drop at least 2 more bytes but there was some drawback i dont recall atm. i think this is about half the size of atmels demo, btw its not my invention but from a fellow a lot smarter than me. crazier too if thats possible. many others have taken advantage of his creativity.

john1993:

RxByte: ldi r23,0x80

ldi r24,15
l1: sbic pinb,3
rjmp l1
l2: rcall l3
ldi r24,31
sbic pinb,3
sec
ror r23
brcc l2
l3: subi r24,1
brne l3
ret

The mention for "software serial" earlier on this post was an arduino library, which doesnt seem to be what you are refering to.
How exactly can I transmit serial data using the code above? It will certainlynot run on arduino on its own.

i can see now that as suspected you are not reading these posts carefully. anyway fyi this is for a 64 byte version of optiboot which will run fine on arduinos.

ps, it will also work within any arduino sketch when properly integrated.

john1993:
It will also work within any arduino sketch when properly integrated.

And how would that be?

google is your friend. i notice many are from this very website. heres a couple crossroads posted here recently: