Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
doc2535.pdf
Скачиваний:
49
Добавлен:
24.03.2015
Размер:
3.03 Mб
Скачать

Table 17-13. High-Voltage Serial Programming Instruction Set for ATtiny13 (Continued)

 

 

 

Instruction Format

 

 

 

 

 

 

 

 

 

Instruction

 

Instr.1/5

Instr.2/6

Instr.3

Instr.4

Operation Remarks

 

 

 

 

 

 

 

Read Signature

SDI

0_0000_1000_00

0_0000_00bb_00

0_0000_0000_00

0_0000_0000_00

Repeats Instr 2 4 for each

SII

0_0100_1100_00

0_0000_1100_00

0_0110_1000_00

0_0110_1100_00

Bytes

SDO

x_xxxx_xxxx_xx

x_xxxx_xxxx_xx

x_xxxx_xxxx_xx

q_qqqq_qqqx_xx

signature byte address.

 

 

 

 

 

 

 

 

 

Read

SDI

0_0000_1000_00

0_0000_000b_00

0_0000_0000_00

0_0000_0000_00

 

SII

0_0100_1100_00

0_0000_1100_00

0_0111_1000_00

0_0111_1100_00

 

Calibration Byte

 

 

SDO

x_xxxx_xxxx_xx

x_xxxx_xxxx_xx

x_xxxx_xxxx_xx

p_pppp_pppx_xx

 

Load “No

SDI

0_0000_0000_00

 

 

 

 

Operation”

SII

0_0100_1100_00

 

 

 

 

Command

SDO

x_xxxx_xxxx_xx

 

 

 

 

 

 

 

 

 

 

 

Note: a = address high bits, b = address low bits, d = data in high bits, e = data in low bits, p = data out high bits, q = data out low bits, x = don’t care, 1 = Lock Bit1, 2 = Lock Bit2, 3 = CKSEL0 fuse, 4 = CKSEL1 fuse, 5 = SUT0 fuse, 6 = SUT1 fuse, 7 = CKDIV8, fuse, 8 = WDTON fuse, 9 = EESAVE fuse, A = SPIEN fuse, B = RSTDISBL fuse, C = BODLEVEL0 fuse, D= BODLEVEL1 fuse, E = MONEN fuse, F = SELFPRGEN fuse

Note: The EEPROM is written page-wise. But only the bytes that are loaded into the page are actually written to the EEPROM. Pagewise EEPROM access is more efficient when multiple bytes are to be written to the same page. Note that auto-erase of EEPROM is not available in High-voltage Serial Programming, only in SPI Programming.

17.8Considerations for Efficient Programming

The loaded command and address are retained in the device during programming. For efficient programming, the following should be considered.

The command needs only be loaded once when writing or reading multiple memory locations.

Skip writing the data value 0xFF that is the contents of the entire EEPROM (unless the EESAVE fuse is programmed) and Flash after a Chip Erase.

Address High byte needs only be loaded before programming or reading a new 256 word window in Flash or 256 byte EEPROM. This consideration also applies to Signature bytes reading.

17.8.1Chip Erase

The Chip Erase will erase the Flash and EEPROM(1) memories plus lock bits. The lock bits are not reset until the Program memory has been completely erased. The fuse bits are not changed. A Chip Erase must be performed before the Flash and/or EEPROM are re-programmed.

1.Load command “Chip Erase” (see Table 17-13 on page 110).

2.Wait after Instr. 3 until SDO goes high for the “Chip Erase” cycle to finish.

3.Load Command “No Operation”.

Note: 1. The EEPROM memory is preserved during Chip Erase if the EESAVE fuse is programmed.

112 ATtiny13

2535J–AVR–08/10

ATtiny13

17.8.2Programming the Flash

The Flash is organized in pages, see Table 17-9 on page 107. When programming the Flash, the program data is latched into a page buffer. This allows one page of program data to be programmed simultaneously. The following procedure describes how to program the entire Flash memory:

1.Load Command “Write Flash” (see Table 17-13 on page 110).

2.Load Flash Page Buffer.

3.Load Flash High Address and Program Page. Wait after Instr. 3 until SDO goes high for the “Page Programming” cycle to finish.

4.Repeat 2 through 3 until the entire Flash is programmed or until all data has been programmed.

5.End Page Programming by Loading Command “No Operation”.

When writing or reading serial data to the ATtiny13, data is clocked on the rising edge of the serial clock, see Figure 17-4 on page 114, Figure 18-6 on page 122 and Table 18-9 on page 122 for details.

Figure 17-3. Addressing the Flash which is Organized in Pages

 

PROGRAM

PCMSB

 

 

 

 

PAGEMSB

 

 

 

PCPAGE

PCWORD

 

 

 

 

 

COUNTER

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

PAGE ADDRESS

 

 

WORD ADDRESS

 

 

WITHIN THE FLASH

 

 

WITHIN A PAGE

 

PROGRAM MEMORY

 

 

 

 

 

 

 

 

 

PAGE

PCWORD[PAGEMSB:0]:

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

PAGE

 

 

 

 

 

 

 

 

INSTRUCTION WORD

00

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

01

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

02

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

PAGEEND

113

2535J–AVR–08/10

Figure 17-4. High-voltage Serial Programming Waveforms

SDI

 

MSB

 

 

 

 

 

 

LSB

 

 

PB0

 

 

 

 

 

 

 

 

 

 

 

SII

 

MSB

 

 

 

 

 

 

LSB

 

 

PB1

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

SDO

 

MSB

 

 

 

 

 

 

LSB

 

 

PB2

 

 

 

 

 

 

 

 

 

 

 

SCI

0

1

2

3

4

5

6

7

8

9

10

PB3

 

 

 

 

 

 

 

 

 

 

 

17.8.3Programming the EEPROM

The EEPROM is organized in pages, see Table 18-8 on page 121. When programming the EEPROM, the data is latched into a page buffer. This allows one page of data to be programmed simultaneously. The programming algorithm for the EEPROM Data memory is as follows (refer to Table 17-13 on page 110):

1.Load Command “Write EEPROM”.

2.Load EEPROM Page Buffer.

3.Program EEPROM Page. Wait after Instr. 2 until SDO goes high for the “Page Programming” cycle to finish.

4.Repeat 2 through 3 until the entire EEPROM is programmed or until all data has been programmed.

5.End Page Programming by Loading Command “No Operation”.

17.8.4Reading the Flash

The algorithm for reading the Flash memory is as follows (refer to Table 17-13 on page 110):

1.Load Command "Read Flash".

2.Read Flash Low and High Bytes. The contents at the selected address are available at serial output SDO.

17.8.5Reading the EEPROM

The algorithm for reading the EEPROM memory is as follows (refer to Table 17-13 on page 110):

1.Load Command “Read EEPROM”.

2.Read EEPROM Byte. The contents at the selected address are available at serial output SDO.

17.8.6Programming and Reading the Fuse and Lock Bits

The algorithms for programming and reading the fuse low/high bits and lock bits are shown in

Table 17-13 on page 110.

114 ATtiny13

2535J–AVR–08/10

Соседние файлы в предмете [НЕСОРТИРОВАННОЕ]