This is my first time post and I am still pretty new to the Arduino community as well as the Arduino device itself. I have written plenty of code using the Arduino IDE and Arduino Uno so feel very confident from this side. Now I have tried to make my own circuit, to which the ATMEGA328P will be the brains of.
My first goal is to be able to have the circuit designed with a 10 pin port to which I can program the board and interact with it in the same way that I can when it is on the Arduino Uno.
Currently I have a circuit set up as follows:
The main parts being the ATMEGA328P and the section I labeled "Prog" which will be where the programming ribbon cable will get plugged in. I show the entire circuit as I am really not sure my problem so figured it is best to share all information when asking my questions.
Now I plug in an ATMEL 51 AVR programmer (Amazon link here), using the 10 pin ribbon cable to my port and try to upload a blank sketch (the one in the examples called "BareMinimum" but get the following errors:
avrdude: auto set sck period (because given equals null)
avrdude: warning: cannot set sck period. please check for usbasp firmware update.
An error occurred while uploading the sketch
avrdude: error: program enable: target doesn't answer. 1
avrdude: initialization failed, rc=-1
Double check connections and try again, or use -F to override
avrdude done. Thank you.
So something is preventing the code from uploading. I have tried using the "Upload" and "Upload from Programmer" options and same results.
What I have tried
I have tried using my programmer with a spare Arduino Uno, plugging into the 6 pin header and my sketch uploads without issue. This helps give me confidence that the driver and arduino software itself is not the problem.
When plugging the 10 pin ribbon cable, do I need to supply anything else to the circuit or do the 5 volts from the USB power the atmega328p? Are there any other "internal hookups" required for the atmega328p to receive the upload? I did post my circuit above but in my test set up I literally only have the programmer ribbon cable plugged in. Do I need more than this?
I greatly appreciate any help that I receive for my problem as I have tried for weeks to get this to work but am unsure where I am making my mistakes.
Can you post a schematic, so we can see how its all connected ?
How many layers there? Is there a ground plane? It looks like not. Also the traces look extremely thin. Digital circuits are not very forgiving of layout.
Does this board exist yet? Or do you have the circuit prototyped?
What is the thing you call "antenna"?
I have updated my original post to include schematic as well. Thanks!
I only have one layer per side (I do use the top and bottom sides of the board). No ground plate. How thick do you recommend the traces are?
The board does exist. I sent the file you see to a company that produced it for me. If I find issues in the circuit, I can by all means update and get more made fairly easily.
Thanks in advance!
Where did the ATmega328P you are trying to program come from ?
Did you intend to run the ATmega328 without a crystal\reasonator as the clock source ?
I got it from here: https://www.amazon.com/gp/product/B07JJX961X/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&psc=1
It does state it comes with the bootloader already on it which is good. I guess do I need the crystal / reasonator for it to work? I think I am coming to the conclusion that the answer to this question is yes from what I am reading.
They might well come with the bootlaoder fitted, but have been probably been programmed to need a crystal\reasonator connected. If that is so you wont be able to use an ISP programmer or the bootloader until there is an external clock source.
I believe this guys' youtube video accurately shows how to wire up the crystal then?
I will order those parts and try it out! Thank you for your assistance! I will report back of success or failure for future readers.
Suggest traces be >= 25 mil, power 50 mil.
The 22pF capacitors need to go to GND.
Vcc pins need decoupling.
Understood about the thicker traces and thank you for this!
For the other two comments you posted "The 22pF capacitors need to go to GND. Vcc pins need decoupling." Do I need to do more than the circuit I posted above from the YouTube video? Sorry but I just want to have it all planned before I buy my extra components. They have their capacitors hooked to OSC1 and OSC2, is this not right?
There should normally be a capacitor, 100nF, on the AREF pin to ground.
The trace that connects the two 22pF capacitors needs to go to GND (0V).
Each of 7, 20 and 21 need a 100nF ceramic capacitor to GND.
Thank you both! I think I understand now. I will order the components and try it out on the breadboard before I update my physical circuit board! and will let you know the results.
Baffled here. Why are you consulting YouTube for this, when the entire UNO or Nano design is freely available online? Also the chip data sheet, which has all the information about the clock circuit...
Also turn off the computer and pick up some commercial boards and actually look closely at them.
Sadly, it has become the Modern Way.
One can thereby avoid reading carefully written text, device data sheets or standard, unambiguous schematics, and expect forum members to explain why the result does not work, and to fill in all the details missing from the youtube videos.
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.