Atemag 328P DIP not working but loading sketch!!!

Hello everyone hope you all have a nice day,

So i have a problem ive made myself an PCB to put an 328P on it, to run AD9833 DDS chip.

Now i made a code, i checked it on breadboard with normal Arduino UNO and everything works. I have one of those UNO`s with SMD 328P on them. So my sketch is working perfectly, writing on LCD writing to AD9833 on SPI everything.

Now i bought DIP package 328P and put a bootloader on it usind Arduino as ISP and Burned BOOTLOADER choosing Arduino/Genuino UNO board. Bootloader was burned with success no errors.

Now my scheamtic, which i will add to the end of this post, has an 16 MHz crystal. And i have the 10K resistor for RESET pin and i use the simple approach by shorting RESET to GND until the loading starts and the release RESET short, and Arduino IDE reports UPLOAD DONE. No errors.

But nothing happens, there should be a greating message on LCD nothing, nothing everything draws around 20mA from 8V power supply. Of course i have an 78M05 on board.

Now i know sketch isnt a problem it works. something is wrong with my design, however this is the first time i play with Arduino off board. Im usually used to PIC or TI MCU`s. And to be honest i hate Arduino, but i have some stock of these 328P so i tought i should spend them :slight_smile:

Yes i tried different MCU same results, tried several 16 MHz crystal same result.

Anyone, thanks in advance :slight_smile:

How are you determining that it's not working? Are you sure it's not a problem with the sketch you're uploading?Do you have an LED connected so you can get some very basic feedback about it's state?

220pF is too large for the crystal capacitors.
15K, R6 is too small for the crystal shunt/feedback resistor.

.

OH GOD, i forgot to correct the schematic, hold on here is the newer schematic with proper values. I just made the scehamtic fast and loaded to create PCB, didnt check the valuse, on board i have 22pF SMD capacitors, and for now i removed the 1M resistor.

Well sketch works on normal arduino ergo sketch is not a problem. I tried sketch on NANO UNO DUE it works no problem.

However there is something i forgot to mention, i have no oscillations on either of OSC pins. Could be somehow fuses got stuck to whatever other state?

I just tried to burn bootloader for NANO with 328P and same problem.

Yes once more im positive sketch works no problem, tested it several times on factory made board all is fine. I am certain, well at least 90% i didnt make a mistake in routing the PCB.

7, 20 and 21 should have 100nF decoupling capacitors close to the pins to GND.

Show us a good image of your wiring and the circuit board layout.

Edit
What voltage are you measuring on the regulator output?

Ok so, yes i did not add anytihing to Aref, hmmm yes a bit stupid from me being an engineer who overlooked that......

I have stable 5.00V no ripple, since im powering from high quality linear lab power supply.

I just did some research, some people had problems with certain crystals not starting at all...but then im confused how i get the sketch and bootloader uploaded?

I am using some older crystals, but i have no reason to believe they are defective, maybe they are but no reason to believe in that. I tried 5 different...in different packages.

Ok i know i know, i shouldnt make two posts in a row, but hear me for a minute, or rather read me :slight_smile:

I think i have an idea, i have barely any oscillations on my crystal. Tommorow i will try full swing oscillator. Ill change the low fuse bit to F7 and see what it happens.

I still just dont get it, how the hell does it receives anything correctly from bootloader...... weird....

Show us a good image of your wiring and the circuit board layout.

Have you tried to load a simple sketch (blink) to see if that works.
Remove LCD display when doing so.

The oscillator may not be observable as your scope maybe loading it.

Confirm 'reset' is at 5 volts and you have 5 volts on all Vcc pins.

With power off, ohm out GND to all GND pins.

There might be a microscopic un-etched trace that is shorting out something, ohm out traces to traces with the power off.

.

Are you sure you have your pin-mapping correct?
Your labeling D4..D7 of the portd pins of the 328 does not match Uno "digital pin numbers", for example.

It matches i did correctly mapped all the pins.

Ive found the solution, this morning i connected my Dynamic Signal Analyzer to the oscillator, and put another arduino to continuously restart my PCB arduino. With some waiting time in between, my DSA recorded the events on oscillator.

Out of about 50 sequences, just 3 times oscillator started. So since it is Saturday, i couldn't go and buy the crystal, so iv`e found an old PLC from Siemens i believe and i took it part and guess what, a nice SMD 16.0 MHz crystal, put it on and voila everything works perfectly.

So it is the problem with crystal, the ones i tried with are old, they do work but im guessing impedance matching isn't very good. So ill stick to buying new for Atmel. Never had that problem with TI or Microchip, but who cares, damn thing are dirt cheap :slight_smile:

Thanks for all suggestions, and thanks for the time. Just beware of those older crystals some may not work......

Old is gold, well when it comes the people.

Congrats. . .

.