Attiny85

If I use external crystal because I want to use it at 16MHz, then it means I lost 2 IO pins ?

Hehehe

Vincent19:
If I use external crystal because I want to use it at 16MHz, then it means I lost 2 IO pins ?

Yes. Two pins are required for an external crystal.

The ATtiny85 is capable of running at 16 MHz using the internal oscillator. You do not need an external crystal for that speed. (The internal oscillator is less accurate and less stable than a crystal. If you need an accurate and/or stable clock then you will have to use a crystal.)

How do I configure the attiny 85 to use internal 16MHz crystal ?

By the way, can I confgure the atmega 328 to use internal 16Mhz oscillator too ? I thought atmega 328 just can have 1MHz internal

Vincent19:
How do I configure the attiny 85 to use internal 16MHz crystal ?

Download and install the core available from here...
http://code.google.com/p/arduino-tiny/

Get it working with your processor at 1 MHz.

Select the ATtiny85 @ 16 MHz (internal PLL; 4.3 V BOD) board.

Execute Tools / Burn Bootloader.

Enjoy.

By the way, can I confgure the atmega 328 to use internal 16Mhz oscillator too ?

No. As far as I know, the ATtiny85 # is the only AVR processor that can run at 16 MHz using the internal oscillator. The ATmega328 and all other AVR processor can run up to 8 MHz using the internal oscillator.

I thought atmega 328 just can have 1MHz internal

It has an 8 MHz internal oscillator that can be configured to run at 1, 2, 4, or 8 MHz.

# And siblings: ATtiny45, ATtiny25.

i downloaded the link you gave me previously..and there is no attiny85(16MHz)..is it mean I have to download again with your new link ?

Did you follow the instructions in the readme.txt file?

http://hlt.media.mit.edu/?p=1695

I follow this just now :slight_smile:

* Open the "boards.txt" file and change both of the "upload.using" entries to
** the appropriate value for your setup. Following from the examples above, the**
** file would be here...**
** C:\Projects\Arduino\hardware\tiny\boards.txt**

  • Start the Arduino IDE and ensure there are two new boards listed under the
    [Tools] [Board] menu...

"ATtiny84 @ 8 MHz"
"ATtiny84 @ 1 MHz"

You are now ready to use Arduino-Tiny!

What does the bolded part means ?

I did not do that. And my tools > board now not only contain the 2 new board, but also some others like what you mention(ATtiny85 @ 16 MHz (internal PLL; 4.3 V BOD) board)

And some of my board type has gone missing :frowning:

Vincent19:
* Open the "boards.txt" file and change both of the "upload.using" entries to
** the appropriate value for your setup. Following from the examples above, the**
** file would be here...**
** C:\Projects\Arduino\hardware\tiny\boards.txt**

  • Start the Arduino IDE and ensure there are two new boards listed under the
    [Tools] [Board] menu...

"ATtiny84 @ 8 MHz"
"ATtiny84 @ 1 MHz"

You are now ready to use Arduino-Tiny!

What does the bolded part means ?

I did not do that. And my tools > board now not only contain the 2 new board, but also some others like what you mention(ATtiny85 @ 16 MHz (internal PLL; 4.3 V BOD) board)

I think for the bolded part means I just go and select the board type I need and required ? And delete others ? Hahaha

If I was using an ATtiny85 using the internal oscillator at 8Mhz divided down to 1 Mhz via the prescaler, which option would I use in the IDE:

ATtiny85 @ 8Mhz

or

ATtiny85 @ 1Mhz

Is there any difference in power usage, speed of processing, or anything else material, between running at 8Mhz divided down to 1 Mhz and running at 1Mhz with no prescaler?

Vincent19:
What does the bolded part means ?

Locate the boards.txt file that came in the Arduino Tiny zip file. Open it. Change the .upload.using lines to something like this...

attiny85at16p.upload.using=arduino:USBasp

Save and close the file.

I did not do that.

With Arduino 1.0 and higher you may not need to. There is now a way to specify the programmer without editing boards.txt.

Vincent19:
And some of my board type has gone missing :frowning:

Remove some of the entries from boards.txt that you will not be using.

lemming:
If I was using an ATtiny85 using the internal oscillator at 8Mhz divided down to 1 Mhz via the prescaler, which option would I use in the IDE:

ATtiny85 @ 1 MHz (internal oscillator; BOD disabled)

Is there any difference in power usage,

1 MHz = less power.

speed of processing,

1 MHz = 8 times slower.

running at 1Mhz with no prescaler?

Using what clock?

yea..just stay with those that I want to use.

Thanks

[quote author=Coding Badly link=topic=132007.msg995456#msg995456 date=1352877729]

lemming:
If I was using an ATtiny85 using the internal oscillator at 8Mhz divided down to 1 Mhz via the prescaler, which option would I use in the IDE:

ATtiny85 @ 1 MHz (internal oscillator; BOD disabled)

So means if 8MHz, delay(1000) will run it as delay 1s? how if 16MHz?

So means if 8MHz, delay(1000) will run it as delay 1s? how if 16MHz?

No. As long as you have the correct board selected, delay will work correctly.

Using what clock?

I thought that 1 Mhz internal was an option - I was wrong . But assume a 1 Mhz crystal.

1 MHz = less power.
1 MHz = 8 times slower.

I realise that, but imagine two Atmega328: system #1 - 8Mhz divided down to 1 Mhz. System #2 - 1 Mhz crystal, no divisor.

Both systems have a 'final' clock of 1 Mhz. I assume that both would complete a loop of (say) 100 iterations in the same time.

Are there any any notable performance/efficiency differences between system #1 and system #2?

Also, if I programmed an Arduinos fuses to use the internal oscillator, do I need to remove the crystal to ensure stability?

lemming:

Using what clock?

I thought that 1 Mhz internal was an option - I was wrong . But assume a 1 Mhz crystal.

On an ATtiny85? The hardware can certainly do it, it's how the chips are configured at the factory.

If you're not seeing that option in the IDE then you have an incorrect IDE setup.

lemming:

1 MHz = less power.
1 MHz = 8 times slower.

I realise that, but imagine two Atmega328: system #1 - 8Mhz divided down to 1 Mhz. System #2 - 1 Mhz crystal, no divisor.

Both systems have a 'final' clock of 1 Mhz. I assume that both would complete a loop of (say) 100 iterations in the same time.

Are there any any notable performance/efficiency differences between system #1 and system #2?

1mHz is 1mHz no matter where it comes from. Performance is the same.

But...the internal oscillators aren't as accurate as an external crystal. They vary a little bit with supply voltage and temperature (see the datasheet). If you need very precise timing you have to use external components (this is the reason Atmel gives us options).

lemming:
Also, if I programmed an Arduinos fuses to use the internal oscillator, do I need to remove the crystal to ensure stability?

It won't make any difference to stability because the crystal is completely ignored.

OTOH removing the crystal gives you two extra I/O pins - worth having on a Tiny85!

lemming:

1 MHz = less power.
1 MHz = 8 times slower.

I realise that, but imagine two Atmega328: system #1 - 8Mhz divided down to 1 Mhz. System #2 - 1 Mhz crystal, no divisor.

Both systems have a 'final' clock of 1 Mhz. I assume that both would complete a loop of (say) 100 iterations in the same time.

Almost. As @fungus mentioned there will very likely be a difference in clock speeds. The crystal will very likely be very close to exactly 1 MHz. The internal oscillator will very likely not be close to 1 MHz. (Tuning will get the internal oscillator to ±1%.)

Are there any any notable performance/efficiency differences between system #1 and system #2?

Yes. The crystal will very likely be more stable and more accurate over the range of temperatures and voltages.

Yes. Driving an external crystal takes more energy. (Also, I think the startup time is longer.)

Also, if I programmed an Arduinos fuses to use the internal oscillator, do I need to remove the crystal to ensure stability?

No. When using the internal oscillator, the XTAL1 and XTAL2 pins become normal I/O pins. You can have whatever you want (within reason) connected to the two pins. The internal oscillator does not care.