[SOLVED] Atmega328P-PU w/ optiboot not respond trying to upload sketch

Hi, I've Arduino Uno R3 and I never had any problems working with it, now I want to build standalone projects, everything is fine with the ATMEGA included on my Arduino, but I bought 2x ATMEGA328P-PU from ebay (this one), which already has optiboot bootloader installed (supposedly), and there's no way to get it work. I tried placing these atmegas on arduino, connecting by serial, burning bootloader by myself... but nothing works.

I tried with all these schemes, I watched some videos... definitely no way... I'm lost, so if someone could help me it would be appreciated.

Thanks, best regards.

How do you have them wired when trying to burn bootloader?

What error do you get while trying to burn bootloader?

Could they have been supplied configured to use a 16mhz crystal? Have you connected such a crystal? If it's set to use a crystal, the chip will not respond if no crystal is present.

DrAzzy:
How do you have them wired when trying to burn bootloader?

What error do you get while trying to burn bootloader?

Could they have been supplied configured to use a 16mhz crystal? Have you connected such a crystal? If it’s set to use a crystal, the chip will not respond if no crystal is present.


Like this

First I upload the Arduino ISP example to my working ATMEGA328P-PU (Board Arduino UNO / Programmer AVR ISP)
Then I change the programmer to (Arduino as ISP) and board to (Arduino Nano w/ Atmega328), try to burn bootloader and get the next error:

avrdude: stk500_program_enable(): protocol error, expect=0x14, resp=0x50
avrdude: initialization failed, rc=-1
Double check connections and try again, our use -F to override this check
avrdude: stk500_disable(): protocol error, expect=0x14, resp=0x51

Of course using a 16MHz crystal and 2x 22pf capacitors :confused:

You forgot the 0.1uf ceramic cap between Vcc and Gnd right next to the chip. Put that in and see if it fixes it...

Sorry, Im not sure where you mean to place it, maybe like this?

Thanks

EDIT: Tried and got same error

Shrykull-1337: First I upload the Arduino ISP example to my working ATMEGA328P-PU (Board Arduino UNO / Programmer AVR ISP) Then I change the programmer to (Arduino as ISP) and board to (Arduino Nano w/ Atmega328), try to burn bootloader and get the next error:

Are you remembering to add the 10uF (or thereabouts, I've used 2X 0.1uF in parallel and had no issues) cap between the Uno's Reset and GND after the ArduinoISP sketch has been uploaded?

http://www.arduino.cc/en/Tutorial/ArduinoISP: 4. Upload the ArduinoISP sketch. 5. Wire your Arduino board to the target as shown in the diagram below. (Note for the Arduino Uno: you'll need to add a 10 uF capacitor between reset and ground.) 6. Select the item in the Tools > Board menu that corresponds to the board on which you want to burn the bootloader (not the board that you're using as the programmer). See the board descriptions on the environment page for details. 7. Use the Burn Bootloader > Arduino as ISP command.

To answer your question to DrAzzy, yes that position works for the 0.1uF cap (most folks just put it across the breadboard power rails but yours is actually better since it is closer to the chip).

madmattd: Are you remembering to add the 10uF (or thereabouts, I've used 2X 0.1uF in parallel and had no issues) cap between the Uno's Reset and GND after the ArduinoISP sketch has been uploaded?

No, I didn't know, its a electric or ceramic 10uF capacitor? I just tried with a electric one and still getting error

thanks

Ceramic is what I used the times I've run ArduinoISP. Like I said, I didn't have 10uF handy, but found that 2x 0.1uF were fine.

Actually, just try Nick Gammon's bootloader sketch instead, and report what it reads back if it doesn't work (and then you don't need that stupid extra cap). I find it easier to use, especially if you are using a standard bootloader (which you are). Program the Uno bootloader since you have a 328p.

Edit: ha, looks like CrossRoads and I had the same thought. Not sure why I didn't just suggest it earlier.

Use Nick Gammon's bootload installer sketch instead. http://www.gammon.com.au/breadboard

Well, I'm newbie in this field and I'm not sure if I need that...

All I want is to upload my sketch to these 328P... with or without bootloader, I don't care, with or without arduino (I mean, if I can program the 328p directly connected to my RS232 it would be fine, since I don't want arduino in my standalone projects)

I dont have some required capacitors nor resistances, so I would like to know what way I take before I buy what I need.

Btw, I bought this USB to RS232 converter 2 days ago (I should receive it ~2weeks) for establish serial communication with my project and my pc via USB (I'm not even sure if it allows me do that, I guess it does), maybe I can also use it as programmer?

In brief, I'm looking for the easiest/simplest way to upload sketches, no matters how, so must I read about Nick Gammon's bootloader or is there any better way?

Thanks you so much

Either put a bootloader on and upload using the serial port (FTDI Basic is simplest, I have no experience using RS232 to TTL adapter). Or, get a Programmer and use File:Upload Using Programmer, which does not require a bootloader.

My Standalone Programmer can also be used to load a file that is on SD card. You connect the programming header to +5, Gnd, Reset, SCK, MISO, MOSI on your standalone board. http://www.crossroadsfencing.com/BobuinoRev17/ |500x315

I'll look for a programmer then, arduino UNO can't be use as programmer, right?

Thanks

Shrykull-1337: I'll look for a programmer then, arduino UNO can't be use as programmer, right?

Thanks

ArduinoISP IS using the Arduino as a programmer....

Nick Gammon's sketches operate very much the same as ArduinoISP, just with more feedback. He also has a board programmer sketch that will upload compiled .hex files to a target chip if that is really the route you want. Wiring is the same, just a different sketch. Seriously, read it, it isn't that complicated.

Personally I find bootloading the chip then using an FTDI to program easier than trying to use an ISP programmer through the IDE. If you are having trouble bootloading then I can almost guarantee you will have even more trouble programming via an ISP.

madmattd:
ArduinoISP IS using the Arduino as a programmer…

Yea, right, I got a lapsus there, I’m trying to burn bootloader by Arduino as ISP, could I upload sketches directly via [File > Upload using programmer] with this method w/o bootloader?

madmattd:
Seriously, read it, it isn’t that complicated.

It isn’t about complicity, it’s about time, but I’ll read it later anyway

madmattd:
Personally I find bootloading the chip then using an FTDI to program easier than trying to use an ISP programmer through the IDE. If you are having trouble bootloading then I can almost guarantee you will have even more trouble programming via an ISP.

I just bough the resistances and capacitors that I needed and still gettind the same errors trying to burn bootloader with arduino as ISP, so I’ll see FTDI. I need a USB to RS232 cable, am I wrong? would this converter also work then?
Well, I should be able to use directly just my RS232 instead of USB I guess, right?

Sorry if I’m doing to many questions, I’m getting a bit mad because I don’t get it work :confused:

Thanks you all so much

FTDI Basic (https://www.sparkfun.com/search/results?term=ftdi+basic) does not need RS232 at all. Just USB from the PC to USB on the module. Then you can also use the IDE's Serial Monitor for debugging your code.

CrossRoads:
FTDI Basic (Search Results for ftdi basic - SparkFun Electronics)
does not need RS232 at all. Just USB from the PC to USB on the module.
Then you can also use the IDE’s Serial Monitor for debugging your code.

But I dont own any kind of these module at the moment, thats why I ask if I can use my RS232 port, because its my only chance right now, so would it work or not? :slightly_frowning_face:

thanks

One of the early Arduinos was RS232 based. http://www.arduino.cc/en/Main/ArduinoBoardSerialSingleSided3 So technically, I suppose it can work. PC driver-wise, I have no experience with that part.

Well, I guess I burned Nick Gammon's bootloader...

Atmega chip programmer. Written by Nick Gammon. Version 1.33 Compiled on May 12 2015 at 16:35:22 with Arduino IDE 100. Attempting to enter programming mode ... Entered programming mode OK. Signature = 0x1E 0x95 0x0F Processor = ATmega328P Flash memory size = 32768 bytes. LFuse = 0xE2 HFuse = 0xDA EFuse = 0xFD Lock byte = 0xEF Clock calibration = 0x96 Type 'L' to use Lilypad (8 MHz) loader, or 'U' for Uno (16 MHz) loader ... Using Uno Optiboot 16 MHz loader. Bootloader address = 0x7E00 Bootloader length = 512 bytes. Type 'Q' to quit, 'V' to verify, or 'G' to program the chip with the bootloader ... Fixing low fuse setting ... Attempting to enter programming mode ... Entered programming mode OK. Erasing chip ... Writing bootloader ... Committing page starting at 0x7E00 Committing page starting at 0x7E80 Committing page starting at 0x7F00 Committing page starting at 0x7F80 Written. Verifying ... No errors found. Writing fuses ... LFuse = 0xFF HFuse = 0xDE EFuse = 0xFD Lock byte = 0xEF Clock calibration = 0x96 Done. Programming mode off. Type 'C' when ready to continue with another chip ...

So now should I just put this 328p to my arduino and simply upload any sketch? When I do I get:

avrdude: stk500_getsync(): not in sync: resp=0x00

:(

EDIT: OH GOD DAMNIT THANKS! I just removed wires and finally it works, thanks!! :D

Yeeaaa...

Shrykull-1337: Well, I guess I burned Nick Gammon's bootloader...

Yes, you did indeed get the Uno 'loader on there. Yea! Like I said before, I've found more consistent/helpful results with Nick's sketch than the ArduinoISP sketch.

Since you seemed to be confused on this point a few posts back: The bootloader is what allows code to be uploaded over serial to the chip. Therefore, to use a USB->Serial converter (such as an FTDI board, or in the case of the official Uno R3 board a separate specially-programmed AVR chip) to upload code, the bootloader already needs to be in place. The only way to burn the bootloader is via the ICSP pins as you have now successfully done.

With the bootloader burned, yes you can pop the chip in your Uno board and upload normally, or with it still in your breadboard circuit, a USB->Serial converter such as an FTDI adapter can be used with the same upload method.