Sunday, September 02, 2007

Configure flags in atmega16

This blog entry is about a simple problem that took me some time to realize. To read the fuses of your avr using uisp and a parallel port programmer, you can use:

uisp --rd_fuses -dprog=dapa

In my case it leads to:

Atmel AVR ATmega16 is found.

Fuse Low Byte = 0xe1
Fuse High Byte = 0x99
Fuse Extended Byte = 0xff
Calibration Byte = 0xbe -- Read Only
Lock Bits = 0xff
BLB12 -> 1
BLB11 -> 1
BLB02 -> 1
BLB01 -> 1
LB2 -> 1
LB1 -> 1

The high byte for the fuse is defined by:
Write Fuse Bits High: 7 6 5 4 3 2 1 0
m16,m64,m128: OCDEN JTGEN x CKOPT EESAV BTSZ1 BTSZ0 BTRST

Hence, if you want to disable OCDEN (Debug) and JTGEN (JTAG), you should type:

uisp --wr_fuse_h=0x59 -dprog=dapa