ATmega328p-pu doesn't work although apparently bootloaded

Hello everyone,

I am writing you because I have some problems to properly program a ATmega328P-pu with arduino code and ArduinoISP. I saw on the internet that there is a lot of problem with this microcontroller programming.
My Arduino board is an Arduino Uno Rev 3

In fact, I followed the tutorial on programming ATmega328P-pu:

I choose :
Board type : Arduino Duemilanove w/ ATmega328 (I use Arduino Uno too)
Serial Port : COM 3
Programmer : Arduino as ISP

In fact, burning bootloader seems to be ok.
However, when I want to upload blink sketch I get :
Upload Finished
avrdude: stk500_getsync(): not in sync: resp=0x00

In other hand , if I choose Board Type : Arduino BT W/ ATmega328
The sketch is correctly uploaded
However, the LED flashes every 10 seconds when it should flash every 1 second (delay(1000)).

Which board must I choose?
Is it a problem about bootloader?
Have you had a similar problem?

Thank you for your help.

Benjamin

I'm also having problems with 2 atmega328p and one 328.

The bootloader seems to burn well but then I can't program the atmega with a CP2102. I get allways the same error:

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

This happens no matter what board I choose :frowning:

@benjamin66, I don't know, sounds like your fuses aren't getting set, if you are burning from the IDE they should be.
You could try Nick Gammon's bootload installer instead:

Microprocessors, then Program Bootloader

@canibalimao,
Do not connect the RESET pin on the CP2102, that is an input to the chip.
What you can do is add a jumper to bring the DTR signal thru a 0.1uF cap to the Reset pin on the Arduino board. Or press Reset on the board when the IDE shows "compiled xxx of 32xxx bytes". May need to have Verbose outputs checked under File:Preferences to see that. May take a couple of tries to get the timing right. The reset restarts the bootloader and makes it look for Serial data coming in to start the sketch download.

CrossRoads:
@canibalimao,
Do not connect the RESET pin on the CP2102, that is an input to the chip.
What you can do is add a jumper to bring the DTR signal thru a 0.1uF cap to the Reset pin on the Arduino board. Or press Reset on the board when the IDE shows "compiled xxx of 32xxx bytes". May need to have Verbose outputs checked under File:Preferences to see that. May take a couple of tries to get the timing right. The reset restarts the bootloader and makes it look for Serial data coming in to start the sketch download.

I haven't connected the MCU to RESET pin. I soldered a jumper to DTR output and then connect that pin to pin1 on atmega. I believe that's not a problem with the USB converter...
I also tried to burn optiboot but the results are the same...

Thanks Crossroads for your help.

I am trying to follow Nick Gammon's topic however i don't understand during atmega_board_detector using where Board Detector Output should be displayed in this topic:

Thanks you for your help.

Benjamin

benjamin66:
Thanks Crossroads for your help.

I am trying to follow Nick Gammon's topic however i don't understand during atmega_board_detector using where Board Detector Output should be displayed in this topic:
Gammon Forum : Electronics : Microprocessors : How to make an Arduino-compatible minimal board

Thanks you for your help.

Benjamin

On serial monitor?
You can open it on arduino IDE by selecting Tools -> Serial Monitor and then select "115200" on the baud rate.

About my problem, even if I put the atmega on the arduino board I get the same error:

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

So it's not a problem with the CP2102 :frowning:

EDIT: after another try I got it working with and without the board! The CP2102 is working!

Thanks CrossRoads :smiley:

canibalimao:
I haven't connected the MCU to RESET pin. I soldered a jumper to DTR output and then connect that pin to pin1 on atmega.

And there is of course, a 0.1µF capacitor in series with that DTR line, isn't there?

Paul__B:

canibalimao:
I haven't connected the MCU to RESET pin. I soldered a jumper to DTR output and then connect that pin to pin1 on atmega.

And there is of course, a 0.1µF capacitor in series with that DTR line, isn't there?

And that time no, but it didn't work in the arduino board either. I didn't know that a single capacitor make such a difference....

I'm not quite sure what you are saying, but the capacitor in series with the DTR line is a critical part of the Arduino design and present on all (current) boards.

It is there because when DTR becomes active (low), you want the MCU to be reset in order to start the bootloader, but not stay reset as it would in that state, do nothing at all.

I'll try to be more specific:

When I first post my problem I haven't tested the DTR line with a capacitor. But it hanven't work even on my arduino board, so I assume that that time wasn't a problem with the reset. But now, using the CP2102 and the capacitor, it's working.
I didn't know that a simple capacitor could make such a big difference.

canibalimao:
I'll try to be more specific:

When I first post my problem I haven't tested the DTR line with a capacitor. But it hanven't work even on my arduino board, so I assume that that time wasn't a problem with the reset. But now, using the CP2102 and the capacitor, it's working.
I didn't know that a simple capacitor could make such a big difference.

A simple capacitor may seem to you as a non critical component, but it's how the cap is being used in a larger circuit that determines how critical it is to the function of a given specific circuit. This circuit (and capacitor) is critical if you wish to be able to automatically upload sketches from the arduino IDE. If you are OK with learning to time a manual reset switch correctly you can upload without a functioning arduino auto-reset circuit.
Lefty

retrolefty:

canibalimao:
I'll try to be more specific:

When I first post my problem I haven't tested the DTR line with a capacitor. But it hanven't work even on my arduino board, so I assume that that time wasn't a problem with the reset. But now, using the CP2102 and the capacitor, it's working.
I didn't know that a simple capacitor could make such a big difference.

A simple capacitor may seem to you as a non critical component, but it's how the cap is being used in a larger circuit that determines how critical it is to the function of a given specific circuit. This circuit (and capacitor) is critical if you wish to be able to automatically upload sketches from the arduino IDE. If you are OK with learning to time a manual reset switch correctly you can upload without a functioning arduino auto-reset circuit.
Lefty

I know that capacitors can be a really usefull piece in a circuit, but I didn't know that it could be the case of this tinny tinny cap.
And by the way, the manual reset can be a really headache :sweat_smile:

I know that capacitors can be a really usefull piece in a circuit, but I didn't know that it could be the case of this tinny tinny cap.

So now you learned otherwise right? It's kind of like "for the lose of a nail a shoe was lost, for lose of a shoe a horse was lost.....".

And by the way, the manual reset can be a really headache smiley-sweat

It is a task that can be learned and mastered to be not a headache. :wink:

canibalimao:
I know that capacitors can be a really usefull piece in a circuit, but I didn't know that it could be the case of this tinny tinny cap.

There is a close parallel here.

Consider what happens if you have one character wrong in the code part of a sketch.