AVR JTAG : Credit to IsoJtagIsp for schematic and bootloader. I've been modified a schematic from IsoJtagIsp by remove USB interface from schematic because I'd like to use AVR JTAG with USB2RS232 and serial port.
Download bootloader onto ATMEGA16, If you don't have a AVR programmer I recommended a simple programmer from Ponyprog, because Ponyprog need a few component for build a AVR programmer. If you already have a AVR programmer you can use it to download bootloader. If you're using Ponyprog the fuses should look like this.
- IsoJtagISP_1.5_3.6864MHz.hex
- IsoJtagISP_1.5_7.3728MHz.hex
- IsoJtagISP_1.5_8.0MHz.hex
- IsoJtagISP_source.rar
Once the bootloader is programmed, the next step is upgrade JTAGICE firmware onto ATMEGA16 by using AVR Studio.
1.] Set jumper to JTAG mode and powered to the board, then the Power LED should come on and Act LED should be blink.
2.] Open AVR studio select Tools menu and select AVR Prog, AVR Prog connected with AVR JTAG look like this.
AVR JTAG firmware upgrade. |
3.] Click on Browse button and choose AVR JTAGICE firmware for upgrade like C:\MCU\Atmel\AVR Tools\JTAGICE\Upgrade.ebn
4.] Click Program button and wait until upgrading complete.
5.] Reset board by press reset button and wait until Act LED stop blink.
5.] Return to AVR studio, select Tools menu->Program AVR->Connect, if firmware upgrade complete you can see JTAG ICE dialog look like this.
6.] Testing AVR JTAG with ATMEGA32, Pin connection between AVR JTAG and MEGA32 such as
7.] TCK_SCK -> TCK
8.] TDO_MISO -> TDO
9.] TMS_RST -> TMS
10.]TDI_MOSI -> TDI
This is a simple source code for testing JTAG, If you don't have compiler you can download WinAVR from winavr.sourceforge.net it's free compiler. After WinAVR installed, create new project in AVR studio by select Project menu->New project, then you can see Create new project dialog, select AVR GCC in Project type, fill project name you want to create into Project name box, fill main into initial file box, final click finish button and put this code into main.c.
/***********************************************************************
*
* File : main.c
* Desc : Blink LED on PB0
* Compiler : AVR GCC
* Author : Jirawat Kongkaen
* Website : .
*
***********************************************************************/
#include
void delay(unsigned int delay);
int main(void)
{
DDRB = 0xFF; // Port B as out put
for(;;)
{
PORTB |= _BV(PB0);
//delay(50000);
PORTB &= ~(_BV(PB0));
//delay(50000);
}
return 0;
}
void delay(unsigned int delay)
{
while(delay) delay--;
}
Before start debugging you have to compile main.c first by select Build->Build or press F7 on keyboard, now let start debugging by select Debug menu->Start Debugging of click Start Debugging button, look like this.
Connection between AVR JTAG and ATMEGA32 is connected (see below figure), Now let's start debugging by click Step into button or press F11, LED at PB0 will come On/Off.
Testing had finished and you can use AVR JTAG for debug/program AVR microcontroller. I will explain about how to AVR JTAG working, if you set JP1 to JTAG mode and power on the board, AVR JTAG wait for firmware upgrade until Act LED come off, You can upgrade firmware at this sequence. After Act LED com off AVR JTAG ready to use. If you set JP1 to ISP mode you should be able to program:
Bread board with AVR JTAG and ATMEGA32 |
0 comments:
Post a Comment