Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
ATtiny104_Datasheet.pdf
Скачиваний:
0
Добавлен:
12.02.2026
Размер:
3.8 Mб
Скачать

The Non-Volatile Memories can be externally programmed via the Tiny Programming Interface (TPI). For details on the TPI, see Programming interface. Using the TPI, the external programmer can access the NVM control and status registers mapped to I/O space and the NVM memory mapped to data memory space.

Related Links

TPI-Tiny Programming Interface on page 198

20.6.1.Entering External Programming Mode

The TPI must be enabled before external programming mode can be entered. The following procedure describes, how to enter the external programming mode after the TPI has been enabled:

1.Make a request for enabling NVM programming by sending the NVM memory access key with the SKEY instruction.

2.Poll the status of the NVMEN bit in TPISR until it has been set.

Refer to the Programming Interface description for more detailed information of enabling the TPI and programming the NVM.

Related Links

TPI-Tiny Programming Interface on page 198

20.6.2.Exiting External Programming Mode

Clear the NVM enable bit to disable NVM programming, then release the RESET pin. See NVMEN bit in TPISR – Tiny Programming Interface Status Register.

Related Links

TPISR on page 209

20.7.Register Description

Atmel ATtiny102 / ATtiny104 [DATASHEET] 195

Atmel-42505D-ATtiny102-ATtiny104_Datasheet_Complete-10/2016

20.7.1.Non-Volatile Memory Control and Status Register

Name:  NVMCSR Offset:  0x32 Reset:  0x00 Property: -

 

Bit

7

6

5

4

3

2

1

0

NVMBSY

Access R/W

Reset 0

Bit 7 – NVMBSY: Non-Volatile Memory Busy

This bit indicates the NVM memory (Flash memory and Lock Bits) is busy, being programmed. This bit is set when a program operation is started, and it remains set until the operation has been completed.

Atmel ATtiny102 / ATtiny104 [DATASHEET] 196

Atmel-42505D-ATtiny102-ATtiny104_Datasheet_Complete-10/2016

20.7.2.Non-Volatile Memory Command Register

Name:  NVMCMD Offset:  0x33 Reset:  0x00 Property: -

 

Bit

7

6

5

4

3

2

1

0

 

 

 

 

 

NVMCMD[5:0]

 

 

Access

 

 

R/W

R/W

R/W

R/W

R/W

R/W

Reset

 

 

0

0

0

0

0

0

Bits 5:0 – NVMCMD[5:0]: Non-Volatile Memory Command

These bits define the programming commands for the flash.

Table 20-10. NVM Programming commands

Operation Type

NVMCMD

 

Mnemonic

Description

 

 

 

 

 

 

 

Binary

Hex

 

 

General

0b000000

0x00

NO_OPERATION

No operation

 

 

 

 

 

 

0b010000

0x10

CHIP_ERASE

Chip erase(1)

 

0b010001

0x11

CHIP_WRITE

Write chip(2)

Section

0b010100

0x14

SECTION_ERASE

Section erase

 

 

 

 

 

Word

0b011101

0x1D

WORD_WRITE

Word write

 

 

 

 

 

Page

0b011000

0x18

PAGE_ERASE

Erase page

 

 

 

 

 

Note: 

1.Erase the Code section and the Non-Volatile Memory lock bits.

2.Write the Code section, but doesn't affect the Non-Volatile Memory lock bits. Self-programming supports NO_OPERATION, WORD_WRITE, and PAGE_ERASE

Atmel ATtiny102 / ATtiny104 [DATASHEET] 197

Atmel-42505D-ATtiny102-ATtiny104_Datasheet_Complete-10/2016

21.TPI-Tiny Programming Interface

21.1.Overview

The Tiny Programming Interface (TPI) supports external programming of all Non-Volatile Memories (NVM). Memory programming is done via the NVM Controller, by executing NVM controller commands as described in Memory Programming.

Related Links

MEMPROGMemory Programming on page 185

21.2.Features

Physical Layer:

Synchronous Data Transfer

Bi-directional, Half-duplex Receiver And Transmitter

Fixed Frame Format With One Start Bit, 8 Data Bits, One Parity Bit And 2 Stop Bits

Parity Error Detection, Frame Error Detection And Break Character Detection

Parity Generation And Collision Detection – Automatic Guard Time Insertion Between Data Reception And Transmission

Access Layer:

Communication Based On Messages

Automatic Exception Handling Mechanism

Compact Instruction Set

NVM Programming Access Control

Tiny Programming Interface Control And Status Space Access Control

Data Space Access Control

21.3.Block Diagram

The Tiny Programming Interface (TPI) provides access to the programming facilities. The interface consists of two layers: the access layer and the physical layer.

Figure 21-1. The Tiny Programming Interface and Related Internal Interfaces

 

 

 

NVM

 

TINY PROGRAMMING INTERFACE (TPI)

CONTROLLER

RESET

PHYSICAL

ACCESS

 

TPICLK

 

LAYER

LAYER

NON-VOLATILE

TPIDATA

 

 

MEMORIES

 

 

 

 

 

 

DATA BUS

Programming is done via the physical interface. This is a 3-pin interface, which uses the RESET pin as enable, the TPICLK pin as the clock input, and the TPIDATA pin as data input and output. NVM can be programmed between 1.8-5.5V.

Atmel ATtiny102 / ATtiny104 [DATASHEET] 198

Atmel-42505D-ATtiny102-ATtiny104_Datasheet_Complete-10/2016