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.
Goal
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.
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
this check.
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.
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?
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.
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.
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?
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.
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.