[En-Nut-Discussion] Baud rate question
Hans-Gerd Sandhagen
Hans-Gerd.Sandhagen at weiteck.de
Thu Mar 26 08:36:14 CET 2009
I had the same problem with ATmega164.
There is an application note (with source code included) from Atmel: AVR053:
Calibration of the internal RC oscillator
The code should work with different programmers an all ATmega with tunable RC
oscillators.
I hope, that will help.
Hans-Gerd
P.S.: The best way to avoid this problems is using an external oscillator and/or
using a clock frequency that match baud rate generator (1.8432 MHz or multiplies
of it). Otherwise the baud rate generator is not able to produce the exact
timing an all tolerances in silicon make it worse.
Konrad Eisele schrieb:
> Im using a Crumb128 board with a atmega128 on it.
> I programmed the clock fuses to 1 mhz internal
> rc oscillation. Now I would like to output some
> characters on the uart port. Im using parts of the
> example from the ethernut homepage an do a:
> ..
> u_long baud = 9600;
> _ioctl(_fileno(uart), UART_SETSPEED, &baud);
> ..
>
> The crumb128 board has a silicon labs CP2102
> uart-to-usb bridge on it. I have connected
> the usb port to minicom in linux and device is
> detected.
>
> 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"
> 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?
>
> -- Konrad
>
>
>
>
More information about the En-Nut-Discussion
mailing list