I am making a PCB with arduino and I have a simple question. I bought Atmega 8 (they didn't have the 168) and 8MHz crystal. The problem is with the capacitors that are around the crystal. They should be 22pF but because they didn't have them in store I bought 27pF. Will this work? Or is it better to use internal clock?
Will this work?
That should work ok. The optium crystal padding capacitor size varies a little with different manufactur's crystals anyway.
Lefty
I always use 27pF anyway and have no trouble.
I managed to do the most idiotic thing on the world. I am trying to program the blank chip with my existing arduino. When I was soldering the X3 header to my existing arduino, I managed to destroy the X3 pin that is connected to reset durring programming. So now the whole thing isn't working. Is there some other place where I can solder that wire? Or make this work some other way?
I am tallking about the red connection.
So I finaly got it working with this method:
I wired it correctly but when I test the chip with the avrdude I get this:
iMac:bin roli$ ./avrdude -p m8 -P /dev/cu.usbserial-A7006S7C -c avrisp -b 19200
avrdude: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.02s
avrdude: Device signature = 0x1e9406
avrdude: Expected signature for ATMEGA8 is 1E 93 07
Double check chip, or use -F to override this check.
avrdude done. Thank you.
Funny thing is that if I put m168 instead of m8 the thing works. Problem is that I am trying to pgrogram atmega8 not atmega168. Atmega168 is in my arduino (that is working as a programmer) and I want to write the bootloader to Atmega8 (Atmega8-16PU). What should I do now?
The atmega8 has a different boot loader to the atmega168, so you need that to be in your sketch. If it works with a atmega168 then it would suggest that you are trying to program the atmega8 with the atmega168 bootloader.
I haven't used the atmega168 but I have used this technique on the atmega168 and the atmega328.
For some reason I can't understand what you are saying.
Did a little strange thing - I unplugged the +5V from the Atmega8 (that I am trying to programm) and strangely I got the same error. If I am correct it shuld give some error.
What I am saying is:-
that if it works with the atmega168 the same sketch
WILL NOT WORK with the atmega8.
Hmmm? One arduino (with atmega168) has a sketch uploaded. The arduino now works as an AVR programmer. With this I can now programm any AVR chip. The other chip that I am trying to programm is Atmega8 - but for some reasons this whole thing isn't working.
EDIT: Why isn't writting the bootloader as simple as putting the chip into arduino board and hitting Burn bootloader?
Why isn't writting the bootloader as simple as putting the chip into arduino board and hitting Burn bootloader?
It IS, if you're using one of the supported standard AVR ISP programmers connected to the ISP header of the chip.
I think you will have to disable auto-reset on the arduino being used as a programmer (call it PGMR) in order to program another Arduino (call it TARGET.) Otherwise, running avrdude will reset PGMR and it will end up in the PGMR bootloader, instead of the sketch talking to TARGET. The instructable you link to uses a BBB, and is probably from the time period before the BBB had auto-reset...
I tryed disabling the auto-reset by wiring a 100ohm resistor between +5V and reset. When I run the ./avrdude -p m8 -P /dev/cu.usbserial-A7006S7C -c avrisp -b 19200
I get this:
avrdude: stk500_recv(): programmer is not responding
EDIT: The whole thing was written in 2010 so it should probably work with the new boards.
EDIT2: While it still doesn't work, I think that you may be right.
Finaly! I used another Arduino board (thank god I have two ;D ) to programm the Atmega with this:
http://www.geocities.jp/arduino_diecimila/bootloader/index_en.html#top
Four new Atmega8 Arduinos are ready - they work on a board with the Blink example. I will be realy happy if they work on protoboard too.
EDIT: Yep they work on protoboard with 27ph capacitors. Just another simple question - If I want to power my board via the USB - I don't need any capacitors/voltage regulators?
EDIT2: How does arduino provide +3.3V? Another voltage regulator?
EDIT: Yep they work on protoboard with 27ph capacitors. Just another simple question - If I want to power my board via the USB - I don't need any capacitors/voltage regulators?
No regulator required, USB power from a PC is already +5vdc regulated. Small .1mfd bypass caps at the AVR chips voltage input pins (7 & 20) to ground are always recommended.
EDIT2: How does arduino provide +3.3V? Another voltage regulator?
On Arduino boards using a USB FTDI serial converter chip the 3.3vdc comes from an internal 3.3vdc regulator inside the converter chip. Caution that the 3.3vdc provided this way is limited to 50ma or less or FTDI chip damage can result. On some older boards (at least the RS-232 clone model I have) that didn't use a USB chip, they had a optionally installed 3.3vdc regulator chip that could supply around 100ma or so.
Lefty
You guys seem to know a lot about crystals and caps! Here's a quick question just for curiosities sake: I have a board that did not work until I REMOVED one of the 22pF caps (yes I tried replacing it first and it still didn't work)! So there is just 1 cap connected to the crystal. Any ideas why this could be happening?
You might want to read application note 42:
Depending on the board layout you may have higher capacitance than 27pF. Especially if you have unnecessary long connections that are very close to each other.
Udo
Thanks Udo that is very informative! Especially the section on unbalanced loads since that is what is working for this particular board.