0

I have an external device using an ATmega328, not a ATmega328-P as used by the Arduino Uno.

Now I want to use AVRDUDE and an Arduino Uno to flash a hex file on this chip. Therefore I removed the ATmega that came with the Arduino and popped in the one without the "-P".

With the Arduino IDE, it doesn't work, so I tried AVRDUDE:

avrdude -c arduino -P com3 -p ATMEGA328 -b 19200 -U flash:r:sdint.hex:r

However, I'm doing something wrong here, because it does not work:

avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x00
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0x00
...

What commandline should I use to flash an Arduino Uno with an ATmega328?

  • Does it give any error messages? – AMADANON Inc. Nov 19 '15 at 20:38
  • I'm sorry I didn't provide them. I would have to get my whole setup here and disassemble the other device again. But I get different error messages with different command lines I tried. And I tried a lot of them. – bytecode77 Nov 19 '15 at 20:39
  • When posting an issue on SE, if there is an error message, include it in the post - the error message usually says exactly what's wrong, if you can decode it. I think you are unlikely to get an answer if you don't post the error message. – AMADANON Inc. Nov 19 '15 at 20:43
  • I will update it then. Give me just a few minutes. – bytecode77 Nov 19 '15 at 20:44
  • 1
    do you know if the atmega328 has the bootloader in it? – brtiberio Nov 19 '15 at 23:50
0

This seems to be quite a common problem, and there are a number of problems, each with their own solution.

  • Make sure you have selected the right chip
  • Make sure you have selected the right serial port (when you unplug your board, it should disappear).
  • Make sure you do not have anything plugged in to the tx & rx pins (usually 0 and 1).
  • Make sure your Atmega chip has a bootloader on it
  • Try another cable
  • There may be a problem with your computer - try another computer
  • If using another helps, try reinstalling the USB serial driver
  • Try unplugging the Arduino board, holding down the reset switch, then plugging it in (still holding down reset); continue to hold down reset for about 5 seconds.
  • make sure nothing else is trying to use your serial port
  • Does your chip have a bootloader? Chips bought as part of an Arduino will, otherwise, it almost certainly doesn't, unless it specifically says (in the description of what you bought).

If it does not have a bootloader (or may not have a bootloader) you will need to set this up. You can either use the instructions here: https://www.arduino.cc/en/Tutorial/ArduinoToBreadboard (which I never got working) or you can use an ICSP like the http://www.freetronics.com.au/products/usbasp-icsp-programmer-for-avr-arduino#.VlIY_2xifXs (which is what I use) - works great. They can be had for a few dollars from China.

  • I'm not even using the Arduino IDE, have you read my question? And... another cable........ – bytecode77 Nov 20 '15 at 14:19
  • I am sorry for offending you by mentioning the IDE, I have corrected it. As mentioned in my post, this error is a common error, and to save others from having to post another question, I have given as many possible answers as I could think of. Also note the answer at the bottom, which I have just added – AMADANON Inc. Nov 22 '15 at 19:29
  • Most likely I don't have a bootloader. The chip I'm using didn't come with an Arduino. It was part of a DIY circuit board. Can I burn a bootloader using an Arduino, without buying additional hardware? – bytecode77 Nov 22 '15 at 20:34
  • Yes - using the first of the two links at the bottom - you'll need a working Arduino (with a bootlloader - you don't mention why you bought the new chip, so this may not be possible), and the separate chip (without the bootloader). Your mileage may vary, and if you have problems, I recommend getting the ICSP, which is cheap, and I've never had a problem with. – AMADANON Inc. Nov 23 '15 at 1:12

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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