atmega328p qtfp standalone problem.. [resolved]

Hello all,

My "standalone circuit" uses an ATMEGA328P QTFP (32pin) it is very simple schematic:

  • Vcc on 4, 6, 18 pin
  • Gnd on 3, 5, 21 pin
  • Cap 100nF thr Vcc and Gnd
  • Resistor 10K thr Vcc and Reset pin n.29
  • Extern Oscillator 16MHz with two cap 22pF

It is programming with USBASP in ICSP mode.

No problem for programming by ARDUINO IDE.

I have write a program for trying this circuit, the program blink a LED and send a text on UART port.

int led = 13;

void setup() {
  pinMode(led, OUTPUT);

void loop() {
  digitalWrite(led, HIGH);
  digitalWrite(led, LOW);

if powered the circuit with 4,52Volt (power from USBASP) it works fine: blink led and send text every 1 second.

if powered with 5Volt (from 7805 or another source) works blink led but doesnt work serial port.

I have tryed with bootloader and without bootload.

I dont know about this strange behavior.

Any can help me to resolve this problem.

Thank you.

How is serial connected? Have you measured voltage on the TX pin during these tests? Maybe try an LED connected to TX to see if it's transmitting.

The serial is connected with USB-Serial converter.

with 5,0Vcc: TX = 4,90-5,02 volt.
with 4,52Vcc: TX = 4,36-4,47 volt.

OK, are you seeing the pin voltage change during serial transmission, to indicate the pin is producing bits of data? Or is it just a steady ~4.5 to 5V? (Which is why I recommended the LED, BTW -- it'll flicker with TX. Might be hard to see the activity with a voltmeter.)

I have used the LED on pin TX with resistor 300ohm, but it is still on when serial works and when serial doesnt work.

With multimeter i have

Vcc=5,0 pin TX change from 4,90 to 5,02 volt and viceversa
Vcc=4,52Vcc pin TX chang 4,36 to 4,47 volt and viceversa.

Thank you.

You do have GND connected between your AVR and the Serial converter, right?
You need the GND connection even if you're getting power from a supply other than the USB port.

Thanks Westfw,

Was a GND problem, I didnt connect GND of USB-Serial converter with GND of the MCU.
I have connected two GND and now it works fine.