Schematic finally finished - A few questions.....

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 :frowning:

Its no use, i just can’t get it working!

Think it’s maybe time to go back to the drawing board :slight_smile:

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.

James L

konguk:
Its no use, i just can’t get it working!

Think it’s maybe time to go back to the drawing board :slight_smile:

Greetings konguk,

What happened to the “blinky LED” test firmware? Did you

get that working yet? Seems that expecting everything (uC

code, USB interface, PC side code, homemade PCB) to

work on first pass is an aggressive.

Comments Welcome!

I never got round to uploading it :slight_smile: I realise now that breadboard should have been my starting point - which is where im at right now.

Im building it all up on breadboard so I can troubleshoot it easier…

Updates to follow!

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

the initial testing hurdle.

Comments Welcome!

  .               .
 ---             ---
-----           -----
  |               |
  =  C1           = C2
  |               |
  +-----| []|-----+
  |      XTAL     |
  |               |
  +----/\/\/\/----+
  |     R1        |
  |               |
  +-------|>o-----+
          U1      |
                  +-----------> output

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?

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.

Typical values: R1 = 10M to 15M, C1 and C2 27pF.

Comments Welcome!

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.)

Would it be ok to use a 74Lso4?

I can order one of these from Farnel, although i’m going to have to preorder some parts for a future project to meet their £20 minimum order :frowning:

You really need an unbuffered CMOS inverter for that circuit to work properly.

Leon

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

Brown-out detection enabled

Brown out detection level at VCC=2.7v

Boot flash section size = 1024 words boot start address =$0C00;

Serial program downloading enabled

Am i right in my conversion?

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…

Im off to swap them out :slight_smile:

konguk:
Would it be ok to use a 74Lso4?

Greetings konguk,

No. 74LSxx is not CMOS. Try CD4069 or CD4011 with the

inputs tied together to make an inverter. Any CMOS logical

NOT (inverter) function with a few exception would work.

Comments Welcome!

Peter

konguk:
High Fuse - 0xc9

Low Fuse - 0x9f

Am i right in my conversion?

Greetings konguk,

Yes, that will work. I usually use C9, FF. No reason to enable

the BOD unless you are using it. Also, I use the longest osc.

start up time (64ms).

Comments Welcome!

konguk:
Would it be ok to use a 74Lso4?

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?)

74LS logic is TTL (transistor-transistor logic)

74HC is CMOS

74HCT is TTL-compatible CMOS

I’ve ordered a CD4069 and have attatched a schematic below…

[

Will this circuit work?

When this circuit is built I should be able to inject the XTAL pin on my Atmeg8 with the output of this circuit which will then allow me to reset the fuse bytes. Am i correct so far?](ImageShack - Best place for all of your image hosting and image sharing needs)