avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-gcc-list] TWI with built in oscillator


From: Joerg Wunsch
Subject: Re: [avr-gcc-list] TWI with built in oscillator
Date: Tue, 24 Jun 2003 09:51:29 +0200 (MET DST)

Hársszegi Tibor <address@hidden> wrote:

> but it gave me the idea that I can't use the 1Mhz internal
> oscillator for TWI, since the resulting TWBR would be way to small
> (the datasheet for ATmega8 tells me that it (TWBR) should be at
> least 10 if operating in Master mode).

Then you probably need a higher clock, indeed.

> My other question, how can I set the internal oscillator's frequency
> higher than 1Mhz SAFELY (i.e. how can I read the calibration bytes
> runtime to set OSCCAL CORRECTLY!!!)

You cannot read them at run-time.  They are only accessible at the
programmer's level (avrdude and such), so your only chance is to copy
the respective calibration byte from calibration memory space to e. g.
EEPROM using the programmer.  With avrdude, that process could be
automated though: read the calib byte(s) into a file, then possibly
convert it to match the address and length in EEPROM, then write the
file to EEPROM.  Of course, the simplest situation is if you read all
four calibration bytes, and store them on EEPROM addresses 0 through
3, since then you can skip the data conversion step.

Note that you need the avrdude.conf from the latest CVS version of
avrdude (rev. 1.18) in order to get support for all four calibration
bytes on the ATmega8.

-- 
J"org Wunsch                                           Unix support engineer
address@hidden        http://www.interface-systems.de/~j/


reply via email to

[Prev in Thread] Current Thread [Next in Thread]