0
\$\begingroup\$

This question might be asked somewhere, if so all references would be appreciated.

Hello, I have programmed Atmel chip Atmega32U4 through USB. It is possible because it supports USB programming. I used for that Atmel Studio to create the hex file and then I used Atmel FLIP to get it onto chip. It works very well and it is easy to do. I haven't used any other method so far. Now I want to program Atmega328P and I want to do it through some outer programmer like USBtiny because it seems like Atmega328P won't support through USB programming. Anyway I don't have any programmers, but i have Arduino. So I thought how can I use Arduino to program the chip. I been googling for a while and what I found is only teaching how to make chip basically like Arduino. So I burn the bootloader and I can upload Arduino sketches. But I don't want that. Whole point is to get rid of Arduino. I want to upload hex file directly to chip. And now it gets a little complicated for me. I have read about AVRdude, it should be possible with it. I also read someone said AVRdude is worst program. My question is, what are my options? Can I use some fancy graphical software like Atmel FLIP? Can I use FLIP somehow? Thanks for your time.

\$\endgroup\$
7
  • \$\begingroup\$ Actually, you can program the 328 through USB. Someone has made bitbang USB for the AVR. \$\endgroup\$
    – Long Pham
    Aug 5, 2018 at 12:35
  • 2
    \$\begingroup\$ You can program the chips using an SPI interface. Look on the internet for AVRDUDE. AVRDUDE runs on many platforms. e.g. a Raspberry-Pi. p.s use capital I not i in your text (just pretend you are very important. :-) \$\endgroup\$
    – Oldfart
    Aug 5, 2018 at 12:54
  • \$\begingroup\$ Search term: "ArduinoISP" \$\endgroup\$ Aug 5, 2018 at 13:02
  • \$\begingroup\$ Yes, im aware of AVRdude through SPI. Im looking for alternatives. \$\endgroup\$
    – Mini Tamm
    Aug 5, 2018 at 13:52
  • \$\begingroup\$ Buy an "AVR-ISP-MK2" or compatible, then you can use it with Atmel Studio directly. \$\endgroup\$ Aug 5, 2018 at 13:54

1 Answer 1

1
\$\begingroup\$

You can use the same techniques documented for loading Arduino sketches, to load traditional non-Arduino AVR projects. This is because all the Arduino system does is pre-munge the source files, feed them through tools from an ordinary avr-gcc to produce a hex file and then uses avrdude (or in a few cases something else) to command the programmer.

So for example, the writeups you found on using an Arduino-as-ISP sketch on an existing Arduino to program an ATmega328p on a breadboard and turn it into an Arduino would work fine. You would just run avrdude yourself to load your own .hex file, instead of an Arduino sketch or bootloader.

avrdude is of course a complex program with many options. The easiest way to figure out how to use it is to cheat: Open up the Arduino IDE, enable verbose output in an options menu somehwere, and then use it to program your board. Then simply select and copy the avrdude command line, and modify the name and location of the .hex file. This is particularly true if you use the copy of avrdude and configuration files for it installed by the Arduino IDE.

So, even if you (quite reasonably) don't want to develop with Arduino, you can still use it as a very handy shortcut to blaze a trail - proving that the hardware works, showing programming methods, etc. And it's still worth keeping around as another good use is if you want to evaluate a peripheral chip - you can see if someone has an Arduino sketch that will put it through its paces and allow you to decide if the chip is useful for your purpose, before you have to invest any time in writing code to operate it within your own software project.

Additionally, note that having an Arduino-style bootloader (in actuality they borrowed the idea from earlier work) does not mean you can only run Arduino sketches - you can use the bootloader to load in traditional AVR projects, and you can load Arduino sketches directly via ISP without a bootloader.

\$\endgroup\$
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.