How can I program Atmega328 in Arduino Mini Based on AVR Studio?

Hi guys,

I am working on a project about convert a Arduino Mini on paper.

Now I got an idea that I want to program the Arduino Mini on AVR studio.

I am wondering how can I connect Arduino Mini with PC?

woyaohuijia: Do I need to bootload the Atmega 328?

No, provided that you program the atmega328 and set the fuses using ICSP, for which you need an ISP. You can use a regular Arduino as an ISP by running the ArduinoISP sketch and making up a cable. See http://miscsolutions.wordpress.com/2011/08/09/prototyping-small-embedded-projects-with-arduino/. However, if you will be programming chips often, it is better to buy a dedicated ISP, such as the AVRISPmkII or one of the cheap ISPs you can get from eBay and elsewhere.

dc42:

woyaohuijia:
Do I need to bootload the Atmega 328?

No, provided that you program the atmega328 and set the fuses using ICSP, for which you need an ISP. You can use a regular Arduino as an ISP by running the ArduinoISP sketch and making up a cable. See http://miscsolutions.wordpress.com/2011/08/09/prototyping-small-embedded-projects-with-arduino/. However, if you will be programming chips often, it is better to buy a dedicated ISP, such as the AVRISPmkII or one of the cheap ISPs you can get from eBay and elsewhere.

Hi ,Thanks for your reply.

Can I do like this? connect Arduino Mini with Arduino Arduino NG? Will the Arduino Mini I made can be programed correctly without bootload?

ArduinoMiniAndNGBreadboardPhoto.jpg

That (or something like it) might work with a real Arduino Mini, but not with a chip that doesn't have a bootloader installed.

dc42:
That (or something like it) might work with a real Arduino Mini, but not with a chip that doesn’t have a bootloader installed.

Ok, I got it. Thanks.

Now I got another idea to program the Arduino Mini (Atmega 328 ) on AVR studio.

I am wondering how can I connect Arduino Mini with PC?

woyaohuijia:
Now I got another idea to program the Arduino Mini (Atmega 328 ) on AVR studio.

I am wondering how can I connect Arduino Mini with PC?

You need an ISP. For AVR Studio I suggest the AVRISPmkII.

dc42:

woyaohuijia:
Now I got another idea to program the Arduino Mini (Atmega 328 ) on AVR studio.

I am wondering how can I connect Arduino Mini with PC?

You need an ISP. For AVR Studio I suggest the AVRISPmkII.

Yes, I have it. But the one I have consist of 10 pins- which are TCK,GND,TDO,vTref,TMS…TDI, GND

Could you please give me some details about how to connect this into arduino mini circuit?

Thanks. i am really in a hurry now :((

I think you must have something different, because the AVRISPmkII uses signals Vcc (or Vtarget), Gnd, RESET, MOSI, SCK, MISO. The original ISP connector had 10 pins, but it was the same 6 plus some more ground pins. See https://www.google.co.uk/search?q=avrisp+pinout&tbm=isch&tbo=u&source=univ&sa=X&ei=vJ2bUfX1Boa64ASo_oG4DQ&ved=0CDkQsAQ&biw=1677&bih=989.

dc42: I think you must have something different, because the AVRISPmkII uses signals Vcc (or Vtarget), Gnd, RESET, MOSI, SCK, MISO. The original ISP connector had 10 pins, but it was the same 6 plus some more ground pins. See https://www.google.co.uk/search?q=avrisp+pinout&tbm=isch&tbo=u&source=univ&sa=X&ei=vJ2bUfX1Boa64ASo_oG4DQ&ved=0CDkQsAQ&biw=1677&bih=989.

yes, i saw the picture. but mine doesn't havr RESET, MOSI, SCK,...it is really strange

You should be able to use that configuration in the photograph to program and communicate with the mini that is on the breadboard. Is that correct, is it working for you? If so, you should be able to now load ArduinoISP onto the mini and program ANOTHER mini or even a bare chip. You can use ArduinoISP to load a bootloader onto the other chip and set the fuses on a new, blank chip. But it would all probably be easier if you put your 328p back into the socket on the main board and follow one of the ArduinoISP tutorials.

Those signal descriptions you gave for the 10 pin connector sound like JTAG signals.

afremont: You should be able to use that configuration in the photograph to program and communicate with the mini that is on the breadboard. Is that correct, is it working for you? If so, you should be able to now load ArduinoISP onto the mini and program ANOTHER mini or even a bare chip. You can use ArduinoISP to load a bootloader onto the other chip and set the fuses on a new, blank chip. But it would all probably be easier if you put your 328p back into the socket on the main board and follow one of the ArduinoISP tutorials.

Those signal descriptions you gave for the 10 pin connector sound like JTAG signals.

Good idea! Thanks.

But compare to other package, mine is smd which can make little difficult to connect the wire into breadboard. BUt anyway, i think i will make it

woyaohuijia: But compare to other package, mine is smd which can make little difficult to connect the wire into breadboard. BUt anyway, i think i will make it

Standard practice is to include a 6-pin ICSP connector in the your design, and use it to connect the ISP for programming. You just need to be a little careful about what else you connect to the SCLK, MOSI and MISO pins of the mcu.

dc42:

woyaohuijia: But compare to other package, mine is smd which can make little difficult to connect the wire into breadboard. BUt anyway, i think i will make it

Standard practice is to include a 6-pin ICSP connector in the your design, and use it to connect the ISP for programming. You just need to be a little careful about what else you connect to the SCLK, MOSI and MISO pins of the mcu.

Thanks, I will try to get a one with 6pins.

But could you please give me some example code or link of tutorial about how to program? at in which software platform? Because I have never done this kind of thing before.

My purpose to write test program into Arduino Mini is to test Whether the atmega328 works or not.

woyaohuijia: But could you please give me some example code or link of tutorial about how to program? at in which software platform? Because I have never done this kind of thing before.

Assuming you can write a program for an Arduino, see the link I gave in reply #1 about how to put the same program on a standalone atmega328.