JTAG Programming adapter





The JTAG programming of the AVR is much faster than the SPI method. Since it is self clocked a crystal or other clock source is not required with the AVR.

SOFTWARE FOR LINUX AND WINDOWS users.

Latest JTAG software javr-2.7.tar updated 17/10/05

JTAG SOFTWARE javr-2.5.tar updated 25/03/05 , thanks to Anton Erasmus, now also support the AT90CAN128 for this pcb.

Current devices supported by JAVR are : ATMega128 ATMega64 ATMega32 ATMega16 ATMega162 AT90CAN128

javr_mingw.exe is the '98 , 2000 , XP executable version , since you can not access the printer port directly from W2000 or XP , one first need to install giveio.sys .

For more info about giveio.sys , please refer to http://yl2.narod.ru/pic/fpp.htm



The cygwin version runs without giveio.sys if it is run under CYGWIN and if the command ioperm -i have been executed once. Please refer to cygwin.com for CYGWIN installation information.

The LINUX version must be run with su privilages .



The program used is JAVR . If the hardware setup is 100 % , JAVR will display the type and rev. of the AVR used. If the type of chip is not detected, check the hardware setup and power. If a 74HC T 125 was used in the dongle, replace with a 74 HC 125 type for 3.3v operation.



After first switching on the new pcb, with a fresh cpu, the external crystal is not enabled ( fuse bit ) so it seems as if the CPU is dead or or there is some other problem , in fact the CPU is running at +- 1MHz but since the flash is not programmed , nothing happens externally.



If you want to change the clock source and BOD level etc. run JAVR with a fuse file. It will program the fuse bits as set in the file.

It happens in a 'flash ' . Now check X1 or X1 , the crystal should oscillate.



The programming can be run from the command line or from BASCOM by selecting the EXTERNAL programmer , add a 3 line PROG.BAT file that will be executed when F4 is pressed.

Make sure JAVR , BIN2MOT , PROG , BASCOM and data files are in the same directory.



The PROG.BAT file should : convert the BIN file to a S-Record file

Program the chip with JAVR

Return to BASCOM.



An example of the PROG.BAT file.

bin2mot <filename>.bin <filename>.rom

javr <filename>.rom

exit

Replace <filename> with your own FILENAME



An example of a FUSE file :

;ATMega128 Fuse Bit definitions

;0 => Programmed, 1 => Not Programmed

CKSEL: 0xE

CKOPT: 0

SUT: 2

BOOTSIZE: 0

M103C: 1

WDTON: 1

OCDEN: 0

JTAGEN: 0

SPIEN: 0

EESAVE: 1

BOOTRST: 1

BODLEVEL: 1

BODEN: 0

;Lock Bit definitions (Need -L command line option to write)

BLB1: 3

BLB0: 3

LB: 3





Please check the AVR datasheet for detail info about each bit. The settings above will at least make the AVR run from an external clock source ( 1-8 MHz ). The fuse file is required only once , and maybe later to set the programming LOCK bits. You can run JAVR and then read the fuse bits and save it to a file. Then change the bits as necessary , but keep a backup of the saved file .

The JTAGEN bit is forced to 0 by JAVR , not possible to program to 1 , unless you change and re-compile the source.

Although there is no SPI programming port on the pcb , it is still possible to " add " a SPI port by connecting a few wires to the correct pins on the cpu.

The SPI programmer might interfere with some of the i/o lines so it will have to be removed after programming.

If you add a BOOT loader to your code and enable the BOOT loader option fuse bits , the unit can be programmed this way also.