322
8272E–AVR–04/2013
ATmega164A/PA/324A/PA/644A/PA/1284/P
Table 27-18. JTAG programming instruction.
Set a = address high bits, b = address low bits, c = address extended bits, H = 0 - Low byte, 1 - High Byte, o = data out,
i = data in, x = don’t care.
Instruction
TDI sequence
TDO sequence
Notes
1a. Chip Erase
0100011_10000000
0110001_10000000
0110011_10000000
xxxxxxx_xxxxxxxx
1b. Poll for Chip Erase Complete
0110011_10000000
xxxxxox_xxxxxxxx
(2)
2a. Enter Flash Write
0100011_00010000
xxxxxxx_xxxxxxxx
2b. Load Address Extended High Byte
0001011_cccccccc
xxxxxxx_xxxxxxxx
(10)
2c. Load Address High Byte
0000111_aaaaaaaa
xxxxxxx_xxxxxxxx
2d. Load Address Low Byte
0000011_bbbbbbbb
xxxxxxx_xxxxxxxx
2e. Load Data Low Byte
0010011_iiiiiiii
xxxxxxx_xxxxxxxx
2f. Load Data High Byte
0010111_iiiiiiii
xxxxxxx_xxxxxxxx
2g. Latch Data
0110111_00000000
1110111_00000000
0110111_00000000
xxxxxxx_xxxxxxxx
(1)
2h. Write Flash Page
0110111_00000000
0110101_00000000
0110111_00000000
xxxxxxx_xxxxxxxx
(1)
2i. Poll for Page Write Complete
0110111_00000000
xxxxxox_xxxxxxxx
(2)
3a. Enter Flash Read
0100011_00000010
xxxxxxx_xxxxxxxx
3b. Load Address Extended High Byte
0001011_cccccccc
xxxxxxx_xxxxxxxx
(10)
3c. Load Address High Byte
0000111_aaaaaaaa
xxxxxxx_xxxxxxxx
3d. Load Address Low Byte
0000011_bbbbbbbb
xxxxxxx_xxxxxxxx
3e. Read Data Low and High Byte
0110010_00000000
0110110_00000000
0110111_00000000
xxxxxxx_xxxxxxxx
xxxxxxx_oooooooo
Low byte
High byte
4a. Enter EEPROM Write
0100011_00010001
xxxxxxx_xxxxxxxx
4b. Load Address High Byte
0000111_aaaaaaaa
xxxxxxx_xxxxxxxx
(10)
4c. Load Address Low Byte
0000011_bbbbbbbb
xxxxxxx_xxxxxxxx
4d. Load Data Byte
0010011_iiiiiiii
xxxxxxx_xxxxxxxx
4e. Latch Data
0110111_00000000
1110111_00000000
0110111_00000000
xxxxxxx_xxxxxxxx
(1)
4f. Write EEPROM Page
0110011_00000000
0110001_00000000
0110011_00000000
xxxxxxx_xxxxxxxx
(1)
4g. Poll for Page Write Complete
0110011_00000000
xxxxxox_xxxxxxxx
(2)