Society of Robots - Robot Forum

Software => Software => Topic started by: sean22 on February 24, 2009, 04:41:38 PM

Title: Cannot enter programming mode
Post by: sean22 on February 24, 2009, 04:41:38 PM
Hi,

I'm just trying to finish the 50 dollar robot but when i try to program it in avr studio it gives this error..


Getting isp parameter.. SD=0x06 .. OKOK
Reading FLASH input file.. OK
Setting mode and device parameters.. OK!
Entering programming mode.. FAILED!
Leaving programming mode.. OK!

I really dont know what to do please help?

Also it says that the serial number does not match the selected device
Title: Re: Cannot enter programming mode
Post by: pomprocker on February 24, 2009, 06:09:05 PM
What programmer are you using? What speed in MHz are you running the MCU at?

EDIT: oh and what chip? mega8 or 168?
Title: Re: Cannot enter programming mode
Post by: sean22 on February 24, 2009, 06:11:03 PM
The programmer is  a Atmel Avr isp mkII and the frequency is 125khz
Title: Re: Cannot enter programming mode
Post by: pomprocker on February 24, 2009, 06:14:55 PM
Are you using the atmega8 or 168? and are its fuses set for it to run at 1MHz or 8MHz? Also what is AVR studio and your makefile set for as far as chip type and speed?


EDIT: most importantly, I assume you went over the 2x3 header you soldered on your $50 bot board with a DMM (digital multimeter) ??
Title: Re: Cannot enter programming mode
Post by: sean22 on February 24, 2009, 06:54:29 PM
im using a mega8,

Now about the fuses i have this selected

"Ext. Crystal/Resonator High Freq.; Start-up time: 16K CK + 64 ms"

Though im not using a crystal

The version of avr studio is version 4.16 build 628

Im also using the makefile i downloaded from the programming quide
Title: Re: Cannot enter programming mode
Post by: sean22 on February 24, 2009, 07:55:57 PM
Here is the error i get when i try to program it
Title: Re: Cannot enter programming mode
Post by: pomprocker on February 24, 2009, 10:21:58 PM
If you tell your mega8 to use an external timing source and you don't provide it one, it won't run. You've pretty much locked yourself out. There is a way to unlock it though. First try changing the fuse back to the defaults.

Use the AVR fuse calculator and select the ATMega8 from the dropdown. It will list the default settings for you.

http://www.engbedded.com/fusecalc/


If you can't do it, then theres a rather painful tutorial i've put together in the member tutorial section so that you can unbrick it.
Title: Re: Cannot enter programming mode
Post by: cosminprund on February 25, 2009, 02:53:11 AM
Or you can simply add the oscillator so the chip starts working again and can be reprogrammed. It's no big deal, just a few more soldering points, depending on what you get.
Title: Re: Cannot enter programming mode
Post by: householdutensils on February 25, 2009, 03:47:39 AM
That's the exact setting that field has showed at times when I've mixed up my circuit, or had a bad connection to the programmer header...now that I think about it, it might actually be the default setting....I dunno.

Anyway, did you successfully read the fusebits before that value showed up?


If not, my bet is either

edit: I just connected with the programmer without it being hooked up to a micro controller and that's the vale the SUT_CKSEL fuse showed.
Title: Re: Cannot enter programming mode
Post by: sean22 on February 25, 2009, 03:26:41 PM
I'v cheaked the circuit many time its ok. the firmware is uptodate would i need to replace my atmega8
Title: Re: Cannot enter programming mode
Post by: pomprocker on February 25, 2009, 04:46:00 PM
either replace it, or if you have some extra parts laying around you could unbrick it with high voltage (12v)
Title: Re: Cannot enter programming mode
Post by: sean22 on February 25, 2009, 05:03:44 PM
i could but i dont have another Atmega. i was able to set the fuses by typing in the High Low numbers but it still cannot read a serial number


?Fuses not read? what does that mean
Title: Re: Cannot enter programming mode
Post by: householdutensils on February 25, 2009, 05:49:22 PM
Maybe it meas you weren't able to read the fusebit values from the mcu...I haven't encountered that error before.

Have you successfully programmed this mcu before?
Title: Re: Cannot enter programming mode
Post by: sean22 on February 25, 2009, 06:13:25 PM
No this is my first attempt to ive only read the signature number once
Title: Re: Cannot enter programming mode
Post by: householdutensils on February 25, 2009, 06:20:08 PM
I'm pretty sure your fuses are fine, as you haven't been able to connect to the mcu you can't have messed the fuses up, and since your AVRISP MKII Firmware is updated already and you've got the latest version of AVRStudio, your issue is either a wiring issue or a busted MCU (Or a busted programmer, but I HIGHLY doubt that's the case).

I know you've said you've checked your circuit many times, but I really recommend you go through it as carefully as possible. maybe even pull your ATMega outa the board and haywire that mofo up on a breadboard with the basics, just the power pins, the gnd pins, and the ISP header. Just to see if you can connect to it.
Title: Re: Cannot enter programming mode
Post by: sean22 on February 25, 2009, 08:20:17 PM
Great idea i will be doing this as soon as i get another 5vregulator
Title: Re: Cannot enter programming mode
Post by: sean22 on February 26, 2009, 07:14:17 PM
So i tested it in a bread board and had the same result these are the pins i hooked up

Title: Re: Cannot enter programming mode
Post by: householdutensils on February 26, 2009, 07:43:51 PM
Could you post a circuit diagram?

Did you connect your AVcc to the 5v supply? Or just to the ISP Header?
How come you didn't connect the second GND?

I don't know if it would cause a problem, but

Quote
AVCC is the supply voltage pin for the A/D Converter, Port C (3..0), and ADC (7..6). It should be
externally connected to VCC, even if the ADC is not used.


Can any one confirm whether or not the AVcc pin needs to be connected for the MCU to operate properly?
Title: Re: Cannot enter programming mode
Post by: sean22 on February 26, 2009, 08:04:31 PM
I dont have a circuit diagram now but i will try to make one

First i connect AVcc to the isp headder but then to the 5v supply and it does not make a difference

I did not hook up the second GND because i think that only one is needed for this purpose and it does not make a difference if you connect both. and it did not i tried it


Title: Re: Cannot enter programming mode
Post by: householdutensils on February 26, 2009, 08:35:34 PM
Can't hurt to try hooking up both GNDs eh? I mean, why not explore all avenues of possible and relatively easy solutions.
Title: Re: Cannot enter programming mode
Post by: Admin on February 28, 2009, 09:20:33 PM
Quote
Now about the fuses i have this selected

"Ext. Crystal/Resonator High Freq.; Start-up time: 16K CK + 64 ms"
sean22, as pomprocker said, you need to install a crystal.

You had set the fuse to tell it to use a crystal, but it doesn't have one. The only way to fix it is to install one.
Title: Re: Cannot enter programming mode
Post by: sean22 on February 28, 2009, 09:45:02 PM
Yes but i was wrong to say it needed a crystal it was a default option it turns out i could not even connect to the MCU
Title: Re: Cannot enter programming mode
Post by: Pototo on March 06, 2009, 11:46:18 PM
I actually have the same problem...the thing is that I was using avr studio to program the robot (default fuses, default lock bits, SPI under 1/4, and all that) and it was working fine pretty much; I had access to the programming mode.

Then I was using codevisionavr, and I started having the problem of getting into the programming mode, even thought everything was in the default mode in codevision as well. Now, I unistalled codevision I when back to AVR studio and the problem with the programming mode is also affecting while using AVR studio.

My circuits are correct, my ISP driver is updated, the atmega I am currently using is new, and it does not even work with my old atmega8

I am thinking that probably it has something to do with the programmer
Title: Re: Cannot enter programming mode
Post by: sean22 on March 07, 2009, 07:45:43 PM
Today i tried programming the mega8 with the cheap serial programmer in a breadboard with the same result i don't think the problem is the programmer.
Title: Re: Cannot enter programming mode
Post by: sean22 on March 09, 2009, 02:14:30 PM
Ok, so the new ATMeaga 8 arrived today i put it in the socket and plugged in the programmer and 10 seconds later my robot drove off my desk so the chip that i was having problems with was just bad probably from ESD (with the new one i had the ESD bracelet just to be safe)
Title: Re: Cannot enter programming mode
Post by: Billi on March 09, 2009, 05:42:41 PM
I am having similar problems... so I was monitoring this thread to see if I can resolve my problem the same way....

So this means i have a bad chip? Or perhaps I accidentally fried it?

I have another ATMega168 chip..., maybe I'll try that...
Title: Re: Cannot enter programming mode
Post by: sean22 on March 09, 2009, 05:45:33 PM
ok but if you have  the ATMEGA168 make sure you change the code so its compatible with the 168

http://www.societyofrobots.com/step_by_step_atmega168_swapout.shtml (http://www.societyofrobots.com/step_by_step_atmega168_swapout.shtml)
Title: Re: Cannot enter programming mode
Post by: Billi on March 09, 2009, 06:13:41 PM
So did you have any problems uploading that .hex file for servo modification? That part of the $50 tutorial wasn't that clear... I hope that hex is workable with the 168 chip...
Title: Re: Cannot enter programming mode
Post by: sean22 on March 09, 2009, 06:47:33 PM
i  dont have an atmega168 but it works on the atmega 8 i imagine if you make the same changes as you do for the robot code if should work.
Title: Re: Cannot enter programming mode
Post by: Pototo on March 15, 2009, 05:47:12 PM
I actually bought two new MCU (cheaper than by an stk500 or the drangon to implement HVP...~$50) to try them, and DigiKey is sending me a new ISP programmer, since I told about my problem and they say they are going to send me a new one...so lets see how it goes.

I will not trow my old MCU's away since they can be fixed