I have a project that is using an 328P SMD TQFP32 and I want to program it from Arduino IDE and I want to also use the serial monitor.

For testing of my idea, I have connected the TX,RX,RST,GND and VCC of an DIP 328P to the Arduino and it worked.Then, I tried switching to my SMD 328P, which is mounted on a PCB, and I cannot program it, nor using serial monitor.My PCB had a 10K resistor holding uC's RST line at +5V and a 100nF cap to ground. I have removed them both and still it's not working.

Maybe someone can bring some light here, because I am stuck right now and I need the serial monitor for debugging.

Does the SMD part have a bootloader installed? Need that before the serial programming will work.Keep the reset pullup resistor for consistent operation.What else is connected? 16 MHz crystal wit 22 pF caps? 0.1uF caps from VCC, AVCC caps to Gnd?Reset switch to Gnd so that the chip can be reset and start up the bootloader code?

Thank you for the answer! I have burned the bootloader using ICSP and USBASP and now it works! The last day I have uploaded the Arduino-build hex code using 3rd party programmer(Khazama) and maybe that operation deleted the bootloader.

As we say, if it is working from the first try, we don't learn anything. Thank you!

I have encountered a problem:to upload a sketch from the Arduino IDE I need to burn the bootloader every time...If not, the RX blinks three times and then TX stays on and I'm getting "out of sync" error. Any ideas ? Thanks !

I have burned the bootloader using USBASP and then, on the first try, the sketch uploaded succesfully using tx/rx. Subsequent tries all failed. The wires from the Arduino to the target board have about 30cm, can this be an issue? Or the target board RST pull-down capacitor 100nF ?

How exactly is this connected? It shouldn't be a 'pull down' as in connected to ground, but inline with the line to reset from your serial programming source. It's intended to allow a pulsed low to reach the reset pin from the DTR pin of the serial controller. If you have it connected wrong then maybe your target is being held permanently reset or not being reset properly for the bootloader to take the upload.

You could try manual reset. Remove the capacitor and keep the reset pin low on the target. Hit Upload on IDE and watch for it compiling the sketch. When it changes to 'uploading' allow the target reset pin to go high (via the 10k pull up resistor you should have on it). See if you can upload consistently, which will prove the bootloader is still there. The manual reset method is just about getting the timing right.

On my custom made PCB the RST pin is decoupled to ground with a 100nF (bypassed with a switch for manual reset) and is set high via a 10K resistor.You are right, if I get the correct timing using the manual reset switch I can get it to program, but only with Duemilanove w/ ATmega328 bootloader.

The decoupling capacitor is there to provide a low-state to the RST pin at power-up, until the VCC stabilizes. It seems that the Arduino serial converter cannot properly reset the target board. Is there any need for a series capacitor? I have seen the Arduino schematic and it's already there...

On my custom made PCB the RST pin is decoupled to ground with a 100nF (bypassed with a switch for manual reset) and is set high via a 10K resistor.

The decoupling capacitor is there to provide a low-state to the RST pin at power-up, until the VCC stabilizes. It seems that the Arduino serial converter cannot properly reset the target board. Is there any need for a series capacitor? I have seen the Arduino schematic and it's already there...

And that is precisely what you need to do - connect the capacitor not to ground, but to the RTS or DTR line on the USB to TTL chip.

The ATMega chips are designed to have built-in power-on logic and do not require a delay capacitor as such on the Reset line. In fact, IIRC it needs to be not present for the ISP to function.

Remove the capacitor you have between reset and ground. All you need is a series cap between the serial programmer DTR line and the Reset pin.

The series cap changes a Low signal from DTR into a pulsed signal that allows the pullup to bring Reset High again afterwards. The 'decoupling' cap you have connected is interfering with the timing of the pulse that the series cap effects.

Another quick question: I don't have any AVCC to GND capacitor. How this can affect the ADC performance? I'm using all eight ADC inputs.

You should have decoupling on the AVCC and the Aref pins. Without it you *may* have issues with noise introduced via the power rails. If you find you get erratic ADC readings or other strangeness then the first suspicion would be the lack of decoupling. If you can add them then do.

Just remember that you will need that series cap if using a separate USB>Serial adapter, if it doesn't already have one; e.g. most PL2303 or CP2102 modules.

A little clarification there - it is not the USB to TTL adaptor that has the series capacitor, the FTDI adaptors certainly do not have one. The capacitor becomes part of the interface on the ATMega board to whatever adaptor is used.

What the "bogus" PL2303 or CP2102 modules lack is having the RTS line brought out to the interface pins. On the six pin versions which were apparently put out by some poor sod who simply had no idea what he was doing, it is possible to modify them with some track-work to repair the blunder, but this has nothing to do with the capacitor; you do not add the capacitor to the USB to TTL module, it goes on the MCU board.