Datasheet ATtiny804, ATtiny806, ATtiny807, ATtiny1604, ATtiny1606 Datasheet

...

Introduction

ATtiny804/806/807/1604/1606/
1607
tinyAVR® 0-series
The ATtiny804/806/807/1604/1606/1607 are members of the tinyAVR® 0-series of microcontrollers, using the AVR processor with hardware multiplier, running at up to 20 MHz, with 8/16 KB Flash, 512/1024 bytes of SRAM, and 128/256 bytes of EEPROM in a 14-, 20-, or 24-pin package. The tinyAVR® 0-series uses the latest technologies with a flexible, low-power architecture, including Event System, accurate analog features, and Core Independent Peripherals (CIPs).
Attention:  This data sheet is valid for industrial qualified devices.

Features

• CPU – AVR® CPU – Running at up to 20 MHz – Single-cycle I/O access – Two-level interrupt controller – Two-cycle hardware multiplier
• Memories – 8/16 KB In-system self-programmable Flash memory – 128/256 bytes EEPROM – 512/1024 bytes SRAM – Write/erase endurance:
• Flash 10,000 cycles
• EEPROM 100,000 cycles
– Data retention:
• 40 years at 55°C
• System – Power-on Reset (POR) – Brown-out Detector (BOD) – Clock options:
• 16/20 MHz low-power internal RC oscillator
• 32.768 kHz Ultra Low-Power (ULP) internal RC oscillator
• External clock input – Single-Pin Unified Program and Debug Interface (UPDI) – Three sleep modes:
• Idle with all peripherals running for immediate wake-up
• Standby
®
© 2021 Microchip Technology Inc.
Complete Datasheet
DS40002312A-page 1
ATtiny804/806/807/1604/1606/1607
– Configurable operation of selected peripherals
• Power-Down with full data retention
• Peripherals – One 16-bit Timer/Counter type A (TCA) with a dedicated period register and three compare channels – One 16-bit Timer/Counter type B (TCB) with input capture – One 16-bit Real-Time Counter (RTC) running from an external clock or internal RC oscillator – Watchdog Timer (WDT) with Window mode, with a separate on-chip oscillator – One USART with fractional baud rate generator, auto-baud, and start-of-frame detection – One host/client Serial Peripheral Interface (SPI) – One Two-Wire Interface (TWI) with dual address match
• Philips I2C compatible
• Standard mode (Sm, 100 kHz)
• Fast mode (Fm, 400 kHz)
• Fast mode plus (Fm+, 1 MHz) – One Analog Comparator (AC) with a low propagation delay – One 10-bit 115 ksps Analog-to-Digital Converter (ADC) – Multiple voltage references (V
• 0.55V
• 1.1V
• 1.5V
• 2.5V
• 4.3V – Event System (EVSYS) for CPU independent and predictable inter-peripheral signaling – Configurable Custom Logic (CCL) with two programmable look-up tables – Automated CRC memory scan – External interrupt on all general purpose pins
• I/O and Packages: – Up to 22 programmable I/O lines – 14-pin SOIC150 – 20-pin SOIC300 – 20-pin VQFN 3x3 mm – 24-pin VQFN 4x4 mm
• Temperature Ranges: – -40°C to 105°C – -40°C to 125°C
• Speed Grades: – 0-5 MHz @ 1.8V – 5.5V – 0-10 MHz @ 2.7V – 5.5V – 0-20 MHz @ 4.5V – 5.5V
REF
):
© 2021 Microchip Technology Inc.
Complete Datasheet
DS40002312A-page 2
ATtiny804/806/807/1604/1606/1607

Table of Contents

Introduction.....................................................................................................................................................1
Features......................................................................................................................................................... 1
1. Silicon Errata and Data Sheet Clarification Document............................................................................9
2. tinyAVR® 0-series Overview..................................................................................................................10
2.1. Configuration Summary..............................................................................................................10
3. Block Diagram.......................................................................................................................................12
4. Pinout.................................................................................................................................................... 13
4.1. 14-Pin SOIC............................................................................................................................... 13
4.2. 20-Pin SOIC............................................................................................................................... 14
4.3. 20-Pin VQFN.............................................................................................................................. 15
4.4. 24-Pin VQFN.............................................................................................................................. 16
5. I/O Multiplexing and Considerations..................................................................................................... 17
5.1. Multiplexed Signals.................................................................................................................... 17
6. Memories.............................................................................................................................................. 18
6.1. Overview.................................................................................................................................... 18
6.2. Memory Map.............................................................................................................................. 19
6.3. In-System Reprogrammable Flash Program Memory................................................................19
6.4. SRAM Data Memory.................................................................................................................. 20
6.5. EEPROM Data Memory............................................................................................................. 20
6.6. User Row....................................................................................................................................20
6.7. Signature Bytes..........................................................................................................................20
6.8. I/O Memory.................................................................................................................................21
6.9. Memory Section Access from CPU and UPDI on Locked Device..............................................23
6.10. Configuration and User Fuses (FUSE).......................................................................................24
7. Peripherals and Architecture.................................................................................................................42
7.1. Peripheral Address Map.............................................................................................................42
7.2. Interrupt Vector Mapping............................................................................................................43
7.3. System Configuration (SYSCFG)...............................................................................................44
8. AVR® CPU............................................................................................................................................ 47
8.1. Features..................................................................................................................................... 47
8.2. Overview.................................................................................................................................... 47
8.3. Architecture................................................................................................................................ 47
8.4. Arithmetic Logic Unit (ALU)........................................................................................................ 49
8.5. Functional Description................................................................................................................49
8.6. Register Summary......................................................................................................................55
8.7. Register Description................................................................................................................... 55
9. NVMCTRL - Nonvolatile Memory Controller......................................................................................... 59
9.1. Features..................................................................................................................................... 59
© 2021 Microchip Technology Inc.
Complete Datasheet
DS40002312A-page 3
ATtiny804/806/807/1604/1606/1607
9.2. Overview.................................................................................................................................... 59
9.3. Functional Description................................................................................................................60
9.4. Register Summary......................................................................................................................66
9.5. Register Description................................................................................................................... 66
10. CLKCTRL - Clock Controller................................................................................................................. 74
10.1. Features.....................................................................................................................................74
10.2. Overview.................................................................................................................................... 74
10.3. Functional Description................................................................................................................76
10.4. Register Summary......................................................................................................................80
10.5. Register Description...................................................................................................................80
11. SLPCTRL - Sleep Controller................................................................................................................. 89
11.1. Features.....................................................................................................................................89
11.2. Overview.................................................................................................................................... 89
11.3. Functional Description................................................................................................................89
11.4. Register Summary......................................................................................................................93
11.5. Register Description...................................................................................................................93
12. RSTCTRL - Reset Controller................................................................................................................ 95
12.1. Features.....................................................................................................................................95
12.2. Overview.................................................................................................................................... 95
12.3. Functional Description................................................................................................................96
12.4. Register Summary....................................................................................................................100
12.5. Register Description.................................................................................................................100
13. CPUINT - CPU Interrupt Controller..................................................................................................... 103
13.1. Features...................................................................................................................................103
13.2. Overview.................................................................................................................................. 103
13.3. Functional Description..............................................................................................................104
13.4. Register Summary ...................................................................................................................109
13.5. Register Description.................................................................................................................109
14. EVSYS - Event System....................................................................................................................... 114
14.1. Features................................................................................................................................... 114
14.2. Overview...................................................................................................................................114
14.3. Functional Description..............................................................................................................116
14.4. Register Summary....................................................................................................................118
14.5. Register Description................................................................................................................. 118
15. PORTMUX - Port Multiplexer.............................................................................................................. 125
15.1. Overview.................................................................................................................................. 125
15.2. Register Summary....................................................................................................................126
15.3. Register Description.................................................................................................................126
16. PORT - I/O Pin Configuration..............................................................................................................131
16.1. Features...................................................................................................................................131
16.2. Overview.................................................................................................................................. 131
16.3. Functional Description..............................................................................................................133
© 2021 Microchip Technology Inc.
Complete Datasheet
DS40002312A-page 4
ATtiny804/806/807/1604/1606/1607
16.4. Register Summary - PORTx.....................................................................................................136
16.5. Register Description - PORTx.................................................................................................. 136
16.6. Register Summary - VPORTx.................................................................................................. 148
16.7. Register Description - VPORTx................................................................................................148
17. BOD - Brown-out Detector.................................................................................................................. 153
17.1. Features...................................................................................................................................153
17.2. Overview.................................................................................................................................. 153
17.3. Functional Description..............................................................................................................154
17.4. Register Summary....................................................................................................................156
17.5. Register Description.................................................................................................................156
18. VREF - Voltage Reference..................................................................................................................163
18.1. Features...................................................................................................................................163
18.2. Overview.................................................................................................................................. 163
18.3. Functional Description..............................................................................................................163
18.4. Register Summary ...................................................................................................................164
18.5. Register Description.................................................................................................................164
19. WDT - Watchdog Timer.......................................................................................................................167
19.1. Features...................................................................................................................................167
19.2. Overview.................................................................................................................................. 167
19.3. Functional Description..............................................................................................................168
19.4. Register Summary - WDT........................................................................................................171
19.5. Register Description.................................................................................................................171
20. TCA - 16-bit Timer/Counter Type A.....................................................................................................174
20.1. Features...................................................................................................................................174
20.2. Overview.................................................................................................................................. 174
20.3. Functional Description..............................................................................................................176
20.4. Register Summary - Normal Mode...........................................................................................187
20.5. Register Description - Normal Mode........................................................................................ 187
20.6. Register Summary - Split Mode............................................................................................... 206
20.7. Register Description - Split Mode.............................................................................................206
21. TCB - 16-Bit Timer/Counter Type B.................................................................................................... 222
21.1. Features...................................................................................................................................222
21.2. Overview.................................................................................................................................. 222
21.3. Functional Description..............................................................................................................224
21.4. Register Summary....................................................................................................................232
21.5. Register Description.................................................................................................................232
22. RTC - Real-Time Counter................................................................................................................... 243
22.1. Features...................................................................................................................................243
22.2. Overview.................................................................................................................................. 243
22.3. Clocks.......................................................................................................................................244
22.4. RTC Functional Description..................................................................................................... 244
22.5. PIT Functional Description.......................................................................................................245
22.6. Events...................................................................................................................................... 246
© 2021 Microchip Technology Inc.
Complete Datasheet
DS40002312A-page 5
ATtiny804/806/807/1604/1606/1607
22.7. Interrupts..................................................................................................................................246
22.8. Sleep Mode Operation............................................................................................................. 247
22.9. Synchronization........................................................................................................................247
22.10. Debug Operation......................................................................................................................247
22.11. Register Summary....................................................................................................................248
22.12. Register Description.................................................................................................................248
23. USART - Universal Synchronous and Asynchronous Receiver and Transmitter................................264
23.1. Features...................................................................................................................................264
23.2. Overview.................................................................................................................................. 264
23.3. Functional Description..............................................................................................................265
23.4. Register Summary....................................................................................................................280
23.5. Register Description.................................................................................................................280
24. SPI - Serial Peripheral Interface..........................................................................................................298
24.1. Features...................................................................................................................................298
24.2. Overview.................................................................................................................................. 298
24.3. Functional Description..............................................................................................................299
24.4. Register Summary....................................................................................................................306
24.5. Register Description.................................................................................................................306
25. TWI - Two-Wire Interface.................................................................................................................... 313
25.1. Features...................................................................................................................................313
25.2. Overview.................................................................................................................................. 313
25.3. Functional Description..............................................................................................................314
25.4. Register Summary....................................................................................................................325
25.5. Register Description.................................................................................................................325
26. CRCSCAN - Cyclic Redundancy Check Memory Scan...................................................................... 342
26.1. Features...................................................................................................................................342
26.2. Overview.................................................................................................................................. 342
26.3. Functional Description..............................................................................................................343
26.4. Register Summary - CRCSCAN...............................................................................................346
26.5. Register Description.................................................................................................................346
27. CCL - Configurable Custom Logic...................................................................................................... 350
27.1. Features...................................................................................................................................350
27.2. Overview.................................................................................................................................. 350
27.3. Functional Description..............................................................................................................352
27.4. Register Summary....................................................................................................................359
27.5. Register Description.................................................................................................................359
28. AC - Analog Comparator.....................................................................................................................366
28.1. Features...................................................................................................................................366
28.2. Overview.................................................................................................................................. 366
28.3. Functional Description..............................................................................................................368
28.4. Register Summary....................................................................................................................370
28.5. Register Description.................................................................................................................370
29. ADC - Analog-to-Digital Converter...................................................................................................... 375
© 2021 Microchip Technology Inc.
Complete Datasheet
DS40002312A-page 6
ATtiny804/806/807/1604/1606/1607
29.1. Features...................................................................................................................................375
29.2. Overview.................................................................................................................................. 375
29.3. Functional Description..............................................................................................................376
29.4. Register Summary - ADCn.......................................................................................................383
29.5. Register Description.................................................................................................................383
30. UPDI - Unified Program and Debug Interface.....................................................................................401
30.1. Features...................................................................................................................................401
30.2. Overview.................................................................................................................................. 401
30.3. Functional Description..............................................................................................................403
30.4. Register Summary....................................................................................................................423
30.5. Register Description.................................................................................................................423
31. Electrical Characteristics.....................................................................................................................434
31.1. Disclaimer.................................................................................................................................434
31.2. Absolute Maximum Ratings .....................................................................................................434
31.3. General Operating Ratings ......................................................................................................435
31.4. Power Consumption.................................................................................................................436
31.5. Wake-Up Time..........................................................................................................................438
31.6. Peripherals Power Consumption..............................................................................................438
31.7. BOD and POR Characteristics.................................................................................................439
31.8. External Reset Characteristics.................................................................................................440
31.9. Oscillators and Clocks..............................................................................................................440
31.10. I/O Pin Characteristics............................................................................................................. 441
31.11. USART..................................................................................................................................... 443
31.12. SPI........................................................................................................................................... 444
31.13. TWI...........................................................................................................................................445
31.14. VREF........................................................................................................................................448
31.15. ADC..........................................................................................................................................449
31.16. TEMPSENSE........................................................................................................................... 451
31.17. AC............................................................................................................................................ 452
31.18. UPDI Timing.............................................................................................................................452
31.19. Programming Time...................................................................................................................453
32. Typical Characteristics........................................................................................................................ 455
32.1. Power Consumption.................................................................................................................455
32.2. GPIO........................................................................................................................................ 462
32.3. VREF Characteristics...............................................................................................................469
32.4. BOD Characteristics.................................................................................................................471
32.5. ADC Characteristics.................................................................................................................474
32.6. TEMPSENSE Characteristics.................................................................................................. 479
32.7. AC Characteristics....................................................................................................................480
32.8. OSC20M Characteristics..........................................................................................................483
32.9. OSCULP32K Characteristics................................................................................................... 485
32.10. TWI SDA Hold Timing ............................................................................................................. 486
33. Instruction Set Summary.....................................................................................................................487
34. Conventions........................................................................................................................................ 488
© 2021 Microchip Technology Inc.
Complete Datasheet
DS40002312A-page 7
ATtiny804/806/807/1604/1606/1607
34.1. Numerical Notation...................................................................................................................488
34.2. Memory Size and Type.............................................................................................................488
34.3. Frequency and Time.................................................................................................................488
34.4. Registers and Bits....................................................................................................................489
34.5. ADC Parameter Definitions......................................................................................................490
35. Ordering Information........................................................................................................................... 493
35.1. Product Information..................................................................................................................493
35.2. Product Identification System...................................................................................................494
36. Package Drawings.............................................................................................................................. 495
36.1. Online Package Drawings........................................................................................................495
36.2. 14-Pin SOIC.............................................................................................................................496
36.3. 20-Pin SOIC.............................................................................................................................499
36.4. 20-Pin VQFN............................................................................................................................502
36.5. 24-Pin VQFN............................................................................................................................505
36.6. Thermal Considerations...........................................................................................................508
37. Errata.................................................................................................................................................. 509
37.1. Errata - ATtiny804/806/807/1604/1606/1607........................................................................... 509
38. Data Sheet Revision History............................................................................................................... 510
38.1. Rev. A - 04/2021.......................................................................................................................510
38.2. Appendix - Obsolete Revision History......................................................................................516
The Microchip Website...............................................................................................................................519
Product Change Notification Service..........................................................................................................519
Customer Support...................................................................................................................................... 519
Product Identification System.....................................................................................................................520
Microchip Devices Code Protection Feature.............................................................................................. 520
Legal Notice............................................................................................................................................... 520
Trademarks................................................................................................................................................ 521
Quality Management System..................................................................................................................... 521
Worldwide Sales and Service.....................................................................................................................522
© 2021 Microchip Technology Inc.
Complete Datasheet
DS40002312A-page 8
ATtiny804/806/807/1604/1606/1607
Silicon Errata and Data Sheet Clarification ...

1. Silicon Errata and Data Sheet Clarification Document

Microchip aims to provide its customers with the best documentation possible to ensure the successful use of Microchip products. Between data sheet updates, a Silicon errata and data sheet clarification document will contain the most recent information for the data sheet. The ATtiny804/806/807/1604/1606/1607 Silicon Errata and Data Sheet Clarification (www.microchip.com/DS80000951) is available at the device product page on
www.microchip.com.
© 2021 Microchip Technology Inc.
Complete Datasheet
DS40002312A-page 9

2. tinyAVR® 0-series Overview

Pins
Flash
Devices described in this data sheet
Devices described in other data sheets
ATtiny402
ATtiny202
ATtiny804 ATtiny806 ATtiny807
ATtiny404 ATtiny406
ATtiny204
8 20 24
14
ATtiny1604 ATtiny1606 ATtiny1607
2 KB
4 KB
8 KB
16 KB
The following figure shows the tinyAVR 0-series devices, laying out pin count variants and memory sizes:
• Vertical migration upwards is possible without code modification, as these devices are pin-compatible and
provide the same or more features. Downward migration may require code modification due to fewer available instances of some peripherals.
• Horizontal migration to the left reduces the pin count and, therefore, the available features
Figure 2-1. tinyAVR® 0-series Overview
ATtiny804/806/807/1604/1606/1607
tinyAVR® 0-series Overview
Devices with different Flash memory sizes typically also have different SRAM and EEPROM.

2.1 Configuration Summary

2.1.1 Peripheral Summary

Table 2-1. Peripheral Summary
Pins 14 20 24 14 20 24
SRAM 512B 512B 512B 1024B 1024B 1024B
Flash 8 KB 8 KB 8 KB 16 KB 16 KB 16 KB
EEPROM 128B 128B 128B 256B 256B 256B
Max. frequency (MHz) 20 20 20 20 20 20
16-bit Timer/Counter type A (TCA) 1 1 1 1 1 1
16-bit Timer/Counter type B (TCB) 1 1 1 1 1 1
12-bit Timer/Counter type D (TCD) No No No No No No
ATtiny804
ATtiny806
ATtiny807
ATtiny1604
ATtiny1606
ATtiny1607
Real-Time Counter (RTC) 1 1 1 1 1 1
© 2021 Microchip Technology Inc.
Complete Datasheet
DS40002312A-page 10
...........continued
ATtiny804/806/807/1604/1606/1607
tinyAVR® 0-series Overview
ATtiny804
Universal Synchronous and Asynchronous Receiver and Transmitter (USART)
Serial Peripheral Interface (SPI) 1 1 1 1 1 1
Two-Wire Interface (TWI/I2C) 1 1 1 1 1 1
Analog-to-Digital Converter (ADC) 1 1 1 1 1 1
ADC channels 10 12 12 10 12 12
Digital-to-Analog Converter (DAC) No No No No No No
Analog Comparator (AC) 1 1 1 1 1 1
AC inputs 1p/1n 2p/2n 2p/2n 1p/1n 2p/2n 2p/2n
Peripheral Touch Controller (PTC) No No No No No No
Configurable Custom Logic (CCL) 1 1 1 1 1 1
Watchdog Timer (WDT) 1 1 1 1 1 1
Event System (EVSYS) channels 3 3 3 3 3 3
General Purpose I/O 12 18 22 12 18 22
External Interrupts 12 18 22 12 18 22
Cyclic Redundancy Check Memory Scan (CRCSCAN)
1 1 1 1 1 1
1 1 1 1 1 1
ATtiny806
ATtiny807
ATtiny1604
ATtiny1606
ATtiny1607
Unified Program and Debug Interface (UPDI) 1 1 1 1 1 1
© 2021 Microchip Technology Inc.
Complete Datasheet
DS40002312A-page 11

3. Block Diagram

I
N
/ O U T
D A T A B U S
Clock generation
BUS Matrix
CPU
USART0
SPI0
CCL
AC0
ADC0
TCA0
TCB0
AINPn
RXD
TXD
XCK
XDIR
MISO MOSI
SCK
SS
PORTS
EVSYS
System
Management
SLPCTRL
RSTCTRL
CLKCTRL
E V E N T
R O U T
I N G
N E T
W O
R K
D A T A B U S
UPDI
CRC
SRAM
NVMCTRL
Flash
EEPROM
OSC20M
OSC32K
Detectors/
references
BOD/
VLM
POR
Bandgap
WDT
RTC
CPUINT
OCD
UPDI / RESET
EVOUTn
EXTCLK
LUTn-IN[2:0]
LUTn-OUT
W0
CLKOUT
GPIOR
TWI0
SDA
SCL
RST/12V
To detectors
AINNn
OUT
AINn
W0[5:0]
PAn PBn PCn
Figure 3-1. tinyAVR® 0-series Block Diagram
ATtiny804/806/807/1604/1606/1607
Block Diagram
Note:  The block diagram represents the largest device of the tinyAVR® 0-series, both in terms of pin count and
Flash size. See sections 2.1 Configuration Summary and 5. I/O Multiplexing and Considerations for an overview of the features of the specific devices in this data sheet.
© 2021 Microchip Technology Inc.
Complete Datasheet
DS40002312A-page 12

4. Pinout

4.1 14-Pin SOIC

ATtiny804/806/807/1604/1606/1607
Pinout
Power
Power Supply
Ground
VDD
PA4
PA5
PA6
PA7
PB3
PB2
1
2
3
4
5
6
7
14
13
12
11
10
9
8
GND
PA3 (EXTCLK)
PA2
PA1
PA0 (RESET/UPDI)
PB0
PB1
Functionality
Programming/Debug
Clock/Crystal
© 2021 Microchip Technology Inc.
Digital Function OnlyPin on VDD Power Domain
Analog Function
Complete Datasheet
DS40002312A-page 13

4.2 20-Pin SOIC

ATtiny804/806/807/1604/1606/1607
Pinout
VDD
PA4
PA5
PA6
PA7
PB5
PB4
PB3
PB2
PB1
1
2
3
4
5
6
7
8
9
10
20
19
18
17
16
15
14
13
12
11
GND
PA3 (EXTCLK)
PA2
PA1
PA0 (RESET/UPDI)
PC3
PC2
PC1
PC0
PB0
Power
Power Supply
Ground
Functionality
Programming/Debug
Clock/Crystal
Digital Function OnlyPin on VDD Power Domain
Analog Function
© 2021 Microchip Technology Inc.
Complete Datasheet
DS40002312A-page 14

4.3 20-Pin VQFN

ATtiny804/806/807/1604/1606/1607
Pinout
PA2
(EXTCLK) PA3
GND
VDD
PA4
Note: It is recommended to
solder the large center pad to
ground for mechanical stability
Power
Power Supply
PA1
PA0 (RESET/UPDI)
20 19 18 17
1
2
3
4
5
6
7
PA6
PA5
PC3
8
PA7
PC2
PC1
16
15
14
13
12
11
9
10
PB4
PB5
Functionality
Programming/Debug
PC0
PB0
PB1
PB2
PB3
Ground
© 2021 Microchip Technology Inc.
Clock/Crystal
Digital Function OnlyPin on VDD Power Domain
Analog Function
Complete Datasheet
DS40002312A-page 15

4.4 24-Pin VQFN

ATtiny804/806/807/1604/1606/1607
Pinout
PA2
(EXTCLK) PA3
GND
VDD
PA4
PA5
Note: It is recommended to
solder the large center pad to
ground for mechanical stability
Power
PA1
PA0 (RESET/UPDI)
24 23 22 21
1
2
3
4
5
6
8 9
7
PA6
PA7
PC5
10
PB7
PC4
PC3
20
19
11
12
PB6
PB5
Functionality
PC2
18
17
16
15
14
13
PB4
PC1
PC0
PB0
PB1
PB2
PB3
Power Supply
Ground
© 2021 Microchip Technology Inc.
Programming/Debug
Clock/Crystal
Digital Function OnlyPin on VDD Power Domain
Analog Function
Complete Datasheet
DS40002312A-page 16
ATtiny804/806/807/1604/1606/1607
I/O Multiplexing and Considerations

5. I/O Multiplexing and Considerations

5.1 Multiplexed Signals

Table 5-1. PORT Function Multiplexing, 14, 20 and 24 Pins
(1,2)
Pin Name
SOIC 20-Pin
VQFN 24-Pin
23 19 16 10 PA0 RESET/UPDI AIN0 LUT0-IN0
24 20 17 11 PA1 AIN1 TxD
1 1 18 12 PA2 EVOUT0 AIN2 RxD
2 2 19 13 PA3 EXTCLK AIN3 XCK
3 3 20 14 GND
4 4 1 1 V
5 5 2 2 PA4 AIN4 XDIR
6 6 3 3 PA5 AIN5 OUT WO5 WO
7 7 4 4 PA6 AIN6 AINN0
8 8 5 5 PA7 AIN7 AINP0 LUT1-OUT
9 PB7
10 PB6
11 9 6 PB5 CLKOUT AIN8 AINP1 WO2
12 10 7 PB4 AIN9 AINN1 WO1
13 11 8 6 PB3 RxD WO0
14 12 9 7 PB2 EVOUT1 TxD WO2
15 13 10 8 PB1 AIN10 XCK SDA WO1
16 14 11 9 PB0 AIN11 XDIR SCL WO0
17 15 12 PC0 SCK
18 16 13 PC1 MISO
19 17 14 PC2 EVOUT2 MOSI
20 18 15 PC3 SS
21 PC4 WO4
22 PC5 WO5
SOIC 14-Pin
VQFN 20-Pin
DD
Other/Special ADC0 AC0 USART0 SPI0 TWI0 TCA0 TCB0 CCL
(3)
(3)
(3)
(3)
MOSI LUT0-IN1
MISO LUT0-IN2
SCK WO3
SS WO4 LUT0-OUT
(3)
(3)
(3)
(3)
(3)
(3)
(3)
WO3
(3)
(3)
(3)
WO
(3)
LUT0-OUT
LUT1-OUT
LUT1-IN0
LUT1-IN1
LUT1-IN2
(3)
(3)
Notes: 
1. Pin names are of type Pxn, with x being the PORT instance (A, B) and n the pin number. The notation for signals is PORTx_PINn. All pins can be used as event input.
2. All pins can be used for external interrupt, where pins Px2 and Px6 of each port have full asynchronous detection.
3. Alternate pin positions. For selecting the alternate positions, refer to section 15. PORTMUX - Port Multiplexer.
© 2021 Microchip Technology Inc.
Complete Datasheet
DS40002312A-page 17

6. Memories

6.1 Overview

The main memories are SRAM data memory, EEPROM data memory, and Flash program memory. Also, the peripheral registers are located in the I/O memory space.
Table 6-1. Physical Properties of Flash Memory
Property ATtiny804 ATtiny806 ATtiny807 ATtiny1604 ATtiny1606 ATtiny1607
Size 8 KB 8 KB 8 KB 16 KB 16 KB 16 KB
Page size 64B 64B 64B 64B 64B 64B
ATtiny804/806/807/1604/1606/1607
Memories
Number of pages
Start address 0x8000 0x8000 0x8000 0x8000 0x8000 0x8000
Table 6-2. Physical Properties of SRAM
Property ATtiny804 ATtiny806 ATtiny807 ATtiny1604 ATtiny1606 ATtiny1607
Size 512B 512B 512B 1 KB 1 KB 1 KB
Start address 0x3E00 0x3E00 0x3E00 0x3C00 0x3C00 0x3C00
Table 6-3. Physical Properties of EEPROM
Property ATtiny804 ATtiny806 ATtiny807 ATtiny1604 ATtiny1606 ATtiny1607
Size 128B 128B 128B 256B 256B 256B
Page size 32B 32B 32B 32B 32B 32B
Number of pages
Start address 0x1400 0x1400 0x1400 0x1400 0x1400 0x1400
128 128 128 256 256 256
4 4 4 8 8 8
© 2021 Microchip Technology Inc.
Complete Datasheet
DS40002312A-page 18

6.2 Memory Map

Figure 6-1. Memory Map
CPU Code space UPDI/CPU Data space
0x0000
ATtiny804/806/807/1604/1606/1607
Memories
64 I/O Registers
960 Ext I/O Registers
0x0000 – 0x003F
0x0040 – 0x0FFF
Flash code
8/16 KB
NVM I/O Registers and
data
EEPROM 128/256B
(Reserved)
Internal SRAM
512B/1 KB
(Reserved)
0x1000 – 0x13FF
0x1400
0x147F (For EEPROM 128B)/ 0x14FF (For EEPROM 256B)
0x3C00 (for SRAM 1 KB)/ 0x3E00 (for SRAM 512B)
0x3FFF
0x8000
Flash code
8/16 KB

6.3 In-System Reprogrammable Flash Program Memory

The ATtiny804/806/807/1604/1606/1607 contains 8/16 KB on-chip in-system reprogrammable Flash memory for program storage. Since all AVR instructions are 16 or 32-bit wide, the Flash is organized with 16-bit data width. For write protection, the Flash program memory space can be divided into three sections (see the illustration below): Bootloader section, Application code section, and Application data section, with restricted access rights among them.
© 2021 Microchip Technology Inc.
Complete Datasheet
0x9FFF (For Flash 8 KB)/ 0xBFFF (For Flash 16 KB)
DS40002312A-page 19
FLASHSTART: 0x8000
BOOTEND>0: 0x8000+BOOTEND*256
BO O T
APPEND>0: 0x8000+APPEND*256
AP PL IC A T IO N
CO DE
AP PL IC A T IO N
DA TA
FLASH
FLASHEND
ATtiny804/806/807/1604/1606/1607
Memories
The Program Counter (PC) is 12/13-bit wide to address the whole program memory. The procedure for writing Flash memory is described in detail in the documentation of the Nonvolatile Memory Controller (NVMCTRL) peripheral.
The entire Flash memory is mapped in the memory space and is accessible with normal LD/ST instructions as well as the LPM instruction. For LD/ST instructions, the Flash is mapped from address 0x8000. For the LPM instruction, the Flash start address is 0x0000.
The ATtiny804/806/807/1604/1606/1607 also has a CRC peripheral that is a host on the bus.
Figure 6-2. Flash and the Three Sections

6.4 SRAM Data Memory

The 512/1024 bytes SRAM is used for data storage and stack.

6.5 EEPROM Data Memory

The ATtiny804/806/807/1604/1606/1607 has 128/256 bytes of EEPROM data memory. See also section 6.2 Memory
Map. The EEPROM memory supports single-byte read and write. The EEPROM is controlled by the Nonvolatile
Memory Controller (NVMCTRL).

6.6 User Row

In addition to the EEPROM, the ATtiny804/806/807/1604/1606/1607 has one extra page of EEPROM memory that can be used for firmware settings; the User Row (USERROW). This memory supports single-byte read and write as the normal EEPROM. The CPU can write and read this memory as normal EEPROM, and the UPDI can write and read it as a normal EEPROM memory if the part is unlocked. The User Row can be written by the UPDI when the part is locked. USERROW is not affected by a chip erase.

6.7 Signature Bytes

All tinyAVR® microcontrollers have a 3-byte signature code that identifies the device. The three bytes reside in a separate address space. For the device, the signature bytes are given in the following table.
Note:  When the device is locked, only the System Information Block (SIB) can be accessed.
© 2021 Microchip Technology Inc.
Complete Datasheet
DS40002312A-page 20
Table 6-4. Device ID
Device Name Signature Bytes Address
ATtiny804 0x1E 0x93 0x25
ATtiny806 0x1E 0x93 0x24
ATtiny807 0x1E 0x93 0x23
ATtiny1604 0x1E 0x94 0x25
ATtiny1606 0x1E 0x94 0x24
ATtiny1607 0x1E 0x94 0x23

6.8 I/O Memory

All ATtiny804/806/807/1604/1606/1607 I/Os and peripherals are located in the I/O memory space. The I/O address range from 0x00 to 0x3F can be accessed in a single cycle using IN and OUT instructions. The extended I/O memory space from 0x0040 to 0x0FFF can be accessed by the LD/LDS/LDD and ST/STS/STD instructions, transferring data between the 32 general purpose working registers and the I/O memory space.
I/O registers within the address range 0x00-0x1F are directly bit-accessible using the SBI and CBI instructions. In these registers, the value of single bits can be checked by using the SBIS and SBIC instructions. Refer to the Instruction Set section for more details.
For compatibility with future devices, reserved bits must be written to ‘0’ if accessed. Reserved I/O memory addresses must never be written.
Some of the interrupt flags are cleared by writing a ‘1’ to them. On ATtiny804/806/807/1604/1606/1607 devices, the CBI and SBI instructions will only operate on the specified bit and can be used on registers containing such interrupt flags. The CBI and SBI instructions work with registers 0x00-0x1F only.
ATtiny804/806/807/1604/1606/1607
Memories
0x00 0x01 0x02
General Purpose I/O Registers
The ATtiny804/806/807/1604/1606/1607 devices provide four general purpose I/O registers. These registers can be used for storing any information, and they are particularly useful for storing global variables and interrupt flags. General purpose I/O registers, which reside in the address range 0x1C-0x1F, are directly bit-accessible using the SBI, CBI, SBIS, and SBIC instructions.
© 2021 Microchip Technology Inc.
Complete Datasheet
DS40002312A-page 21
ATtiny804/806/807/1604/1606/1607
Memories

6.8.1 Register Summary

Offset Name Bit Pos. 7 6 5 4 3 2 1 0
0x00 GPIOR0 7:0 GPIOR[7:0]
0x01 GPIOR1 7:0 GPIOR[7:0]
0x02 GPIOR2 7:0 GPIOR[7:0]
0x03 GPIOR3 7:0 GPIOR[7:0]

6.8.2 Register Description

© 2021 Microchip Technology Inc.
Complete Datasheet
DS40002312A-page 22
ATtiny804/806/807/1604/1606/1607
Memories
6.8.2.1 General Purpose I/O Register n
Name:  GPIORn Offset:  0x00 + n*0x01 [n=0..3] Reset:  0x00 Property:  -
These are general purpose registers that can be used to store data, such as global variables and flags, in the bit-accessible I/O memory space.
Bit 7 6 5 4 3 2 1 0
Access
Reset 0 0 0 0 0 0 0 0
R/W R/W R/W R/W R/W R/W R/W R/W
Bits 7:0 – GPIOR[7:0] General Purpose I/O Register Byte

6.9 Memory Section Access from CPU and UPDI on Locked Device

The device can be locked so that the memories cannot be read using the UPDI. The locking protects both the Flash (all Boot, Application Code, and Application Data sections), SRAM, and the EEPROM, including the FUSE data. This prevents successful reading of application data or code using the debugger interface. Regular memory access from within the application is still enabled.
The device is locked by writing a non-valid key to the LOCKBIT bit field in FUSE.LOCKBIT.
Table 6-5. Memory Access Unlocked (FUSE.LOCKBIT Valid Key)
GPIOR[7:0]
(1)
Memory Section CPU Access UPDI Access
Read Write Read Write
SRAM Yes Yes Yes Yes
Registers Yes Yes Yes Yes
Flash Yes Yes Yes Yes
EEPROM Yes Yes Yes Yes
USERROW Yes Yes Yes Yes
SIGROW Yes No Yes No
Other fuses Yes No Yes Yes
Table 6-6. Memory Access Locked (FUSE.LOCKBIT Invalid Key)
(1)
Memory Section CPU Access UPDI Access
Read Write Read Write
SRAM Yes Yes No No
Registers Yes Yes No No
Flash Yes Yes No No
EEPROM Yes Yes No No
USERROW Yes Yes No Yes
(2)
SIGROW Yes No No No
Other fuses Yes No No No
© 2021 Microchip Technology Inc.
Complete Datasheet
DS40002312A-page 23
ATtiny804/806/807/1604/1606/1607
Notes: 
1. Read operations marked No in the tables may appear to be successful, but the data are not valid. Hence, any attempt of code validation through the UPDI will fail on these memory sections.
2. In the Locked mode, the USERROW can be written using the Fuse Write command, but the current USERROW values cannot be read out.
Important:  The only way to unlock a device is through a CHIPERASE. No application data are retained.

6.10 Configuration and User Fuses (FUSE)

Fuses are part of the nonvolatile memory and hold the device configuration. The fuses are available from the device power-up. The fuses can be read by the CPU or the UPDI but can only be programmed or cleared by the UPDI. The configuration values stored in the fuses are written to their respective target registers at the end of the start-up sequence.
The fuses for peripheral configuration (FUSE) are pre-programmed but can be altered by the user. Altered values in the configuration fuse will be effective only after a Reset.
Note:  When writing the fuses, all reserved bits must be written to ‘1’.
Memories
© 2021 Microchip Technology Inc.
Complete Datasheet
DS40002312A-page 24
ATtiny804/806/807/1604/1606/1607
Memories

6.10.1 Signature Row Summary

Offset Name Bit Pos. 7 6 5 4 3 2 1 0
0x00 DEVICEID0 7:0 DEVICEID[7:0]
0x01 DEVICEID1 7:0 DEVICEID[7:0]
0x02 DEVICEID2 7:0 DEVICEID[7:0]
0x03 SERNUM0 7:0 SERNUM[7:0]
0x04 SERNUM1 7:0 SERNUM[7:0]
0x05 SERNUM2 7:0 SERNUM[7:0]
0x06 SERNUM3 7:0 SERNUM[7:0]
0x07 SERNUM4 7:0 SERNUM[7:0]
0x08 SERNUM5 7:0 SERNUM[7:0]
0x09 SERNUM6 7:0 SERNUM[7:0]
0x0A SERNUM7 7:0 SERNUM[7:0]
0x0B SERNUM8 7:0 SERNUM[7:0]
0x0C SERNUM9 7:0 SERNUM[7:0]
0x0D
... 0x1F
0x20 TEMPSENSE0 7:0 TEMPSENSE[7:0]
0x21 TEMPSENSE1 7:0 TEMPSENSE[7:0]
0x22 OSC16ERR3V 7:0 OSC16ERR3V[7:0]
0x23 OSC16ERR5V 7:0 OSC16ERR5V[7:0]
0x24 OSC20ERR3V 7:0 OSC20ERR3V[7:0]
0x25 OSC20ERR5V 7:0 OSC20ERR5V[7:0]
Reserved

6.10.2 Signature Row Description

© 2021 Microchip Technology Inc.
Complete Datasheet
DS40002312A-page 25
ATtiny804/806/807/1604/1606/1607
Memories
6.10.2.1 Device ID n
Name:  DEVICEIDn Offset:  0x00 + n*0x01 [n=0..2] Default:  [Device ID] Property:  -
Each device has a device ID identifying this device and its properties such as memory sizes, pin count, and die revision. This ID can be used to identify a device and hence, the available features by software. The Device ID consists of three bytes: SIGROW.DEVICEID[2:0].
Bit 7 6 5 4 3 2 1 0
Access
Default x x x x x x x x
R R R R R R R R
Bits 7:0 – DEVICEID[7:0] Byte n of the Device ID
DEVICEID[7:0]
© 2021 Microchip Technology Inc.
Complete Datasheet
DS40002312A-page 26
ATtiny804/806/807/1604/1606/1607
Memories
6.10.2.2 Serial Number Byte n
Name:  SERNUMn Offset:  0x03 + n*0x01 [n=0..9] Default:  [device serial number] Property:  -
Each device has an individual serial number, representing a unique ID. This ID can be used to identify a specific device in the field. The serial number consists of ten bytes: SIGROW.SERNUM[9:0].
Bit 7 6 5 4 3 2 1 0
Access
Default x x x x x x x x
R R R R R R R R
Bits 7:0 – SERNUM[7:0] Serial Number Byte n
SERNUM[7:0]
© 2021 Microchip Technology Inc.
Complete Datasheet
DS40002312A-page 27
ATtiny804/806/807/1604/1606/1607
Memories
6.10.2.3 Temperature Sensor Calibration n
Name:  TEMPSENSEn Offset:  0x20 + n*0x01 [n=0..1] Default:  [Temperature sensor calibration value] Property:  -
The Temperature Sensor Calibration registers contain correction factors for temperature measurements from the on-chip sensor. The ADC.SIGROW.TEMPSENSE0 is a correction factor for the gain/slope (unsigned), and SIGROW.TEMPSENSE1 is a correction factor for the offset (signed).
Bit 7 6 5 4 3 2 1 0
Access
Default x x x x x x x x
R R R R R R R R
Bits 7:0 – TEMPSENSE[7:0] Temperature Sensor Calibration Byte n Refer to the ADC section for a description of how to use this register.
TEMPSENSE[7:0]
© 2021 Microchip Technology Inc.
Complete Datasheet
DS40002312A-page 28
ATtiny804/806/807/1604/1606/1607
Memories
6.10.2.4 OSC16 Error at 3V
Name:  OSC16ERR3V Offset:  0x22 Default:  [Oscillator frequency error value] Property:  -
Bit 7 6 5 4 3 2 1 0
Access
Default x x x x x x x x
R R R R R R R R
Bits 7:0 – OSC16ERR3V[7:0] OSC16 Error at 3V These registers contain the signed oscillator frequency error value relative to the nominal oscillator frequency when running at an internal 16 MHz at 3V, as measured during production.
OSC16ERR3V[7:0]
© 2021 Microchip Technology Inc.
Complete Datasheet
DS40002312A-page 29
ATtiny804/806/807/1604/1606/1607
Memories
6.10.2.5 OSC16 Error at 5V
Name:  OSC16ERR5V Offset:  0x23 Default:  [Oscillator frequency error value] Property:  -
Bit 7 6 5 4 3 2 1 0
Access
Default x x x x x x x x
R R R R R R R R
Bits 7:0 – OSC16ERR5V[7:0] OSC16 Error at 5V These registers contain the signed oscillator frequency error value relative to the nominal oscillator frequency when running at an internal 16 MHz at 5V, as measured during production.
OSC16ERR5V[7:0]
© 2021 Microchip Technology Inc.
Complete Datasheet
DS40002312A-page 30
Loading...
+ 492 hidden pages