[En-Nut-Discussion] Baud rate question

Ole Reinhardt ole.reinhardt at embedded-it.de
Fri Mar 27 12:21:30 CET 2009


Hi,

> 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.

On such slow clock rates the internal rc-oscillator might have a
signifcant error. You might want to read out the factory programmed
calibration bits from the lock bits and recalibrate your clock.

I used the following trick:

I read out the calibration byte with the ISP programmer and stored the
value in address 0x00 of the CPU internal eeprom. On program start I
read out this value and set the OSCCAL register accordingly.

    EEARH = 0x00;               /* Read calibration byte from eeprom */
    EEARL = 0x00;
    sbi(EECR, EERE);
    OSCCAL = EEDR /*0xa4 */ ;   /* calibrate oscilator */

Perhaps this will solve your problem...

Regards,

Ole Reinhardt

-- 
 _____________________________________________________________
|                                                             |
| Embedded-IT          Hard- und Softwarelösungen             |
|                                                             |
| Ole Reinhardt        Tel. / Fax:        +49 (0)271  7420433 |
| Luisenstraße 29      Mobil:             +49 (0)177  7420433 |
| 57076 Siegen         eMail:    ole.reinhardt at embedded-it.de |
| Germany              Web:         http://www.embedded-it.de |
|                      UstID / VAT:       DE198944716         |
|_____________________________________________________________|




More information about the En-Nut-Discussion mailing list