[En-Nut-Discussion] Baud rate question

Konrad Eisele eiselekd at gmx.de
Fri Mar 27 10:38:31 CET 2009


I switched to 2400 and read the atmega128 manual chart that
statets that for 2400 and 1mhz internal rc-oscillation you'd
need 25 in UBBR. This value was also what ethernut calculated 
and wrote. However garbage still appeared. So I manually 
set it to 26. This time it worked and output seems to be stable.


-------- Original-Nachricht --------
> Datum: Wed, 25 Mar 2009 16:41:44 -0300
> Von: "Thiago A. Corrêa" <thiago.correa at gmail.com>
> An: "Ethernut User Chat (English)" <en-nut-discussion at egnite.de>
> Betreff: Re: [En-Nut-Discussion] Baud rate question

> Hi Konrad,
> 
> On Wed, Mar 25, 2009 at 4:03 PM, Konrad Eisele <eiselekd at gmx.de> wrote:
> > u_long baud = 9600;
> > _ioctl(_fileno(uart), UART_SETSPEED, &baud);
> > ..
> 
> Yes, looks good.
> 
> > Im periodically writing out a simple string in ehternut,
> > inside minicom I can now see that some garbage is
> > periodically apearing. That suggests that the
> > baud rate is not configured corectly. So
> > my question is:
> >
> > What are the correct values to UBRR0
> > I have added
> > NUT_CPU_FREQ = "1000000"
> > NUT_DELAYLOOPS = "1000"
> 
> The atmega128 datasheet has a table with some clock values per
> baudrate that gives UBRR0 values and their error margin.
> 
> Every now and them I also struggle with that same problem whenever we
> do a new project. The most often cause is wrong fuse settings, some
> settings like CLKOPT messes up with the meaning of the other bits.
> 
> Since you are running out of internal clock, did you calibrate it?
> Been there, done that... problems with the calibration value can have
> you chasing bugs for a week :(
> AVRStudio + a jtag mkII can give you the calibration value, but it's
> up to you to figure how to initialize it. Note that this value is
> somewhat silicon specific and you will need to calibrate every device
> you produce.
> There is an auto calibration routine on Atmel website if you want to
> try that but it requires an external reference crystal. It's used on
> the Raven Kit.
> 
> > to my ethernut configuration. Id like to use the 9600
> > baud rate. It shold be slow enough for a 1mhz configuration,
> > or am I wrong?
> 
> If I'm not mistaken faster clocks are less error prone than slower
> clocks. It's crazy, but has to do with the divider. The datasheet
> tables will give you a clear picture.
> 
> Hope this helps.
> 
> Kind Regards,
>    Thiago A. Correa
> _______________________________________________
> http://lists.egnite.de/mailman/listinfo/en-nut-discussion

-- 
Neu: GMX FreeDSL Komplettanschluss mit DSL 6.000 Flatrate + Telefonanschluss für nur 17,95 Euro/mtl.!* http://dsl.gmx.de/?ac=OM.AD.PD003K11308T4569a



More information about the En-Nut-Discussion mailing list