Thanks for that info, I think I understand what the Atmega needs now, I spent the whole of last night going through the schematic and tracing all contacts on the board to ensure that everything is connected correctly, which it is.
A couple of things I have noticed though…
On the original circuit that this design is based on the reset line coming from pin 1 on the atmega is connected directly to the ISP and goes nowhere else. But on the schematic that Bigglez revised for me the Reset line also goes to pin one on the 6-pin connecter on the board. I don’t think this is enough to cause any errors but I was just wondering why this was happening?
Also, the original PCB used a 330ohm resister for the LED whereas the new circuit uses 1ko resistor instead, what is the reason for this?
I also changed pins 2 (RXD) 3(TXD) and 4(INT0) on the Atmega as they were reversed for some reason. But I still can’t get the circuit to work and it’s beginning to annoy me!
I am going to try and use winscope tonight to try and probe the crystal to see if it is operating correctly, but apart from that i’m pretty much stumped
You might want to invest in a breadboard, and try breadboarding a few simple AVR circuits (possibly including an external crystal - I’ve been fine with crystals up to 8MHz on breadboard, I’ve not tried faster speeds on breadboard - they do have larger parasitic capacitances than a PCB and can get a bit dodgy with high speed circuits). It’s so much faster to experiment that way. Also, go to ebay, and look for a reasonable oscilloscope - you should be able to get something suitable for about £60 (20MHz dual trace in good condition and at least one probe).
Yep, I think some breadboard is going to be a good idea…
Spent last night going over the circuit again, still can’t figure out what could be wrong, i replaced the crystal and checked all the contacts and they all seem fine.
The high and low byte fuses that i’m programming into the Atmega8 are stopping me from being able to program the chip further, is this because as soon as I program these fuses the AVR is expecting to see an external crystal?
It’s my understanding, most microcontrollers will not even program without a time source. Some get their time source when programming from the host computer.
It’s like a platoon requiring a cadence to go somewhere. No cadence…no marching.
I’m not a Atmega guy…so any other speculation would just be that.
Now you have breadboard, it’s also worth doing some experimenting with raw logic - it’s highly instructive playing with gates and LEDs to better learn digital electronics. My first real electronics project was a learning one - I built a computer driven nixie display with nothing but 4000-series CMOS logic ICs to receive and send RS232 data - i.e. I built the UART out of gates and shift registers - resulting in a eurocard stuffed full of chips, rather than using a microcontroller. It was extremely instructive and taught me a lot of things. (I actually used that UART to bootstrap my homebrew Z80 computer - load the first ROM image into RAM via a CPU-less UART, then have the Z80 flash its own flash ROM).
konguk:
On the original circuit that this design is based on the reset line coming from pin 1 on the atmega is connected directly to the ISP and goes nowhere else. But on the schematic that Bigglez revised for me the Reset line also goes to pin one on the 6-pin connecter on the board. I don’t think this is enough to cause any errors but I was just wondering why this was happening?
Greetings konguk,
The AVR reset line needs two things (that were not on your
original schematic):
(1) The Reset line should be tied high to prevent nuisance tripping.
(2) An AVR programmer needs access to the Reset line to
initiate a handshake (that transfers the program code to the
target AVR).
konguk:
Also, the original PCB used a 330ohm resister for the LED whereas the new circuit uses 1ko resistor instead, what is the reason for this?
Modern LEDs are very bright on just a few milliamps, I
increased the LED ballast resistor to 1k0 to reduce the
LED brightness. If you want a beacon instead of a signal
change it back to 330R.
Once again, you have all the pieces in play to get that
LED to blink. Doing so will confirm the hardware, the
programming sequence and adapter, and that your
“blinky LED” code is solid. The AVR can always be
reprogrammed with the project’s code once you clear
I am a little confused with this circuit, is this meant to be a standalone circuit that outputs the sine wave? That I then connect to the xtal pin on the Atmega while i attempt to reprogramme the fuse bytes?
konguk:
I am a little confused with this circuit, is this meant to be a standalone circuit that outputs the sine wave? That I then connect to the xtal pin on the Atmega while i attempt to reprogramme the fuse bytes?
How is it powered?
Greetings konguk,
Although it’s winston’s circuit and post, I can give you a few hints.
The element labeled U1 is a logic gate biased to be an inverting
linear amplifier by the resistor R1. Just about any CMOS inverter
gate will do, CD4069 has six of these in one package.
The IC does require a DC supply and ground, which is missing
from the diagram by convention. A 5V supply would make the
circuit compatible and easily connected directly to the XTAL1 pin
of an AVR, leaving XTAL2 floating.
The crystal element and capacitors should be familiar,
this the same arrangement as used with the AVR, where
the U1 element and resistor are actually inside the AVR chip.
konguk:
I am a little confused with this circuit, is this meant to be a standalone circuit that outputs the sine wave?
bigglez said it pretty much all, but this generates a square wave.
(Well, in the ideal world it would make a square wave, but in the real world, the rise and fall times of signals aren’t infinitely fast, so if you actually look at the wave form you’ll see there’s a definite rise and fall time, and also you’ll note a little “ringing” in the signal caused by stray capacitances and inductances resonating away. But that’s not important right now - but as you progress, you may find these things mattering.)
Just been looking at the fuse byte settings I have applied in the meantime and have managed to come up with these settings that I think are activated by applying the following fuse bytes
High Fuse - 0xc9
Low Fuse - 0x9f
Ext Crystal / Resonator High Freq.; Startup time:16k CK +0ms
I’ve just had a brainwave, or maybe my brains finally started working! Either way, maybe the capacitors i’m using are the incorrect rating for the 12mhz crystal i’m using…
I’ve used the 74HC14 (schmitt trigger inverter) in the past for building the crystal oscillator circuit, with R1 ~200k, and C1/C2 as appropriate for the crystal (look for the load capacitance on the crystal’s datasheet)
74LS is low power schottky TTL - (Farnell still sell 74LS* parts?)