Figure 26-12. State Machine Sequence for Changing/Reading the Data Word

1

Test-Logic-Reset

 

 

 

 

 

0

 

 

 

 

0

 

1

 

 

1

Run-Test/Idle

Select-DR Scan

 

 

 

 

 

 

 

 

 

 

 

 

 

0

 

 

 

 

 

 

 

1

Capture-DR

0

Shift-DR 0

1

1

Exit1-DR

0

Pause-DR 0

1

0

Exit2-DR

1

Update-DR

1 0

1

Select-IR Scan

0

1

Capture-IR

0

Shift-IR 0

1

1

Exit1-IR

0

Pause-IR

0

1

 

0

Exit2-IR

1

Update-IR

1 0

26.10.11 Virtual Flash Page Load Register

The Virtual Flash Page Load Register is a virtual scan chain with length equal to the number of bits in one Flash page. Internally the Shift Register is 8-bit, and the data are automatically transferred to the Flash page buffer byte by byte. Shift in all instruction words in the page, starting with the LSB of the first instruction in the page and ending with the MSB of the last instruction in the page. This provides an efficient way to load the entire Flash page buffer before executing Page Write.

288 ATmega16A

8154A–AVR–06/08

ATmega16A

Figure 26-13. Virtual Flash Page Load Register

STROBES

State

Machine

TDI

ADDRESS

Flash

EEPROM

Fuses

Lock Bits

D

A

T

A

TDO

26.10.12 Virtual Flash Page Read Register

The Virtual Flash Page Read Register is a virtual scan chain with length equal to the number of bits in one Flash page plus 8. Internally the Shift Register is 8-bit, and the data are automatically transferred from the Flash data page byte by byte. The first 8 cycles are used to transfer the first byte to the internal Shift Register, and the bits that are shifted out during these 8 cycles should be ignored. Following this initialization, data are shifted out starting with the LSB of the first instruction in the page and ending with the MSB of the last instruction in the page. This provides an efficient way to read one full Flash page to verify programming.

Figure 26-14. Virtual Flash Page Read Register

STROBES

State

Machine

TDI

ADDRESS

Flash

EEPROM

Fuses

Lock Bits

D

A

T

A

TDO

289

8154A–AVR–06/08

26.10.13 Programming Algorithm

All references below of type “1a”, “1b”, and so on, refer to Table 26-14.

26.10.14Entering Programming Mode

1.Enter JTAG instruction AVR_RESET and shift 1 in the Reset Register.

2.Enter instruction PROG_ENABLE and shift 1010_0011_0111_0000 in the Programming Enable Register.

26.10.15Leaving Programming Mode

1.Enter JTAG instruction PROG_COMMANDS.

2.Disable all programming instructions by using no operation instruction 11a.

3.Enter instruction PROG_ENABLE and shift 0000_0000_0000_0000 in the programming Enable Register.

4.Enter JTAG instruction AVR_RESET and shift 0 in the Reset Register.

26.10.16Performing Chip Erase

1.Enter JTAG instruction PROG_COMMANDS.

2.Start chip erase using programming instruction 1a.

3.Poll for Chip Erase complete using programming instruction 1b, or wait for tWLRH_CE (refer to Table 27-7 on page 303).

26.10.17Programming the Flash

Before programming the Flash a Chip Erase must be performed. See “Performing Chip Erase” on page 290.

1.Enter JTAG instruction PROG_COMMANDS.

2.Enable Flash write using programming instruction 2a.

3.Load address High byte using programming instruction 2b.

4.Load address Low byte using programming instruction 2c.

5.Load data using programming instructions 2d, 2e and 2f.

6.Repeat steps 4 and 5 for all instruction words in the page.

7.Write the page using programming instruction 2g.

8.Poll for Flash write complete using programming instruction 2h, or wait for tWLRH (refer to Table 27-7 on page 303).

9.Repeat steps 3 to 7 until all data have been programmed.

A more efficient data transfer can be achieved using the PROG_PAGELOAD instruction:

1.Enter JTAG instruction PROG_COMMANDS.

2.Enable Flash write using programming instruction 2a.

3.Load the page address using programming instructions 2b and 2c. PCWORD (refer to Table 26-5 on page 267) is used to address within one page and must be written as 0.

4.Enter JTAG instruction PROG_PAGELOAD.

5.Load the entire page by shifting in all instruction words in the page, starting with the LSB of the first instruction in the page and ending with the MSB of the last instruction in the page.

6.Enter JTAG instruction PROG_COMMANDS.

7.Write the page using programming instruction 2g.

290 ATmega16A

8154A–AVR–06/08

ATmega16A

8.Poll for Flash write complete using programming instruction 2h, or wait for tWLRH (refer to Table 27-7 on page 303).

9.Repeat steps 3 to 8 until all data have been programmed.

26.10.18Reading the Flash

1.Enter JTAG instruction PROG_COMMANDS.

2.Enable Flash read using programming instruction 3a.

3.Load address using programming instructions 3b and 3c.

4.Read data using programming instruction 3d.

5.Repeat steps 3 and 4 until all data have been read.

A more efficient data transfer can be achieved using the PROG_PAGEREAD instruction:

1.Enter JTAG instruction PROG_COMMANDS.

2.Enable Flash read using programming instruction 3a.

3.Load the page address using programming instructions 3b and 3c. PCWORD (refer to Table 26-5 on page 267) is used to address within one page and must be written as 0.

4.Enter JTAG instruction PROG_PAGEREAD.

5.Read the entire page by shifting out all instruction words in the page, starting with the LSB of the first instruction in the page and ending with the MSB of the last instruction in the page. Remember that the first 8 bits shifted out should be ignored.

6.Enter JTAG instruction PROG_COMMANDS.

7.Repeat steps 3 to 6 until all data have been read.

26.10.19Programming the EEPROM

Before programming the EEPROM a Chip Erase must be performed. See “Performing Chip Erase” on page 290.

1.Enter JTAG instruction PROG_COMMANDS.

2.Enable EEPROM write using programming instruction 4a.

3.Load address High byte using programming instruction 4b.

4.Load address Low byte using programming instruction 4c.

5.Load data using programming instructions 4d and 4e.

6.Repeat steps 4 and 5 for all data bytes in the page.

7.Write the data using programming instruction 4f.

8.Poll for EEPROM write complete using programming instruction 4g, or wait for tWLRH (refer to Table 27-7 on page 303).

9.Repeat steps 3 to 8 until all data have been programmed.

Note that the PROG_PAGELOAD instruction can not be used when programming the EEPROM

26.10.20Reading the EEPROM

1.Enter JTAG instruction PROG_COMMANDS.

2.Enable EEPROM read using programming instruction 5a.

3.Load address using programming instructions 5b and 5c.

4.Read data using programming instruction 5d.

5.Repeat steps 3 and 4 until all data have been read.

Note that the PROG_PAGEREAD instruction can not be used when reading the EEPROM

291

8154A–AVR–06/08

Соседние файлы в папке МК