Skip to content
This repository has been archived by the owner on May 24, 2019. It is now read-only.

Latest commit

 

History

History
44 lines (33 loc) · 3.53 KB

ATtiny_x5.md

File metadata and controls

44 lines (33 loc) · 3.53 KB

ATtiny 25/45/85

x5 pin mapping

Specifications .
Flash (program memory) 2048b/4096b/8192b
RAM 128/256/512 bytes
EEPROM 128/256/512 bytes
Bootloader No
GPIO Pins 5
ADC Channels 4 (including the one on reset)
PWM Channels 3
Interfaces USI, high speed timer
Clock options Internal 1/8mhz, Internal PLL at 16mhz, external crystal or clock up to 20mhz

PLL Clock

The ATtiny x5 series parts have an on-chip PLL. This is clocked off the internal oscillator and nominally runs at 64mhz when enabled. As a result, it is possible to clock the chip off 1/4th of the PLL clock speed, providing a 16mhz clock option without a crystal (this has the same accuracy problems as the internal oscillator driving it). Alternately, or in addition to using it to derive the system clock, Timer1 can be clocked off the PLL. See below.

Timer1 Clock Source option

The ATtiny x5 series parts are equipped with a special high speed 8-bit timer, Timer1 (this is very different from the traditional 16-bit timer1 used on the atmega328p and almost every other chip in the 8-bit AVR product line). This timer can be clocked off the system clock (default), OR from the PLL at 64 mhz or 32mhz - this is then fed into the prescaler, which can prescale it by any power of two from 1 to 16384. Changing this option will impact the frequency of PWM output on Pin 3. See chapter 12 of the datasheet for more information on the high speed timer.

Tone Support

Tone() uses timer1. For best results, use pin 4 for tone - this will use Timer1's output compare unit to generate the tone, rather than generating an interrupt to toggle the pin. In this way, tones can be generated up into the MHz range. If timer1 is set to use the PLL clock (provided this is done using the menu option, not manually), Tone will figure this out and output the requested frequency. With timer1 running off the PLL @ 64mhz, tone() should be able to output a 32mhz signal on pin 4!

I2C Support

There is no hardware I2C peripheral. The USI can be used to provide I2C support with the TinyWireM or TinyWireS library

SPI Support

There is no hardware SPI peripheral. The USI can be used to provide SPI support with one of the TinySPI libraries

UART (Serial) Support

There is no hardware UART support. If running off the internal oscillator, you may need to calibrate it to get the speed close enough to the correct speed for UART communication to work. The core incorporates a built-in software serial named Serial - this uses the analog comparator pins, in order to use the Analog Comparator's interrupt, so that it doesn't conflict with libraries and applications that require PCINTs. TX is AIN0, RX is AIN1. Although it is named Serial, it is still a software implementation, so it is recommended to keep the baud rate low, and you cannot send or receive at the same time. The SoftwareSerial library may be used; if it is used at the same time as the built-in software Serial, only one of them can send or receive at a time (if you need to be able to use both at the same time, or send and receive at the same time, you must use a device with a hardware UART).

ADC Reference options

  • DEFAULT: Vcc
  • EXTERNAL: Voltage applied to AREF pin
  • INTERNAL1V1: Internal 1.1v reference
  • INTERNAL: synonym for INTERNAL1V1
  • INTERNAL2V56: Internal 2.56v reference, with external bypass
  • INTERNAL2V56_NO_CAP: Internal 2.56v reference, without external bypass
  • INTERNAL2V56NOBP: Synonym for INTERNAL2V56_NO_CAP