Hello,
I thought that i'd make a post with a small guide on how to set a Arduino atmega2560 in AVRstudio Using JTAG, Firstly
Things Needed
- Jtag Debugger JTAGICEmkII
- Arduino ATmega2560
- AVRstudio 6 (atmel website)
First we must connect the pins from the jtag debugger to the I/O ADC pins on the atmega2560
With this we can see that
JTAGPIN9->TDI->ADC7
JTAGPIN3->TDO->ADC6
JTAGPIN5->TMS->ADC5
JTAGPIN1->TCK->ADC4
JTAGPIN10->ARDUINO GRND
JTAGPIN6->ARDUINO RESET
JTAGPIN4->ARDUINO 5V
Other Pins Not Needed
Check Arduino Schematic For further Details
Create proper connections and connect to I/O
Once you have installed avr studio
New Project -> STK600 ATMEGA2560
Make sure your debugger is connected and talking to the board, Read device/voltage, Build and run.
Copy and paste this code, It's just the blinky code although it's alot more simpler
#include <asf.h>
#include <string.h>
#include <avr/io.h>
#include <AVR/interrupt.h>
#define F_CPU 16000000UL
int i;
int main (void)
{
board_init();
DDRB |= (1<<PB7);
for(i=0;i<10;i++)
{
PORTB |= (1<<PB7);
PORTB &= ~(1<<PB7);
}
}
Let us know if i missed anything
Thanks