EEVblog Electronics Community Forum

Electronics => Beginners => Topic started by: christos on August 09, 2014, 09:16:25 am

Title: use arduino to program ATMEGA168
Post by: christos on August 09, 2014, 09:16:25 am
i have the arduino uno rev 3 and i would like to program some ATMEGA168...can i just remove the chip and place the new one and program it to?use it like a chip programmer
Title: Re: use arduino to program ATMEGA168
Post by: rob77 on August 09, 2014, 09:21:38 am
you need to load one arduino with the ISP programmer sketch and use is as a programmer for the other atmega.
the ISP programmer sketch is included in the arduino software and it's documented on the arduino page.
or just google it ;) lot of related stuff over there ;)
Title: Re: use arduino to program ATMEGA168
Post by: Psi on August 09, 2014, 09:26:31 am
Be aware that the letter P means the chip is a slightly different version and may have a different signature when programming.
Check if you have  ATMEGA168P   or   ATMEGA168.
Pinouts and functionality are the same, so both will work. The difference is to do with power consumption and other electrical parameters.

Title: Re: use arduino to program ATMEGA168
Post by: christos on August 09, 2014, 09:26:56 am
thx
Title: Re: use arduino to program ATMEGA168
Post by: christos on August 09, 2014, 09:29:16 am
http://arduino.cc/en/Hacking/Programmer (http://arduino.cc/en/Hacking/Programmer) 

very easy to do...so if i do this i will be able to program multiple chips (same chips)?

thx
Title: Re: use arduino to program ATMEGA168
Post by: christos on August 09, 2014, 09:31:22 am
does the chip itself have the bootloader in it ?
Title: Re: use arduino to program ATMEGA168
Post by: rs20 on August 09, 2014, 09:54:53 am
You need to ask more unambiguous questions.

http://arduino.cc/en/Hacking/Programmer (http://arduino.cc/en/Hacking/Programmer) 

very easy to do...so if i do this i will be able to program multiple chips (same chips)?

thx

Once you have a programmer, you can program a whole variety of chips. Typically, if you have a single PCB with multiple microcontrollers (which is sort of unusual to be honest), each microcontroller will have its own ISP header*; if you want to program chip X, plug your programming into header X. If you want to simultaneously program several different chips with the same programmer, that seems possible in principle but let's leave that for later.

* If you use JTAG instead of ISP to program, there are ways to program multiple chips through a single header, but that's not relevant while you're working with ISP.

does the chip itself have the bootloader in it ?

Do you mean "do brand new AVR chips have the Arduino bootloader (or any bootloader) installed by default?"? The answer is no, the chips will not have the Arduino bootloader installed. But if you're programming with ISP, you don't need any bootloader, so don't worry about this. The Arduino bootloader is only there to accept a program from the USB line via a fairly ugly hack. You'll be sending the program via ISP, which requires no bootloader at all, so you're fine.
Title: Re: use arduino to program ATMEGA168
Post by: ion on August 09, 2014, 10:24:49 am
http://arduino.cc/en/Hacking/Programmer (http://arduino.cc/en/Hacking/Programmer) 

That link is for using a dedicated programmer.  I think this might be more like what you were asking about:

http://arduino.cc/en/Tutorial/ArduinoISP (http://arduino.cc/en/Tutorial/ArduinoISP)

You can skip the last step - as rs20 wrote - you don't need a bootloader on the target chip.
Title: Re: use arduino to program ATMEGA168
Post by: Bryan on August 09, 2014, 10:57:55 am
This works well.

https://www.tindie.com/products/jeffmurchison/arduinoisp-deluxe-shield-kit/ (https://www.tindie.com/products/jeffmurchison/arduinoisp-deluxe-shield-kit/)
Title: Re: use arduino to program ATMEGA168
Post by: christos on August 09, 2014, 11:12:18 am
thx all
Title: Re: use arduino to program ATMEGA168
Post by: rs20 on August 09, 2014, 11:12:31 am
This works well.

https://www.tindie.com/products/jeffmurchison/arduinoisp-deluxe-shield-kit/ (https://www.tindie.com/products/jeffmurchison/arduinoisp-deluxe-shield-kit/)

Yikes, $25? Why not just get an actual programmer without the need for all those fiddly DIP switches and a spare Arduino?