Help : Firmware into Usbasp ( AVR Programmer) !!

Status
Not open for further replies.
You have to use an AVR programmer to build the USB programmer.

You can find many programmers in the Internet, a simple one is this
AVR Programmer

Alex
 
Thanks guys, thanks alot..... ;-)

i will try AVR Programmer.....
n will come back if i got any problem....
 

Hey Guys....

Can i Program the ATmega 8 (with Firmware) with an USBasp.....??
as my friend have an USBasp, he got that in a workshop...


and if yes, then for that what i have to do....??
 

Yes you can, USBasp is just a programmer,
there in no problem when you try to program another chip with the USBasp hex code or any other code.

Alex
 

Here are the pins of ATmega 8...
**broken link removed**


and here is the output of my WORKING Usbasp....


from https://www.edaboard.com/threads/200935/




so should i connect pins like below for programming atmega8...??

Programmer Output ----------------------------- ATmega 8
Ground ----------------------------------------- pin 22, 8
+5V (vccint) ----------------------------------------- pin 7, 20
Reset ------------------------------------------------- pin 1
MOSI -------------------------------------------------- pin 17
MISO ------------------------------------------------- pin 18
SCK --------------------------------------------------- pin 19

i think i am right, but wanna confirm.....
aslo please tell, if anything else i should connect....

also what about crystal....n fuses...??
 

Actually if you check page 137 of the mega8 datasheet it explains the connection,
The master is the pc side programmer and the chip being programmed is the slave,

MOSI is Master Out Slave In so it goes to the mega8 MISO (pin18)
MISO is Master In Slave Out so it goes to the mega8 MOSI (pin 17)



Alex
 
Last edited:
okay i got MOSI and MISO and SCK.... ;-)


but what about XTAL1 and RESET pin....


(and in your last reply....the pin18 have become an smiley, so kindly correct it....as it will confuse anyone seeing it later...)
 

You have to copy the hex file first and then change the fuses for the settings needed for the USBasp.

The AVR Burn-O-Mat (AVR8 Burn-O-Mat avrdude GUI) has a great online calculator for fuses (you can also download and use it as a front end for AVRdude)

For 12Mhz crystal (actually anything above 8MHz) you need to change

CKSEL3=1 (unprogrammed)
CKSEL2=1 (unprogrammed)
CKSEL1=1 (unprogrammed)
CKSEL0=1 (unprogrammed)

CKOPT=0 (programmed)

Alex

---------- Post added at 16:24 ---------- Previous post was at 16:22 ----------

The XTAL should't be connected anywhare
The reset of the programmer connects to pin 1 of the mega8 as you said

Alex
 
Last edited:
"re", is that mistyped ??

if not then please be kind to give link....








and thanks for helping with pins.... ;-)
 

The default clock source for AVR chips (from the factory) is the internal RC oscillator set at 1Mhz,
that is why you don't need to connect any external clock to the XTAL pins.

When you change the fuses for 12MHz external crystal then if you need to program the chip again (or read) you
will have to connect the crystal (with the 2 capacitors to gnd) to the XTAL 1 and 2

Alex

---------- Post added at 16:35 ---------- Previous post was at 16:31 ----------

Yes "re" was intended to be a link, sorry, it's ok now
 

so what should i do.....

option 1...
connect the programmer with ATMEGA 8, and burn it with firmware hex file. and that too without burning any fuse...and thus leting it work on 1MHz...without any external crystal....

or

option 2
set clksel fuse bits according to crystal ossilator, and then burn the firmware with an crystal osccilator of 12MHz....
as in USBasp(i am making) atmega8 will work at 12MHz....
 

When you transfer the program to the chip it doesn't make a difference one way or the other but
i think it would be easier for you to program the chip and then change the clock source.
If you change it first then you have to add a crystal to it to transfer the hex file, why go to that trouble.

When the loaded program starts to execute then the clock should be the one that was specified in the compiler (when the hex was generated),
not because anything will be damaged but because everything will execute 12 times slower than it should (1MHz instead of 12) so it will not work properly.
When the program executes the clock frequency should be the same as the defined clock in the compiler at the time of compile.

Alex

---------- Post added at 17:05 ---------- Previous post was at 17:02 ----------

P.S. i have also corrected the previous post , the M in MOSI/MISO stands for Master not Maser
 
Last edited:

OKay !!

so in all.....

I will be burning the firmware hex file on atmega8 (at 1MHz internal frequency), without doing anything with the fuses.....

the after that, i will do the following setting with fuses....

CLKOPT = 0

SUT1 = 1
SUT0 = 1

CKSEL(3,2,1,0) = 1,1,1,1

and now i am ready to use my USBASP !! :-D


SO KIND check, is the above procedure right.....??
 

Hey Guys....

Can i Program the ATmega 8 (with Firmware) with an USBasp.....??
as my friend have an USBasp, he got that in a workshop...


and if yes, then for that what i have to do....??

...yes nikhil, you can do that...and you've got all the pins right...
Source Pins >------> Target Pins (The ATmega8 you wish to program)
+5V >------> Pin 7
Gnd >------> Pin 8
MISO >------> Pin 18
MOSI >------> Pin 17
SCK >------> Pin 19
Reset >------> Pin 1

Put a 4Mhz/ 12 Mhz crystal between pins 9, 10 on the target and attach a 15pf ceramic cap with each leg of it, going to the ground and it's all set. And don't worry about the fuses if you are using ExtremeBurner or ProgISP softwares to write your chip; as my experience goes.
...happy burning...(I've prepared an attachment to program 28 and 40 pin AVR with USBasp, will soon publish that with my article, as some photographs have to be clicked :-D)
 
Last edited:

CLKOPT = 0

SUT1 = 1
SUT0 = 1

CKSEL(3,2,1,0) = 1,1,1,1

Yes these are the correct settings,
note that 1 means unprogrammed
and 0 means programmed , sometimes different software show them differently

Alex
 

okay thanks alot alexan_e.... ;-)

can u tell me the difference between the FAST rise time and SLOW rise time for oscillator....
as CKSEL0 = 1 leads to slow
n CKSEL = 0 leads to fast....

---------- Post added at 19:02 ---------- Previous post was at 18:59 ----------


thanks for help with pins.... ;-)
but u said that i don't have to burn fuse....

but i think i should, as atmega 8 is using a crystal oscillator in USBasp....which is of 12MHz...

what u say...??
 

Actually CKSE0 leads to ceramic oscillator fast rising or crystal oscillator slowly rising

The sut0 and sut1 is what selects the slow or fast rising,
i leave it to slow all the time actually (this is also the default factory setting),
it has to do with the delay (after a reset) applied before the internal circuitry starts, (it changes to 4.1ms and 65ms)
I have never bothered with that setting.

Alex
 
okay thanks alot alexan_e !!

Great Help throughout the thread... ;-)
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…