Help: Crystal Oscillator is not working.
-
ProfessorCagan
- Posts: 23
- Joined: 22 Dec 2020
Help: Crystal Oscillator is not working.
I've been building this 8bit computer and I'm kinda lost. I've been following Ben Eater's videos on it (as it is his kit,) and when I tried to use the crystal oscillator, my CPU would not output anything, I tried make a timer with a 555 chip, and that pulses only sometimes.
Lastly, only some of the CPU's address pins work, I checked the voltages with my meter, they never went high while the other would go low and high like they should.
What am I doing wrong?
Lastly, only some of the CPU's address pins work, I checked the voltages with my meter, they never went high while the other would go low and high like they should.
What am I doing wrong?
- BigDumbDinosaur
- Posts: 9425
- Joined: 28 May 2009
- Location: Midwestern USA (JB Pritzker’s dystopia)
- Contact:
Re: Help: Crystal Oscillator is not working.
Can you post a schematic (in monochrome) of your circuit? Also, I don't see any bypass capacitors in your circuit. Without the schematic we probably can't offer too much help?
x86? We ain't got no x86. We don't NEED no stinking x86!
-
ProfessorCagan
- Posts: 23
- Joined: 22 Dec 2020
Re: Help: Crystal Oscillator is not working.
BigDumbDinosaur wrote:
Can you post a schematic (in monochrome) of your circuit? Also, I don't see any bypass capacitors in your circuit. Without the schematic we probably can't offer too much help?
I'm following Ben Eater's video series, so I hadn't made a schematic for it.
He hadn't used any capacitors (yet, the kit does come with them) so I hadn't either. I can make one, but I'll have to reinstall the software I used, I lost it after some computer issues I had earlier this month.
Re: Help: Crystal Oscillator is not working.
You seem to be feeding the clock into pin 35; it should be connected to pin 37.
-
ProfessorCagan
- Posts: 23
- Joined: 22 Dec 2020
Re: Help: Crystal Oscillator is not working.
hoglet wrote:
You seem to be feeding the clock into pin 35; it should be connected to pin 37.
Oops, yes, I did. I fixed that and plugged it all up, but none of the LEDs are lighting up (they're connected to the address pins.)
I tried resetting the cpu with the button on the left (connected to pin 40,) with no luck.
Re: Help: Crystal Oscillator is not working.
ProfessorCagan wrote:
I can make [a schematic], but I'll have to reinstall the software I used, I lost it after some computer issues I had earlier this month.
As for the issue at hand, I'm guessing you don't have an oscilloscope (which makes debugging things like this really easy), but do you have a multimeter? If so, start by checking all the voltages on all the power and ground pins, and then check the voltages on signal pins that are pulled up and pulled down. (Check both levels for switched pins like RESET.) If you don't have a meter, you can use the LEDs just as they are to check high lines, and wire a resistor and LED from +5V to check the low lines.
I would personally also wire up the data bus with pull-ups and pull-downs to generate a NOP, as that will produce more predictable behaviour from the CPU. (I think that Ben Eater demonstrates this in one of his videos.) And again, check the voltages on the pins carefully.
If you really get blocked on this, and can't get access to a 'scope, it might be worth building a little hand-stepped clock circuit from a button and a flip-flop, since that can easily be tested with LEDs, and then using that to drive the rest of the circuit at a speed visible on LEDs to see if there are problems there.
Incidentally, the really cheap (often under $20) digital oscilloscope kits like this one (image below, to get the idea) are a pain to use for any serious work, but probably good enough for some very basic debugging of relatively low-speed (1 MHz) circuits like yours. You can set up a CPU with a NOP generator and confirm that clock is running at 1 MHz and the address lines are changing at successively halved rates as you move up the address bus from A0.
Curt J. Sampson - github.com/0cjs
-
ProfessorCagan
- Posts: 23
- Joined: 22 Dec 2020
Re: Help: Crystal Oscillator is not working.
cjs wrote:
ProfessorCagan wrote:
I can make [a schematic], but I'll have to reinstall the software I used, I lost it after some computer issues I had earlier this month.
As for the issue at hand, I'm guessing you don't have an oscilloscope (which makes debugging things like this really easy), but do you have a multimeter? If so, start by checking all the voltages on all the power and ground pins, and then check the voltages on signal pins that are pulled up and pulled down. (Check both levels for switched pins like RESET.) If you don't have a meter, you can use the LEDs just as they are to check high lines, and wire a resistor and LED from +5V to check the low lines.
I would personally also wire up the data bus with pull-ups and pull-downs to generate a NOP, as that will produce more predictable behaviour from the CPU. (I think that Ben Eater demonstrates this in one of his videos.) And again, check the voltages on the pins carefully.
If you really get blocked on this, and can't get access to a 'scope, it might be worth building a little hand-stepped clock circuit from a button and a flip-flop, since that can easily be tested with LEDs, and then using that to drive the rest of the circuit at a speed visible on LEDs to see if there are problems there.
Incidentally, the really cheap (often under $20) digital oscilloscope kits like this one (image below, to get the idea) are a pain to use for any serious work, but probably good enough for some very basic debugging of relatively low-speed (1 MHz) circuits like yours. You can set up a CPU with a NOP generator and confirm that clock is running at 1 MHz and the address lines are changing at successively halved rates as you move up the address bus from A0.
I also tried to make sure the oscillator was working correctly with the scope, but I couldn't get anything out of it. I will try again with the methods you've listed here, will report back, thank you!
-
ProfessorCagan
- Posts: 23
- Joined: 22 Dec 2020
Re: Help: Crystal Oscillator is not working.
cjs wrote:
ProfessorCagan wrote:
I can make [a schematic], but I'll have to reinstall the software I used, I lost it after some computer issues I had earlier this month.
As for the issue at hand, I'm guessing you don't have an oscilloscope (which makes debugging things like this really easy), but do you have a multimeter? If so, start by checking all the voltages on all the power and ground pins, and then check the voltages on signal pins that are pulled up and pulled down. (Check both levels for switched pins like RESET.) If you don't have a meter, you can use the LEDs just as they are to check high lines, and wire a resistor and LED from +5V to check the low lines.
I would personally also wire up the data bus with pull-ups and pull-downs to generate a NOP, as that will produce more predictable behaviour from the CPU. (I think that Ben Eater demonstrates this in one of his videos.) And again, check the voltages on the pins carefully.
If you really get blocked on this, and can't get access to a 'scope, it might be worth building a little hand-stepped clock circuit from a button and a flip-flop, since that can easily be tested with LEDs, and then using that to drive the rest of the circuit at a speed visible on LEDs to see if there are problems there.
Incidentally, the really cheap (often under $20) digital oscilloscope kits like this one (image below, to get the idea) are a pain to use for any serious work, but probably good enough for some very basic debugging of relatively low-speed (1 MHz) circuits like yours. You can set up a CPU with a NOP generator and confirm that clock is running at 1 MHz and the address lines are changing at successively halved rates as you move up the address bus from A0.
Ok, I checked the voltages on Power and Ground, they were fine, I checked all the others that were pulled high or low, also fine. At one point some of the LEDs came on, but I can't tell if that's meant to be correct.
I did try making a NOP, and I think I did it right https://i.ebayimg.com/images/g/JTkAAOSw ... to go by.
I checked the lines again, and the data pins all were all in the Millivolt (different amounts) range (as was pin 6,) and pins 2 and 4 were 5 volts.
I couldn't get a frequency at all out of my scope.
I've also drawn a schematic, please excuse my handwriting.
Re: Help: Crystal Oscillator is not working.
First, if you can trim your quotes to just what you're replying to (if you quote anything at all) that would be kind to the readers of this thread. If you're not sure whether you need to quote something or not, err on the side of not quoting; people can always just scroll back to read previous posts in the thread.
Also, inline links are great, but you got the URL syntax slightly wrong; it's "url=..." in brackets, not "url" followed by a close bracket and the URL after that. You can use the Full Editor and Preview buttons to preview your work before posting.
Well, the meter generally won't give useful results on a pin that has a changing signal unless it's changing really slowly, at speed even humans would have no problem seeing. What you will see for a changing signal will depend on the meter, but I would not be surprised to see a pin that's on 75% of the time and off 25% of the time just show up as "5 V" or similar.
Ah! Well, that could be because you're having difficulty with the 'scope, or it could be because your oscillator isn't working. That would definitely be step 1 to work out; no amount of debugging on the 6502 will help if it's not getting a clock signal.
You might start by checking to see if your 'scope has a test point that generates a signal (typically 1 kHz). Most do, as it's necessary to calibrate the probe. If it does, you want to start by getting that working, and playing with the horizontal (time base), vertical (voltage level) and maybe trigger settings a bit so that you know in what direction you need to twiddle those to display a 1 MHz 5 V clock waveform on the screen.
That's this image, right?
No, that is definitely not the way you want to do it! You should never connect pins used for ouput directly to Vcc or ground; this can cause a short circuit through the chip trying to drive the pin, potentially accompanied by smoke, fire, and other such exciting things. Though in theory the CPU shoudn't be trying to drive the data pins when it's being driven by a NOP generator, this is difficult to guarantee.
Instead, connect the data pins to Vcc or ground through a resistor. (330 ohms to 1 kohm are typically good values.) These are referred to as "pull-up" (when connected to Vcc) and "pull-down" resistors; they'll bring the line high or low when it's not being driven by another device, but otherwise let that other device bring the line to its preferred value.
Also, it looks as if you've removed the reset button in your current build. You'll want a at least a pull-up on the reset line to keep it high when the system is running, and also you should put back the button or at least mention that you're using a jumper wire manually to bring the reset line low before you start testing, since without a reset signal after power-up the CPU may not start operating.
On a schematic diagram you need not include all the pins, nor put them in the same order that they're used on the chip, and it will be clearer to leave off unused pins. You'll also need either pin names or pin numbers on each connection to an IC on your schematic; it's good to include both as that will help to find errors. I've attached an example, again from Garth Wilson's site. The IC on the top is a 6522 VIA, but it's also a large 40-pin chip, like the 6502. You'll note that he shows here only the 21 pins (of the 40 total) that are of interest for the particular bit of circuitry he's explaining. (There's, e.g., a whole set of data bus lines that are not shown.)
Also, inline links are great, but you got the URL syntax slightly wrong; it's "url=..." in brackets, not "url" followed by a close bracket and the URL after that. You can use the Full Editor and Preview buttons to preview your work before posting.
ProfessorCagan wrote:
I do have a meter, and that very same scope. I've already checked some address pins with the meter, but some stay high always, and some stay low always.
Quote:
I also tried to make sure the oscillator was working correctly with the scope, but I couldn't get anything out of it.
You might start by checking to see if your 'scope has a test point that generates a signal (typically 1 kHz). Most do, as it's necessary to calibrate the probe. If it does, you want to start by getting that working, and playing with the horizontal (time base), vertical (voltage level) and maybe trigger settings a bit so that you know in what direction you need to twiddle those to display a 1 MHz 5 V clock waveform on the screen.
ProfessorCagan wrote:
I did try making a NOP, and I think I did it right if this image is anything to go by.
Instead, connect the data pins to Vcc or ground through a resistor. (330 ohms to 1 kohm are typically good values.) These are referred to as "pull-up" (when connected to Vcc) and "pull-down" resistors; they'll bring the line high or low when it's not being driven by another device, but otherwise let that other device bring the line to its preferred value.
Also, it looks as if you've removed the reset button in your current build. You'll want a at least a pull-up on the reset line to keep it high when the system is running, and also you should put back the button or at least mention that you're using a jumper wire manually to bring the reset line low before you start testing, since without a reset signal after power-up the CPU may not start operating.
Quote:
I've also drawn a schematic, please excuse my handwriting.
Curt J. Sampson - github.com/0cjs
Re: Help: Crystal Oscillator is not working.
There's a trick to adding up a column of numbers: add it up twice, one from the top down, and then from the bottom up. Similarly, some people like to fill in forms from the bottom up. The reason for trying to find an unconventional approach is to force yourself to look carefully at everything and not to make assumptions. So, I'd suggest trying to do the same with checking the circuit you've built. Of course you believe you built it correctly, but as it's not working there is certainly something awry. A wiring error is most likely, so find a way to check every pin and every end of every wire: does it go where it should, and nowhere else? Does it make a good connection at every point?
Oh, and double-check that all the parts are in the right way around, and you are reading the pins off in the right order.
The clock is crucial. Those little oscillators only need a supply and they will oscillate. With no other connections at all, you should see the clock going.
At some point you might start to wonder if the parts you have are good or bad. That's where it's very handy to have some spares. As a beginner, you might not have any spares, but if you think you might persevere with this hobby - and it can be very rewarding - it can be cost-effective to buy things in twos and threes, especially if postage is significant. And be sure to buy from reputable outlets: you might save a dollar or two buying from ebay, but you could cost yourself hours of debugging, or even cost yourself all your enthusiasm for the hobby, if it turns out you buy bad parts.
Oh, and double-check that all the parts are in the right way around, and you are reading the pins off in the right order.
The clock is crucial. Those little oscillators only need a supply and they will oscillate. With no other connections at all, you should see the clock going.
At some point you might start to wonder if the parts you have are good or bad. That's where it's very handy to have some spares. As a beginner, you might not have any spares, but if you think you might persevere with this hobby - and it can be very rewarding - it can be cost-effective to buy things in twos and threes, especially if postage is significant. And be sure to buy from reputable outlets: you might save a dollar or two buying from ebay, but you could cost yourself hours of debugging, or even cost yourself all your enthusiasm for the hobby, if it turns out you buy bad parts.
- GARTHWILSON
- Forum Moderator
- Posts: 8773
- Joined: 30 Aug 2002
- Location: Southern California
- Contact:
Re: Help: Crystal Oscillator is not working.
cjs wrote:
Also, inline links are great, but you got the URL syntax slightly wrong; it's "url=..." in brackets, not "url" followed by a close bracket and the URL after that. You can use the Full Editor and Preview buttons to preview your work before posting.
Quote:
and I think I did it right https://i.ebayimg.com/images/g/JTkAAOSw ... to go by.
Quote:
and I think I did it right if this image is anything to go by.
Quote:
You might start by checking to see if your 'scope has a test point that generates a signal (typically 1 kHz). Most do, as it's necessary to calibrate the probe. If it does, you want to start by getting that working, and playing with the horizontal (time base), vertical (voltage level) and maybe trigger settings a bit so that you know in what direction you need to twiddle those to display a 1 MHz 5 V clock waveform on the screen.
1MHz should show up (although not sharply) even with a cheap probe that's not really worthy of a 'scope beyond audio use; but assuming you have real scope probes, make sure you're on the x10 setting. On the x1 setting they're only good for a couple of MHz, definitely nowhere near what you need to show a 1MHz square wave as anywhere near square. Decent probes aren't cheap (even the cable they use is very special, not normal coax of any kind); so take care of them. Even for a 40MHz 'scope (which is probably the slowest of the real 'scopes these days), a pair of probes will cost $40+.
I would make sure the oscillator can has +5V and ground, and then see if it has output, even without a load, ie, with the output going nowhere in case wherever it's going has a short someplace.
Quote:
ProfessorCagan wrote:
I did try making a NOP, and I think I did it right if this image is anything to go by.
Quote:
Also, it looks as if you've removed the reset button in your current build. You'll want a at least a pull-up on the reset line to keep it high when the system is running, and also you should put back the button or at least mention that you're using a jumper wire manually to bring the reset line low before you start testing, since without a reset signal after power-up the CPU may not start operating.
The processor needs a clean, de-bounced reset signal to get started right. Without it, I could not predict what it might do, even with the data lines hard-wired as $EA (the NOP op code). I doubt it would damage it, but there's probably no sense in trying to go further in debugging before this is taken care of. The Reset section of the 6502 primer, at http://wilsonminesco.com/6502primer/RSTreqs.html, has some circuits you can use. Do go through the entire 6502 primer though. It should save you a lot of time and headaches and dramatically improve your chances of success. It is logically organized in 22 sections (pages). I initially wrote it many years ago to answer questions and problems that kept coming up on the forum; but I keep updating it (in fact I just went through it last week and fixed all the links that had gone dead).
Quote:
Quote:
I've also drawn a schematic, please excuse my handwriting.
LOL, you would have to show my worst one!
There's a method to my madness. Part of the idea is to show anyone else thinking of doing their own website that you don't have to have fancy software. (Actually, there are parts of every schematic-capture software I've tried that I don't like, so I still do my schematics by hand, on velum up to 18x24", before I lay out by boards with CAD, which have been up to 500 parts, and using this method, I don't get any errors.) I make my web pages with a plain text editor, writing directly in html, and I don't use any CSS.
http://WilsonMinesCo.com/ lots of 6502 resources
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?
- GARTHWILSON
- Forum Moderator
- Posts: 8773
- Joined: 30 Aug 2002
- Location: Southern California
- Contact:
Re: Help: Crystal Oscillator is not working.
BigEd wrote:
There's a trick to adding up a column of numbers: add it up twice, one from the top down, and then from the bottom up. Similarly, some people like to fill in forms from the bottom up. The reason for trying to find an unconventional approach is to force yourself to look carefully at everything and not to make assumptions. [...]
Quote:
At some point you might start to wonder if the parts you have are good or bad. That's where it's very handy to have some spares. As a beginner, you might not have any spares, but if you think you might persevere with this hobby - and it can be very rewarding - it can be cost-effective to buy things in twos and threes, especially if postage is significant. And be sure to buy from reputable outlets: you might save a dollar or two buying from ebay, but you could cost yourself hours of debugging, or even cost yourself all your enthusiasm for the hobby, if it turns out you buy bad parts.
...and if it has been your job and you've been in it for decades and your employer has given you thru-hole parts they're not using anymore in production or even fed you with lots of parts for prototyping so you can get a jump on new projects, you may have a whole room for your own inventory, or at least a large closet full! I must have a few thousand ICs and a third of a million parts altogether.
http://WilsonMinesCo.com/ lots of 6502 resources
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?
Re: Help: Crystal Oscillator is not working.
GARTHWILSON wrote:
LOL, you would have to show my worst one! :lol: That one is in my tiny 3x5 QRG (quick-reference guide) ring binder....
GARTHWILSON wrote:
The processor needs a clean, de-bounced reset signal to get started right. Without it, I could not predict what it might do, even with the data lines hard-wired as $EA (the NOP op code).
Oh, and it just occurred to me: for every device on the board, connect a 0.1 μF capacitor from the power pin row to nearby ground. (You already have both power and ground on both sides of the board, which is good.) This is far from perfect bypassing (everybody well tell you that the cap should be as close as possible to the power pin etc. etc.), but even at some distance away from the power pins (a distance that would have some people here yelling at me, I'm sure :-)) I've found this makes a dramatic difference in the signal quality of the IC outputs.
I would also move the oscillator up on to the same board as the CPU: just move the CPU a bit more towards the centre, put the oscillator at the end of it with the Φ2 input pin, and hand-cut a short little jumper to connect the two. This will massively reduce the distance the clock signal has to travel and also reduce the power and ground distance between the oscillator and the CPU, which is a rough heuristic for some other things that make for a more reliable design.
Curt J. Sampson - github.com/0cjs
-
ProfessorCagan
- Posts: 23
- Joined: 22 Dec 2020
Re: Help: Crystal Oscillator is not working.
Oh my! Thanks for all your help so far everyone!
I'm sorry I made so many mistakes, I'll start with the oscillator, the scope I have does indeed include a testing signal.
I do have some spare parts but it may take a while to get more, being a broke college student is fun!
So, if I have this right from reading the replies, I need to:
1. Ensure I'm getting a clock signal from the oscillator (with x10 set on my probe.)
2. Move the oscillator closer to the CPU.
3. Reconnect my reset button (or should I try out those reset circuits that GarthWilson linked?)
4. Include a 0.1 μF capacitor connected to power and ground for every device on the board.
5. Redo the NOP with pull-up/down resistors.
6. Test output again.
Am I correct in all this?
Thank you all again for your help so far, I was starting to think I wouldn't get anywhere.
I'm sorry I made so many mistakes, I'll start with the oscillator, the scope I have does indeed include a testing signal.
I do have some spare parts but it may take a while to get more, being a broke college student is fun!
So, if I have this right from reading the replies, I need to:
1. Ensure I'm getting a clock signal from the oscillator (with x10 set on my probe.)
2. Move the oscillator closer to the CPU.
3. Reconnect my reset button (or should I try out those reset circuits that GarthWilson linked?)
4. Include a 0.1 μF capacitor connected to power and ground for every device on the board.
5. Redo the NOP with pull-up/down resistors.
6. Test output again.
Am I correct in all this?
Thank you all again for your help so far, I was starting to think I wouldn't get anywhere.
Re: Help: Crystal Oscillator is not working.
Well, step 0 is just to get your 'scope working properly if you can manage that, which is best done from the test signal if you have one since that really should be working. Once you've got that available, you'll have a much easier time probing everything else.
Curt J. Sampson - github.com/0cjs