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

Configuration bit.
- Set jumper to JTAG mode and powered to the board, then the Power LED should come on and Act LED should be blink.
- Open AVR studio select Tools menu and select AVR Prog, AVR Prog connected with AVR JTAG look like this.

AVR JTAG firmware upgrade.
- Click on Browse button and choose AVR JTAGICE firmware for upgrade like C:\MCU\Atmel\AVR Tools\JTAGICE\Upgrade.ebn
- Click Program button and wait until upgrading complete.
- Reset board by press reset button and wait until Act LED stop blink.
- Return to AVR studio, select Tools menu->Program AVR->Connect, if firmware upgrade complete you can see JTAG ICE dialog look like this.


Upgrade OK
- Testing AVR JTAG with ATMEGA32, Pin connection between AVR JTAG and MEGA32 such as
- TCK_SCK -> TCK
- TDO_MISO -> TDO
- TMS_RST -> TMS
- TDI_MOSI -> TDI
Code:
/***********************************************************************
*
* 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.

Start debugging.
 
 
Bread board with AVR JTAG and ATMEGA32

Completed board.
 
 
沒有留言:
張貼留言
注意:只有此網誌的成員可以留言。