# makefile, written by guido socher MCU=atmega32 F_CPU=14745600 readfuse: uisp -dlpt=/dev/parport0 -dprog=dapa -dpart=ATmega32 --rd_fuses #see declaration for default settings #on end of this script #use this only for repairing, but its not shure in all cases #that this funcs writedefaultfuse: uisp -dlpt=/dev/parport0 -dprog=dapa -dpart=ATmega32 --wr_fuse_h=0x99 uisp -dlpt=/dev/parport0 -dprog=dapa -dpart=ATmega32 --wr_fuse_l=0xE1 # high byte changings to default # JTAGEN = 1 ( JTAG DISABLED ) for using jtag-pins for others # low byte changings to default # CKSEL3..0 for internal clock-source # Startup-Time 65ms writefuse1mhz: uisp -dlpt=/dev/parport0 -dprog=dapa -dpart=ATmega32 --wr_fuse_h=0xD9 uisp -dlpt=/dev/parport0 -dprog=dapa -dpart=ATmega32 --wr_fuse_l=0xE1 writefuse2mhz: uisp -dlpt=/dev/parport0 -dprog=dapa -dpart=ATmega32 --wr_fuse_h=0xD9 uisp -dlpt=/dev/parport0 -dprog=dapa -dpart=ATmega32 --wr_fuse_l=0xE2 writefuse4mhz: uisp -dlpt=/dev/parport0 -dprog=dapa -dpart=ATmega32 --wr_fuse_h=0xD9 uisp -dlpt=/dev/parport0 -dprog=dapa -dpart=ATmega32 --wr_fuse_l=0xE3 writefuse8mhz: uisp -dlpt=/dev/parport0 -dprog=dapa -dpart=ATmega32 --wr_fuse_h=0xD9 uisp -dlpt=/dev/parport0 -dprog=dapa -dpart=ATmega32 --wr_fuse_l=0xE4 # high byte changings to default # JTAGEN = 1 ( JTAG DISABLED ) for using jtag-pins for others # CKOPT = 0 ( Osc. options enabled ) # low byte changings to default # CKSEL3..0 = 1111 for unprogrammed clocksource # for external clocks till up 16Mhz. # Startup Time 65ms writefuse11mhz: uisp -dlpt=/dev/parport0 -dprog=dapa -dpart=ATmega32 --wr_fuse_h=0xC9 uisp -dlpt=/dev/parport0 -dprog=dapa -dpart=ATmega32 --wr_fuse_l=0xFF #the same writefuse14mhz: uisp -dlpt=/dev/parport0 -dprog=dapa -dpart=ATmega32 --wr_fuse_h=0xC9 uisp -dlpt=/dev/parport0 -dprog=dapa -dpart=ATmega32 --wr_fuse_l=0xFF #the same writefuse16mhz: uisp -dlpt=/dev/parport0 -dprog=dapa -dpart=ATmega32 --wr_fuse_h=0xC9 uisp -dlpt=/dev/parport0 -dprog=dapa -dpart=ATmega32 --wr_fuse_l=0xFF ##### #Default settings of fuses for a brand new device # #1 means unprogrammed #0 means programmed # #High byte: #Name Bit Desc Default #OCDEN 7 Enable OCD 1 unprogrammed OCD disabled #JTAGEN 6 Enable JTAG 0 programmed, JTAG enabled #SPIEN 5 Enable SPIPROG 0 programmed, SPI prog enabled ( Do never change this ) #CKOPT 4 Oscilator options 1 unprogrammed #EESAVE 3 EEPROM mem pres. 1 unprogrammed, EEPROM not preserved #BOOTSZ1 2 Sel. bootsize 0 programmed #BOOTSZ0 1 dito 0 programmed #BOOTRST 0 Sel. reset vect. 1 unprogrammed # #value = 10011001 0x99 153 # #Low byte: #Name Bit Desc Default #BODLEVEL 7 Brown-out level 1 unprogrammed #BODEN 6 Brown-out enable 1 unprogrammed, BOD disabled #SUT1 5 Startup-up-time 1 unprogrammed #SUT0 4 Startup-up-time 0 programmed #CKSEL3 3 Select clock src 0 programmed #CKSEL2 2 Select clock src 0 programmed #CKSEL1 1 Select clock src 0 programmed #CKSEL0 0 Select clock src 1 unprogrammed # #value = 11100001 0xE1 225 # #the output of the reading of a new buyed atmega32 of #uisp -dlpt=/dev/parport0 -dprog=dapa -dpart=ATmega32 --rd_fuses # is: #Fuse Low Byte = 0xe1 #Fuse High Byte = 0x99 #Fuse Extended Byte = 0xff #Calibration Byte = 0xc8 -- Read Only #Lock Bits = 0xff # BLB12 -> 1 # BLB11 -> 1 # BLB02 -> 1 # BLB01 -> 1 # LB2 -> 1 # LB1 -> 1 # ########################################################################################################### ########################################################################################################### # # Some hopefully useable values # # High Byte Low Byte HexHigh Low Mhz Startup Decl. # # OCDEN BODLEVEL # | JTAGEN | BODEN # | | SPIEN | | SUT1 # | | | CKOPT | | | SUT0 # | | | | EESAVE | | | | CKSEL3 # | | | | | BOOTSZ1 | | | | | CKSEL2 # | | | | | | BOOTSZ0 | | | | | | CKSEL1 # | | | | | | | BOOTRST | | | | | | | CKSEL0 # | | | | | | | | | | | | | | | | #Bit 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 # # 1 0 0 1 1 0 0 1 1 1 1 0 0 0 0 1 0x99 0xe1 1Mhz 65 ms Default setting JTAGEN ON # # all followings will be # without using JTAG # # 1 1 0 1 1 0 0 1 1 1 1 0 0 0 0 1 0xd9 0xe1 1Mhz 65 ms internal OSC # # 1 1 0 1 1 0 0 1 1 1 1 0 0 0 1 0 0xd9 0xe2 2Mhz 65 ms internal OSC # # 1 1 0 1 1 0 0 1 1 1 1 0 0 0 1 1 0xd9 0xe3 4Mhz 65 ms internal OSC # # 1 1 0 1 1 0 0 1 1 1 1 0 0 1 0 0 0xd9 0xe4 8Mhz 65 ms internal OSC # # all followings with external # quarz, and CKOPT enabled, JTAG off # # 1 1 0 0 1 0 0 1 1 1 1 0 1 1 1 1 0xc9 0xef 11,Mhz 4.1 ms external 11.0592 Mhz Quarz # 1 1 0 0 1 0 0 1 1 1 1 1 1 1 1 1 0xc9 0xff 11,Mhz 65 ms external 11.0592 Mhz Quarz # # 1 1 0 0 1 0 0 1 1 1 1 0 1 1 1 1 0xc9 0xef 14,Mhz 4.1 ms external 14,745 Mhz Quarz # 1 1 0 0 1 0 0 1 1 1 1 1 1 1 1 1 0xc9 0xff 14,Mhz 65 ms external 14,745 Mhz Quarz # # 1 1 0 0 1 0 0 1 1 1 1 0 1 1 1 1 0xc9 0xef 16Mhz 4.1 ms external 16,0 Mhz Quarz # 1 1 0 0 1 0 0 1 1 1 1 1 1 1 1 1 0xc9 0xff 16Mhz 65 ms external 16,0 Mhz Quarz # # # # A little hint, - prefere the 65 ms Startup-Time, because 4.1 ms can end in an instable programming-condition. # Use 4.1 ms only if you really sure to no more programm the chip again. #