Atmel Studio 6 Returns "Unable to enter programming mode" with AVRisp mk2 and Atmega328P-PU

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

I purchased a whole lot of the Atmega328p Pu chips without doing some research first. I do not know whether they contain a bootloader or whether you even need one when using the AVRisp mk2.

I've tried following many tutorials with no luck and am thinking if Purchasing an STK 500 dev board would solve my problems, which would be a $120 leap of faith.

Here are the screenshots of what I am at at the moment:

 

This topic has a solution.
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Slow down the ISP clock to 4khz.
What is the purpose of the UNO? Power?
Place a 10k resistor from Vcc to reset. This is precautionary.
Check, and recheck your connections.
Look in device manager to make sure that windows recognizes the MKII

Jim

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

 

"The critical shortage here is not stuff, but time." - Johan Ekdahl

 

"Step N is required before you can do step N+1!" - ka7ehk

 

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB, RSLogix user

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

Uno is used for power. I've just come across this post inquiring to add a 16Mhz crystal: https://www.avrfreaks.net/forum/a...

 is that relevant? 

 

 

 

Last Edited: Fri. May 15, 2015 - 01:32 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

It would help to know from where you purchased your chips.  if virgin 328's then no xtal is needed.  If however they are preprogrammed for arduino use, then they may need a xtal if the fuses are set so.  

 

If you had an UNO that used a dip package, you could drop it in and see if it works.

 

Be sure you have both VCC/AVCC pins going to +5v, and both gnd pins going to gnd.

 

Jim

 

Edit:  I don't see the AVCC pin connected in your pics.

 

 

 

 

Last Edited: Fri. May 15, 2015 - 01:48 AM
This reply has been marked as the solution. 
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Ok, I just got it solved.

 

Here is my solution for all those folks who have come here from google, Yeah, I'm looking at your frustrated face.

I have:

- added a 10k resistor between Gnd and VCC on pins 7 and 8. (as suggested by the gentleman above )

- added a 16mhz crystal between pins 9 and 10

- added 2x 15 μF micro-farad ceramic capacitors between pin 9 and ground as well as pin 10 and ground (as I've seen in some Arduino wiring tutorials) 

 

The device id was successfully detected. I believe some of the youtube videos that show an AVRISP mk 2 being connected directly without any components are quite misleading because I've been trying to fix this for over a week. I've been jumping between trying to decide whether to fully transfer to atmel studio or try to get the Arduino IDE to work with the AVRISP mk 2, both of which were very extensive and noob-unfriendly tutorials.

 

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

And yes, I ahve a strong hunch that this is indeed a virgin Chip. If it really is, how does one load a bootloader onto it, I've seen some tutorials but most of the mare arduino based and I'd like to figure it out for Atmel Studio/

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

YOU can load the bootloader through studio and the MKII.  I have never been able to do it through the Arduino IDE myself.

 

If you are indeed connected to the AVR, go into the fuse settings and take a screenshot and post it.  We can guess as to how the parts are set up.

 

Where did you get teh AVR's?  Post a link if you can.

 

JIm

 

Edit:

- added a 10k resistor between Gnd and VCC on pins 7 and 8. (as suggested by the gentleman above )

I suggested a 10k resistor from Vcc to the RESET pin.  Not from Gnd and VCC...That does nothing.

 

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

 

"The critical shortage here is not stuff, but time." - Johan Ekdahl

 

"Step N is required before you can do step N+1!" - ka7ehk

 

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB, RSLogix user

Last Edited: Fri. May 15, 2015 - 02:17 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

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

Unfortunately I don't have a link any-longer, I've purchased the AVRs from Ali Express, they were fairly cheap so I assume that they don't have a bootloader.

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

Ok, I've just figured out and uploaded a blink code that blinks the DP0 pin as in the diagram. (i followed a tutorial half clueless) And it worked. THE BLOODY THING WORKED! I am so glad right now.

#include <avr/io.h>
#include <avr/delay.h>

int main(void)
{
	DDRD = 0xff ;
	int x;
	while(1){
		x=1;
		do {
			PORTD = 0x01;
			_delay_ms(5000);
			PORTD = 0x00;
			_delay_ms(5000);
		}
		while(x=1);
	}
	
}

 

 

Last Edited: Fri. May 15, 2015 - 02:55 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

If you have not altered the fuses then I am pretty sure the chips are used. 

IIRC the clock should be the internal 8Mhz oscillator and the CLKDIV8 fuse is check boxed, no BOD.  I cannot remember the default state of the other two I see checkboxed.

 

JIm

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

 

"The critical shortage here is not stuff, but time." - Johan Ekdahl

 

"Step N is required before you can do step N+1!" - ka7ehk

 

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB, RSLogix user

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

What do you do if you do have a blank chip? I've seen a tutorial where the guy was updating the bootloader for his arduino uno. He selected/ loaded an "omniboot" file from the Arduino IDE folder into the Device Programming > Memories > Flash window to be uploaded to the arduino. In my case,  when making this blink sketch, however, I noticed that if I went to the same path, the Flash window would already be filled up. it would have my code project file written in it. So does that mean that you program the chip directly via the AVRISP mk2? bootloader-less programming, as I may have heard of it...?

 

On a side note, I've got a whoel roll of these 328 chips. I've only played aroudn with 2 of them, I seem to be able to uplaode the code Via pressing "Program" button in Device Programming > Memories > Flash. However, If I try to use the "green play" icon like I did with my first chip, I get an error... weird.

 

I have been tinkering around wit the two chips I had in the pic so I might have managed to isntal the booloader from one of the numerous tutorials I've looked at.

Last Edited: Fri. May 15, 2015 - 03:47 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

jgmdesign wrote:

 

- added a 10k resistor between Gnd and VCC on pins 7 and 8. (as suggested by the gentleman above )

I suggested a 10k resistor from Vcc to the RESET pin.  Not from Gnd and VCC...That does nothing.

 

 

The internal reset is all that is required.

Leon Heller G1HSM

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

Hallo Tobias

 

I work with ATMEL STUDIO 6.2 and AVRISP MK2 and programing ATxmega128 and ATmega328P.

 

Look here: http://www.cczwei-forum.de/cc2/thread.php?postid=87773#post87773

 

and here https://ox1aha.dm2304.livefilestore.com/y2pDWA9GKWb7nxTdqk6VIZuAN_TbRFXg6WZCO5YxFUffrPHcorMjxFmJT45Qkrn4nSJ9oYvN7QH_JynTA6gx5uWW0ik5MGn_qQ43u50y8Un_J2OISkHeCkh52UEXNq-QoXlxof7FlQmvhSw8jxuSIc0xTFHSwl3Fk3ghpo0f8EDdB4/Frontpannel_30.jpg

 

Programming a new ATmega328P chip in ATMEL STUDIO is so simple. But you have setting the right fuses for crystal clock and setting isp clock frequency for programmer to 125 kHz.

The highest crystal frequency to 5 Volt is 20MHz and to 3.3 Volt is 12MHz (16MHz is out of spec but work)

 

 

Greetings from germany. Rolf

Windows 10 Home 64Bit, ASUS M4A89GTD-PRO/USB3, AMD Phenom II X6 1055T, Ram 2x 4GB, SSD Samsung EVO840 250GB, SATA HD 2.0TB, NVIDIA GeForce GTX 750

Last Edited: Fri. May 15, 2015 - 11:11 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

@ rolfdegen

Apologies to bring down your expectations of me but I'm barely out of arduino dipers. I've just discovered the standalone possibility just about a year ago and only mastered up the will and curiosity to venture into this gig. At this point, I wont be able to make out sense in larger schematics and can only bluntly follow step by step tutorial. maybe an occasional idea with a pot or resistor but that's as far as I'm aware.

 

I've copied the fuse settings from my post here: https://www.avrfreaks.net/comment...

and that seamed to get Atmel Studio to upload my codes straight away. However after I changed the fuses, the blink program started working faster. Is that what you were talking about with setting up fuses for the crystals of different frequencies?

Last Edited: Fri. May 15, 2015 - 02:02 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hallo Tobi,

 

in your code missing clock frquency for the crystal:

 

#include <avr/io.h>
#include <avr/delay.h>

#define  F_CPU 8000000UL	// Prozessor-Clock 8MHz

int main(void)
{
	DDRD = 0xff ;
	int x;
	while(1){
		x=1;
		do {
			PORTD = 0x01;
			_delay_ms(5000);
			PORTD = 0x00;
			_delay_ms(5000);
		}
		while(x=1);
	}
	
}

 

Windows 10 Home 64Bit, ASUS M4A89GTD-PRO/USB3, AMD Phenom II X6 1055T, Ram 2x 4GB, SSD Samsung EVO840 250GB, SATA HD 2.0TB, NVIDIA GeForce GTX 750

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

Be careful with Rolf's code.  F_CPU should be before the delay.h, and (x=1) isn't correct.

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

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

Oh sorry :) That's right.

Windows 10 Home 64Bit, ASUS M4A89GTD-PRO/USB3, AMD Phenom II X6 1055T, Ram 2x 4GB, SSD Samsung EVO840 250GB, SATA HD 2.0TB, NVIDIA GeForce GTX 750

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

I saw the x=1 in this tutorial: https://www.youtube.com/watch?v=...

The guy explained it to be a way to get the program loop. Why is this option not preferred (as I assume from your precaution)?