310
2467S–AVR–07/09
ATmega128
Table 130.
JTAG Programming Instruction
Set
a
= address high bits,
b
= address low 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
0110011_10000000
xxxxxxx_xxxxxxxx
xxxxxxx_xxxxxxxx
xxxxxxx_xxxxxxxx
xxxxxxx_xxxxxxxx
1b. Poll for chip erase complete
0110011_10000000
xxxxx
o
x_xxxxxxxx
(2)
2a. Enter Flash Write
0100011_00010000
xxxxxxx_xxxxxxxx
2b. Load Address High Byte
0000111_
aaaaaaaa
xxxxxxx_xxxxxxxx
(9)
2c. Load Address Low Byte
0000011_
bbbbbbbb
xxxxxxx_xxxxxxxx
2d. Load Data Low Byte
0010011_
iiiiiiii
xxxxxxx_xxxxxxxx
2e. Load Data High Byte
0010111_
iiiiiiii
xxxxxxx_xxxxxxxx
2f. Latch Data
0110111_00000000
1110111_00000000
0110111_00000000
xxxxxxx_xxxxxxxx
xxxxxxx_xxxxxxxx
xxxxxxx_xxxxxxxx
(1)
2g. Write Flash Page
0110111_00000000
0110101_00000000
0110111_00000000
0110111_00000000
xxxxxxx_xxxxxxxx
xxxxxxx_xxxxxxxx
xxxxxxx_xxxxxxxx
xxxxxxx_xxxxxxxx
(1)
2h. Poll for Page Write complete
0110111_00000000
xxxxx
o
x_xxxxxxxx
(2)
3a. Enter Flash Read
0100011_00000010
xxxxxxx_xxxxxxxx
3b. Load Address High Byte
0000111_
aaaaaaaa
xxxxxxx_xxxxxxxx
(9)
3c. Load Address Low Byte
0000011_
bbbbbbbb
xxxxxxx_xxxxxxxx
3d. Read Data Low and High Byte
0110010_00000000
0110110_00000000
0110111_00000000
xxxxxxx_xxxxxxxx
xxxxxxx_
oooooooo
xxxxxxx_
oooooooo
low byte
high byte
4a. Enter EEPROM Write
0100011_00010001
xxxxxxx_xxxxxxxx
4b. Load Address High Byte
0000111_
aaaaaaaa
xxxxxxx_xxxxxxxx
(9)
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
xxxxxxx_xxxxxxxx
xxxxxxx_xxxxxxxx
(1)
4f. Write EEPROM Page
0110011_00000000
0110001_00000000
0110011_00000000
0110011_00000000
xxxxxxx_xxxxxxxx
xxxxxxx_xxxxxxxx
xxxxxxx_xxxxxxxx
xxxxxxx_xxxxxxxx
(1)
4g. Poll for Page Write complete
0110011_00000000
xxxxx
o
x_xxxxxxxx
(2)
5a. Enter EEPROM Read
0100011_00000011
xxxxxxx_xxxxxxxx
5b. Load Address High Byte
0000111_
aaaaaaaa
xxxxxxx_xxxxxxxx
(9)