Why my ISP dose not work?

What is a Uzebox? How can I get one? Check here!
Post Reply
john101
Posts: 18
Joined: Sat Mar 16, 2013 8:04 am

Why my ISP dose not work?

Post by john101 »

I bought one kits, but I take 2 days sold one Uzebox on pegboard first.
But failed to download any game, after 1 days trying.
Board1.jpg
Board1.jpg (218.35 KiB) Viewed 15306 times
In my pegboard, SD card , 7805 ,3.3V power, S video,Midi interface is omitted . Other part is just the same as Uzebox designing F2.But failed to ISP a game on it, the game I choose is Megatris.hex, I want to "ISP" it on my board.
The ISP downloader I use is a "USB PORT" one, based on "USBasp - USB programmer for Atmel AVR controllers".
Burner1.jpg
Burner1.jpg (105.77 KiB) Viewed 15306 times
And the software I used to ISP the game is:avrdude.exe,and the command is just like this:
avrdude -c usbasp -p m644 -B 4 -U flash:w:Megatris.hex -U efuse:w:0xFE:m -U hfuse:w:0xD2:m -U lfuse:w:0xFF:m
but it does not work, the result is like this:

It says :
avrdude: set SCK frequency to 187500 Hz
avrdude: warning: cannot set sck period. please check for usbasp firmware update
.
avrdude: error: programm enable: target doesn't answer. 1
avrdude: initialization failed, rc=-1
Double check connections and try again, or use -F to override
this check.


avrdude done. Thank you.

I check it over 2 hours, but still no idea.
I read some post on net, it seems AVR ISP is very simple, I guess maybe it is because the overclock cause this?
So I sold another Pegboard, which has the minimum circuit only support ISP,so only MOSI, RST,SCK, MISO, and VCC, GND sold and linked with 644 corresponding pin. and 644 , pin 10 connect with VIG, and pin 11,31 connected with GND, 644 get power by USB 5 v.
ISPBoard1.jpg
ISPBoard1.jpg (173.32 KiB) Viewed 15294 times
But it does not work!
The atmel 644 is new from the kits, so any suggestion? Thank you very much! ISP, it seems so simple but.......
User avatar
uze6666
Site Admin
Posts: 4801
Joined: Tue Aug 12, 2008 9:13 pm
Location: Montreal, Canada
Contact:

Re: Why my ISP dose not work?

Post by uze6666 »

What kit did you buy? Is your atmega644 already programmed or is blank?
User avatar
Kerby
Posts: 90
Joined: Wed Feb 06, 2013 6:02 pm

Re: Why my ISP dose not work?

Post by Kerby »

Installation quality is not very good! Not visible in the photo ceramic capacitors near the crystal, they you have installed?
User avatar
Janka
Posts: 214
Joined: Fri Sep 21, 2012 10:46 pm
Location: inside Out

Re: Why my ISP dose not work?

Post by Janka »

john101 wrote:avrdude -c usbasp -p m644 -B 4 -U flash:w:Megatris.hex -U efuse:w:0xFE:m -U hfuse:w:0xD2:m -U lfuse:w:0xFF:m
I never tried the usbasp interface type directly, only the avrisp2 emulation the thing has. Can you program other AVRs with the "usbasp" setting?

My .avrduderc for the USBasp reads

Code: Select all

default_programmer = "avrispv2";
default_serial = "usb";
default_bitclock = 20;
And I program the chip with

Code: Select all

$ avrdude -p m644 -U flash:w:Megatris.hex -U efuse:w:0xFE:m -U hfuse:w:0xD2:m -U lfuse:w:0xFF:m
If this doesn't work, check the power to the µC and the ISP lines. A fresh ATmega644 will answer on the ISP even if the crystal isn't there. But be careful - once you set the fuse to use the crystal, it is required - you cannot go back to no crystal without connecting a crystal first.

And I think you missed the load capacitators along the crystal pins. They have to be around 12..18pF and are *absolutely required*. To check whether the oscillator works, don't touch the pins with the oscilloscope tip - it has so much capacitance it would kill the oscillation. You need either an 1:100 tip or hold the tip *near* the crystal pins without touching them.
john101
Posts: 18
Joined: Sat Mar 16, 2013 8:04 am

Re: Why my ISP dose not work?

Post by john101 »

(1) Thank you very much:

What kit did you buy? Is your atmega644 already programmed or is blank?
My kit is like this:
Board.jpg
Board.jpg (102.34 KiB) Viewed 15209 times
I do not know if it is blank, but it should be programmed of "game loader". I dare not sold the smd AD725 directly, so I sold a pegboard first.

Not visible in the photo ceramic capacitors near the crystal, they you have installed?

Yes, they have been installed on the back, for simple and crudely sold.
and I have sold a minimum circuit, which won't work too.
Board2.jpg
Board2.jpg (180.75 KiB) Viewed 15207 times
Can you program other AVRs with the "usbasp" setting?
I have only atmega644 now. I try to buy some other 40 DIP avr tomorrow.

My question is:
(1) atmega644 is programmed with "game loader", which won't allow ISP?
(2)does AVR can be programmed with the minimum circuit?
(no crystal , no cap, with only MOSI, RST,SCK, MISO, and VCC, GND sold and linked with 644 corresponding pin. and 644 , pin 10 connect with VIG, and pin 11,31 connected with GND, 644 get power by USB 5 v. )

Today, if I have time, I will buy another 40 DIP AVR, like 164 , using the minimum circuit, to burn any *.hex,
if success, then my atmega644 won't allow be programmed, or bad.
if failure, them my burner (AVRASP) is bad?
User avatar
Janka
Posts: 214
Joined: Fri Sep 21, 2012 10:46 pm
Location: inside Out

Re: Why my ISP dose not work?

Post by Janka »

john101 wrote: (1) atmega644 is programmed with "game loader", which won't allow ISP?
This is a common misconception how the ISP works which circulates around AVR newbies. Forget it immediately :o

ISP is a hardware built into the chip and has nothing to do with a bootloader image which may or may not be on the chip. The only way to disable ISP on an AVR is to program the "RSTDISBL" fuse, which is available on some AVRs with small pin count to get another I/O pin instead of reset. The ATmega644 doesn't have this fuse as it has enough pins for all I/O the AVRmega core offers. So ISP is always available on ATmega644. :)

There is another way to shoot yourself into the feet however. This is programming the lfuse with a value not matching the osciallator circuit you connected to the device. Once you have set the lfuse to use the 28MHz crystal circuit, it has to work or the CPU isn't running - and neither is the ISP.
(2)does AVR can be programmed with the minimum circuit?
(no crystal , no cap, with only MOSI, RST,SCK, MISO, and VCC, GND sold and linked with 644 corresponding pin. and 644 , pin 10 connect with VIG, and pin 11,31 connected with GND, 644 get power by USB 5 v. )
If you take power from USB, you absolutely have to connect a 100nF film cap between VCC and GND, otherwise the circuit is unstable. USB has built-in coils in the power lines which limit the inrush current: without the cap your µC is underpowered for µs after reset and goes into a reset loop. A combo of 1µF tantal cap + 100nF film cap is better. And don't forget to connect AVCC, too. The datasheet says it *should* be connected in any case.

Without crystal and its caps, the lfuse setting has to be x2, not ff. Again, note once you set the lfuse to ff, the crystal oscillator has to work or you don't have the chance to switch back.
Today, if I have time, I will buy another 40 DIP AVR, like 164 , using the minimum circuit, to burn any *.hex,
Check if the programmer finds the chip first:

Code: Select all

$ avrdude -p m644
if success, then my atmega644 won't allow be programmed, or bad.
if failure, them my burner (AVRASP) is bad?
Unlikely. I have several USBasp running (in AVRisp2 emulation) and they are all ok. Some had been reported bad by other people who only have used them wrong.
john101
Posts: 18
Joined: Sat Mar 16, 2013 8:04 am

Some test about ISP and why it does not work

Post by john101 »

Thank you very much for kind reply.
After 2 hours learning ISP, I know some basic knowledge about it.
new ATMEL644 and ATMEL644 from the kits is different,
new ATMEL644 can be "ISP" using the minimum circuit,(MOSI, RST,SCK, MISO, and VCC, GND linked with 644 corresponding pin , maybe AVCC?)
but ATMEL644 from kits may not be "ISP" using the minimum circuit, it might be set using external crystal oscillator, with 20 M frequency.
(efuse:w:0xFE:m -U hfuse:w:0xD2:m -U lfuse:w:0xFF:m)
So my logic is wrong: using the minimum circuit to test the chip and burner "usbasp".
(to check burner "usbasp" using minimum circuit , I should buy some cheap 164, also 40 pin)

so I checked my initial board again and re-sold 2x18p and crystal oscillator(28.636M),
this time all on the above side, and with a little longer pin leg(which is easy to detect using probe).
Test1.jpg
Test1.jpg (133.33 KiB) Viewed 15155 times
using probe I find some wave,from pin 12, (my probe is set in attenuation 10). it is stable with amplitude 20mv( maybe wrong reading, because the 10 attenuation?). the frequency is about 28M,
osciallor.jpg
osciallor.jpg (102.26 KiB) Viewed 15153 times
There is much higher frequency signal in pin 13, with much lower amplitude,
but again I can not program anything like 3 days before. (I stopped 2 days)
So my question is :
(1) My circuits seems works from the wave, is this right?
(2) what should I check next? (to check burner "usbasp" using minimum circuit , I should buy some cheap 164, also 40 pin)
Is this works?
if the burner works OK, then the ATMEL644 from the kits failed,
or I try another burner like avrisp2, which JanKa used well.
(3) Does a new blank ATMEL644 can be "ISP" both on a minimum circuit,and a circuit with external crystal oscillator?(I guess default set works this)
User avatar
Janka
Posts: 214
Joined: Fri Sep 21, 2012 10:46 pm
Location: inside Out

Re: Some test about ISP and why it does not work

Post by Janka »

john101 wrote:but ATMEL644 from kits may not be "ISP" using the minimum circuit, it might be set using external crystal oscillator, with 20 M frequency.
I bet is is. They have to test each individual chip if it runs stable at 28MHz, as this is beyond the maximum rating from the datasheet. I doubt they have reset the lfuse to the internal oscillator after the test.
using probe I find some wave,from pin 12, (my probe is set in attenuation 10). it is stable with amplitude 20mv( maybe wrong reading, because the 10 attenuation?). the frequency is about 28M,
Pin 12 should show about 70mV peak<->peak on an 1:10 probe. But the oscillation looks stable, so I think the µC should work. Do you have an <=20MHz crystal at hand? I would check again if the µC works at 10..20MHz. Then, maybe they selected it wrongly when packaging the kit.
There is much higher frequency signal in pin 13, with much lower amplitude,
Pin 13 is the oscillator input, so it's most likely the 3rd harmonic you measure there. Each crystal has multiple modes. As long as the 3rd is not dominant, it should be ok. But don't touch Pin 13 at all, the signal there is most brittle in the whole oscillator circuit.
if the burner works OK, then the ATMEL644 from the kits failed,
The programmer is working when it can program another ATmega644, which wasn't in the kit. I would check that.
(3) Does a new blank ATMEL644 can be "ISP" both on a minimum circuit,and a circuit with external crystal oscillator?(I guess default set works this)
The crystal is ignored when the lfuse is set to use the internal oscillator, which is factory default. Anyway, please refer to the ATmega644 datasheet for the details on the fuse and clock settings ("memory programming" section). It's neccessary to have this at hand when debugging problems with the circuit.
Post Reply