ATtiny85: Difference between revisions

From Leo's Notes
This page was last edited on 31 July 2021, at 20:34.
initial content
 
No edit summary
Line 1: Line 1:
The ATTiny85 is an Atmel 8-bit AVR microcontroller. It's main features are its low power consumption and its small form factor.
The ATtiny85 is an Atmel 8-bit AVR microcontroller. The ATtiny falls under the tinyAVR series of AVR controllers and is more limited in terms of available memory, IO pins, and peripheral sets when compared to the megaAVR series microcontrollers found in many Arduinos. However, the ATtiny trades these limitations for lower power consumption and smaller form factor.
 
=== A quick overview on using the ATtiny ===
[[File:ATtiny25 ATtiny45 ATtiny85 pinout.svg|alt=ATtiny25/ATtiny45/ATtiny85 pinout|thumb|ATtiny25/ATtiny45/ATtiny85 pinout]]
The ATtiny85 in the DIP/SOIC/SOP package has 8 pins. The pinouts are shown on the right. To program the ATtiny, we will be using ISP via pins 5, 6, and 7 (outlined in orange in the diagram). Any ISP programmer will do, but we will be using an Arudino.
 
An Arduino can be converted into an ISP programmer by loading the ArduinoISP sketch from the examples menu. Once the sketch is on the Arduino, connect the ATtiny to the Arduino based on the table below.
{| class="wikitable"
!Arduino Pin
!Function
!Connect to ATtiny85 Pin
|-
|10
|Reset
|1
|-
|11
|MOSI
|5
|-
|12
|MISO
|6
|-
|13
|SCK
|7
|}
Connect ground and power to the ATtiny via the Arudino. You may use either 5 or 3.3 volts. A 10uF capacitor should also be connected between ground and the Arudino reset pin to prevent the Arduino from resetting during the ISP programming. At the end, it should look something like the following:
 
 
 
Random notes:
 
*All 6 port B pins can be used as IO lines to the internal 8 bit bus (high bits, lower 2 bits aren't connected?)
*System clock can be selected with CKSEL. It can use the internal 8MHz ocillator (with some options which sets it to 16 or 8mhz) An external clock is given with XTAL1 and XTAL2.
*Regardless of the oscillator, CLKPS sets the prescaler
*Setting the wrong clock setting can be problematic to recover from. You would likely need to inject a clock signal.
*
 
 
Fuses
 
*Settings are set with fuses. These fuses are actually flash/eeprom and used as configuration parameters.
*Fuse calculator at <nowiki>https://www.engbedded.com/fusecalc/</nowiki>
 
 
Other resources
 
*https://www.electroschematics.com/attiny85-pwm-primer-tutorial-using-arduino/
*https://circuitdigest.com/microcontroller-projects/attiny85-ic-programming-through-usb-using-digispark-bootloader
 
<br />
 
Comparisons


The distinction between the other ATtiny microprocessors are:
The distinction between the other ATtiny microprocessors are:
Line 28: Line 82:
|12
|12
|}
|}
Random notes:
* All 6 port B pins can be used as IO lines to the internal 8 bit bus (high bits, lower 2 bits aren't connected?)
* System clock can be selected with CKSEL. It can use the internal 8MHz ocillator (with some options which sets it to 16 or 8mhz) An external clock is given with XTAL1 and XTAL2.
* Regardless of the oscillator, CLKPS sets the prescaler
* Setting the wrong clock setting can be problematic to recover from. You would likely need to inject a clock signal.
*
Fuses
* Settings are set with fuses. These fuses are actually flash/eeprom and used as configuration parameters.
* Fuse calculator at <nowiki>https://www.engbedded.com/fusecalc/</nowiki>
Flashing
*
Other resources
* https://www.electroschematics.com/attiny85-pwm-primer-tutorial-using-arduino/
* https://circuitdigest.com/microcontroller-projects/attiny85-ic-programming-through-usb-using-digispark-bootloader
<br />

Revision as of 20:34, 31 July 2021

The ATtiny85 is an Atmel 8-bit AVR microcontroller. The ATtiny falls under the tinyAVR series of AVR controllers and is more limited in terms of available memory, IO pins, and peripheral sets when compared to the megaAVR series microcontrollers found in many Arduinos. However, the ATtiny trades these limitations for lower power consumption and smaller form factor.

A quick overview on using the ATtiny

ATtiny25/ATtiny45/ATtiny85 pinout
ATtiny25/ATtiny45/ATtiny85 pinout

The ATtiny85 in the DIP/SOIC/SOP package has 8 pins. The pinouts are shown on the right. To program the ATtiny, we will be using ISP via pins 5, 6, and 7 (outlined in orange in the diagram). Any ISP programmer will do, but we will be using an Arudino.

An Arduino can be converted into an ISP programmer by loading the ArduinoISP sketch from the examples menu. Once the sketch is on the Arduino, connect the ATtiny to the Arduino based on the table below.

Arduino Pin Function Connect to ATtiny85 Pin
10 Reset 1
11 MOSI 5
12 MISO 6
13 SCK 7

Connect ground and power to the ATtiny via the Arudino. You may use either 5 or 3.3 volts. A 10uF capacitor should also be connected between ground and the Arudino reset pin to prevent the Arduino from resetting during the ISP programming. At the end, it should look something like the following:


Random notes:

  • All 6 port B pins can be used as IO lines to the internal 8 bit bus (high bits, lower 2 bits aren't connected?)
  • System clock can be selected with CKSEL. It can use the internal 8MHz ocillator (with some options which sets it to 16 or 8mhz) An external clock is given with XTAL1 and XTAL2.
  • Regardless of the oscillator, CLKPS sets the prescaler
  • Setting the wrong clock setting can be problematic to recover from. You would likely need to inject a clock signal.


Fuses

  • Settings are set with fuses. These fuses are actually flash/eeprom and used as configuration parameters.
  • Fuse calculator at https://www.engbedded.com/fusecalc/


Other resources


Comparisons

The distinction between the other ATtiny microprocessors are:

ATTiny25 ATTiny45 ATTiny85
Programmable Flash Memory (10k write/erase) 2K 4K 8K
EEPROM (100k write/erase) 128 bytes 256 bytes 512 bytes
SRAM 128 bytes 256 bytes 512 bytes
Program Counter bits wide 10 11 12