Using atmel Studio 7 with Atmel ICE but debug errors

Go To Last Post
11 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello to everyone,
I am new in this AVR FREAKS so I was used Atmel Studio7 and ATMEGA16A microcontroller with ATMEL ICE burner so I check the communication then communication is fine when I debug my code they make an error.
Here is my code
 

// MyAtmelBlink.c

// put LED on PC5

#ifndef F_CPU					// if F_CPU was not defined in Project -> Properties
#define F_CPU 1000000UL			// define it now as 1 MHz unsigned long
#endif

#include <avr/io.h>				// this is always included in AVR programs
#include <util/delay.h>			// add this to use the delay function

///////////////////////////////////////////////////////////////////////////////////////////////////
int main(void) {
	
	DDRC |= (1 << PC5);			// set Port C pin PC5 for output
	
	while (1) {					// begin infinite loop
		PORTC ^= (1 << PC5);	// flip state of LED on PC5
		_delay_ms(500);			// delay 1/2 second
	}
	return(0);					// should never get here, this is to prevent a compiler warning
}

what could I do please help me.

Attachment(s): 

ibrar

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

In attachment file the error picture.

ibrar

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Is the program you showed really the whole program? Did you add libled.c.a to the project, by any chance? That is, is it listed in the Solution Explorer?

 

Jim

Jim Wagner Oregon Research Electronics, Consulting Div. Tangent, OR, USA http://www.orelectronics.net

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Dear Jim,
The above code is the whole program the problem is that when I debug this program it makes an error.

ibrar

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You have chosen PC5 which is a JTAG pin.
.
Since you have bought an ATMEL-ICE I assume you are using JTAG.
If you are not, have you disabled the JTAGEN fuse?
.
Choose a non-JTAG pin. Life will be easier.
.
David.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Dear David,

Actually, I am new with this programming tool so I use default setting and in the default setting it may be disabled JTAGEN fuse.And its my first time to use the ATMEL ICE burner or ATMEL Studio

 

ibrar

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

JTAGEN is default from the factory.
Choose a different pin e.g. PD5

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Dear David,

Now I have changed the pin but the issue remained the same.

// MyAtmelBlink.c

// put LED on PD5

#ifndef F_CPU                    // if F_CPU was not defined in Project -> Properties
#define F_CPU 1000000UL            // define it now as 1 MHz unsigned long
#endif

#include <avr/io.h>                // this is always included in AVR programs
#include <util/delay.h>            // add this to use the delay function

///////////////////////////////////////////////////////////////////////////////////////////////////
int main(void) {
    
    DDRD |= (1 << PD5);            // set Port D pin PD5 for output
    
    while (1) {                    // begin infinite loop
        PORTD ^= (1 << PD5);    // flip state of LED on PD5
        _delay_ms(500);            // delay 1/2 second
    }
    return(0);                    // should never get here, this is to prevent a compiler warning
}
 you see the error in attachment.

Attachment(s): 

ibrar

Last Edited: Wed. Oct 10, 2018 - 07:36 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

My apologies.   I read your original post on a Tablet and did not view the PNG.

 

The PNG shows that you are trying to build a "C Static Library" project.   You should start again with a new project.   Select "C executable" project.

 

If you have trouble programming the mega16,   post a photo of your wiring.

 

David.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I have no idea why Atmel ever included the option to build a static library. I've seen threads with this same confusion a number of times. (they clearly started looking at VS2015's ability to create EXE and LIB/DLL and thought "fill in the AVR equivalents here" but static libs make little/no sense for AVR!)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Dear David,

Thank you so much my circuit is working now I was just created a new project and add executable C and paste the same code and its working now.

Thank you So much for helping God Bless you.

ibrar