Standalone AtMega328P - Programming issues

I have a programmed AtMega328P removed from a UNO board and in good working condition.

The pcb is done and all basics have been checked.

Trying to download sketch from IDE using a FTDI 232 - USB (5V).

Power supply to pin 7 reads 5.1V with reference to pin 8.

Reset pin 1 is pulled up to Vcc via 10K and also connected to the DTR pin via a 0.1MFD + 1K resistor to GND .

Rest TXD, RXD, 5V and GND are all connected as they should..

Apart from above the Crystal is 16MHz with two 22pf capacitors.

The problem : When connected to IDE the port is identified but the download process halts with following error :

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

( I can see the DTR pin going low to start the download process )

SO where do you think the possible hiccup is ??

There is not much way to tell what may be wrong. Please give a lot more information. Does the ATmega328P have a bootloader on it, and if so, what bootloader? What selections do you make from the Tools menu in the IDE? Version of IDE and OS? Set the IDE preferences to show verbose output on upload and show the results of an attempted upload. Show a photo of both sides of the board when connected using your FTDI. Show a schematic of the PCB. I suggest removing the 1K resistor to ground. Do the loopback test mentioned in one of the pinned posts on the Installation and Troubleshooting forum and tell results of that. Tell what happens with the flashing of an LED connected to PB5 during upload and during reset of the MCU.

Do you have AVCC connected to Vcc, and with 0.1uF caps on each to Gnd, also both Gnd pins connected?

I don't think you're supposed to have the 1k resistor to ground that you mention. I've never needed it.

As my experiences this fault is usually caused by Reset pin not working properly. So focus on the Reset pin.

It's also possible that the fault is from the FTDI device. Have you tried using UNO board to upload programs. I think UNO board is more reliable than FTDI device.

Thanks to all those who responded.

  1. The Vcc is fine at 5.1V
  2. I have removed the 1K resistor from the DTR line
  3. I have checked the RESET pin 1 on the MCU. It goes from 5V to 0V when Reset button is pressed or when DTR is asserted when downloading code ( or trying to download !)
  4. I have changed the crystal
  5. I am yet to change the two 22pf capacitors from pins 9 and 10 to GND.
  6. I loaded the MCU with a simple Blink sketch on a UNO , removed the MCU and put it on this new board. Blink does not blink :frowning:

So its clear that the Oscillator section is dead on board … but cannot figure out why. For those interested I have attached the schematic as the PCB was made…

I want to use a 30MHz Oscilloscope and see if the oscillator is beating… how to go about this ??

ET-001-R2.pdf (18.7 KB)

Blink normally blinks the SCK pin. I don't see any LED there. Try connecting an LED from RM4.2 on CON8 to Gnd.

Oh .. sorry. I had modified the Blink sketch to control the LED connected to PD5 pin ( LD4 on my schematic )

Ok, try probing OSC1 and OSC2. Will be a low level (i.e. less than 0/5V) signal.

OK got it … I should expect to see a Square wave of period 0.0625 micro second across pins 9 and 10 . Lemme try this and get back.

But what is confounding is the fact that the MCU is refuses to oscillate - I suppose if the MCU / 16Mhz crystal and the two 22PF capacitors are OK / Reset pulled up to 5V, Oscillation should set in ?

Mogaraghu:
<…>
But what is confounding is the fact that the MCU is refuses to oscillate - I suppose if the MCU / 16Mhz crystal and the two 22PF capacitors are OK / Reset pulled up to 5V, Oscillation should set in ?

One would expect so…

But, while the barebones circuit is simple, lots can go wrong…

  • breadboards and jumpers add capacitance and
  • jumpers add resistance and inductance

Do you even know for sure that the 22pF are really 22pF? Like, were they ordered from a reputable vendor? Do you have a capacitance meter?

Building a barebones, we all seem to do it as a rite of passage, really is not cost effective in today’s market.

Ray

Hmmm... so it WAS the capacitor. One of them was looking normal but the lead did not connect to the disc internally ..

All well now and back in business. Thanks for all the suggestions.