I bought some material on the net to start working with Arduino. I didn't want to buy an Arduino, since it costs a bit too much IMHO, so I bought an ATMega328P-PU, and made an Arduino on a breadboard. However, when I use my USBasp to program it it says that he can't set sck period (settings are: Arduino Uno as Board, USBasp as Programmer). It says that it has loaded the bootloader/program anyway, so I tried to go on and ignore it. The blink program can be loaded via programmer, but it doesn't blink (I'm using a small lamp, connecting it directly to 5V and ground works). Here I describe the circuit:
First Atmega Pin, Arduino Reset -> 10 kOhm Resistor (Brown, Black, Black, Red, Brown) -> Ground (not GND pin);
1st pin, Arduino Reset -> also to USBasp RST;
7th pin, Arduino VCC -> directly to 5V (and USBasp VCC);
8th, GND -> directly to Ground (and USBasp GND);
9th, XTAL -> to one pin of the 16MHz Crystal Oscillator, and to 22 pF capacitor, which connects to ground (not the pin);
10th, XTAL -> exactly as above, but it's connected to the other pin of the same crystal;
17th, digital 11 -> USBasp MOSI;
18th, dig 12 -> USBasp MISO;
19th, dig 13 -> USBasp SCK, and to the lamp whose other pin goes to ground (neither pin nor direct works), but the lamp needs to be disconnected while loading programs to prevent errors (target not responding);
20th, AVCC, and 21st, AREF -> directly to 5V;
22nd -> directly to ground (not pin).
2 Answers 2
First Atmega Pin, Arduino Reset -> 10 kOhm Resistor (Brown, Black, Black, Red, Brown) -> Ground (not GND pin);
So it's permanently in RESET mode then? How can it ever do anything if you're holding it in RESET all the time?
RESET should be pulled UP by the resistor, not DOWN.
-
That was a nice catch!Mikael Patel– Mikael Patel2016年02月16日 16:06:05 +00:00Commented Feb 16, 2016 at 16:06
The blink program can be loaded via programmer, but it doesn't blink (I'm using a small lamp, connecting it directly to 5V and ground works).
19th, dig 13 -> USBasp SCK, and to the lamp whose other pin goes to ground (neither pin nor direct works), but the lamp needs to be disconnected while loading programs to prevent errors (target not responding);
The lamp needs to be low power (< 20 mA) to work this way. If it uses more power you will burn the MCU pin.
Use a LED and a resistor instead. Or at least use a voltmeter.
21st, AREF -> directly to 5V;
This is not a good idea. Should be capacitor to ground. See for instance Uno schematics.
Cheers!
-
How many Farads? In the schematics I can't find it... By the way, thanks! I'll use my voltmeter.Oxen Eknat– Oxen Eknat2016年02月17日 14:47:50 +00:00Commented Feb 17, 2016 at 14:47
-
Follow the AREF from the upper right connector and there it is 100nF. For more details avrfreaks.net/forum/capacitor-aref-atmega328Mikael Patel– Mikael Patel2016年02月17日 15:19:23 +00:00Commented Feb 17, 2016 at 15:19
-
Ok, i need to buy those... I've only got 22 pF ones. Thanks a lot!Oxen Eknat– Oxen Eknat2016年02月17日 15:24:42 +00:00Commented Feb 17, 2016 at 15:24
can't set sck period
message has to do with the USBasp. I get the same message every time I upload. It will still upload just fine.