ATTiny85 maximum frequency without crystal at 3.3V setup help

Go To Last Post
4 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello.

I would like to know what registers I need to set up to which values and by which order in order to make my ATTiny85 run at maximum possible frequency under 3.3V without a crystal. I'm using the pins of the crystal for something else so I cannot use them.

 

Also, in case I do need a crystal, how do I connect it to only one XTAL pin and, again, with which register configuration?

 

I would like to see C code, but if possible without special functions, but only with statements like REGISTER=0x12;. The code needs to be very small.

 

Would anyone know?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Did you look at

 

7.6 Calibrated Internal RC Oscillator

Figure 25-34. Calibrated 8 MHz RC Oscillator Frequency vs. VCC
Figure 25-35. Calibrated 8 MHz RC Oscillator Frequency vs. Temperature
 

in the datasheet?

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I don't think I can find that. There's up to 7.5, but no 7.6.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Foxcat385 wrote:
There's up to 7.5, but no 7.6.
So, which version of the datasheet are you using?

 

What does the Speed Grades chart say?

 

Why does the C code need to be "very small", and why can't "special functions" be used?  Give an example of one of these "special functions".

 

What toolchain are you using?  If your toolchain provides an optimal "special function" like clock_prescale_set http://www.nongnu.org/avr-libc/u... to set the speed for you, then why should we copy the source of that and paste it here?

 

void clock_prescale_set(clock_div_t __x)
 1452 {
 1453     uint8_t __tmp = _BV(CLKPCE);
 1454     __asm__ __volatile__ (
 1455         "in __tmp_reg__,__SREG__" "\n\t"
 1456         "cli" "\n\t"
 1457         "sts %1, %0" "\n\t"
 1458         "sts %1, %2" "\n\t"
 1459         "out __SREG__, __tmp_reg__"
 1460         : /* no outputs */
 1461         : "d" (__tmp),
 1462           "M" (_SFR_MEM_ADDR(CLKPR)),
 1463           "d" (__x)
 1464         : "r0");
 1465 }
 1466 

Foxcat385 wrote:
Also, in case I do need a crystal, how do I connect it to only one XTAL pin and, again, with which register configuration?

Sheesh -- what does the datasheet say, under System Clock and Clock Options/Clock Sources?

 

6.2.6 Crystal Oscillator / Ceramic Resonator
XTAL1 and XTAL2 are input and output, respectively, of an inverting amplifier which can be con-figured for use as an On-chip Oscillator, as shown in Figure 6-5. Either a quartz crystal or a ceramic resonator may be used

 

Is there a XTAL1-only in there anywhere?

 

How about under External Clock?

 

 

When looking at those sections, what does the datasheet say about the "code" to select that clock source?

 

 

 

The device has the following clock source options, selectable by Flash Fuse bits as shown
below.

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.