Author Topic: Dipping my toe in digital electronics  (Read 12927 times)

0 Members and 3 Guests are viewing this topic.

Offline jdutkyTopic starter

  • Regular Contributor
  • *
  • Posts: 103
  • Country: us
Dipping my toe in digital electronics
« on: October 12, 2020, 05:47:44 am »
So, because I appear to have been driven insane by the solitude of quarantine I have decided to build a little 8-bit computer from chips and bits. The first thing I'm trying to build is the clock generator, but I'm having trouble right off the bat. I've got a full can, 3 MHz crystal oscillator which seemed easy enough to set up, but when I test the output with my scope I get a square wave with a lot of ringing, even after I've attached a couple of TTL loads to it. Should the oscillator output look like this? Is there something I should be doing to the output lines to damp the ringing?
 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11720
  • Country: us
    • Personal site
Re: Dipping my toe in digital electronics
« Reply #1 on: October 12, 2020, 06:41:37 am »
This looks fine. If you are really concerned about the ringing, you can add a series resistor (33-100 Ohm) on the output.
Alex
 
The following users thanked this post: jdutky

Offline Dave

  • Super Contributor
  • ***
  • Posts: 1354
  • Country: si
  • I like to measure things.
Re: Dipping my toe in digital electronics
« Reply #2 on: October 12, 2020, 09:48:27 am »
I second ataradov's recommendation for a series resistor.

You should also make sure that you're probing the circuit correctly. For best signal fidelity, you need to minimize the probe inductance - you need to use a short ground spring instead of the alligator clip wire.
Your scope probes probably came with these springs included.


You should poke the ground spring into a ground right next to the trace you're trying to probe.
<fellbuendel> it's arduino, you're not supposed to know anything about what you're doing
<fellbuendel> if you knew, you wouldn't be using it
 
The following users thanked this post: jdutky

Offline jdutkyTopic starter

  • Regular Contributor
  • *
  • Posts: 103
  • Country: us
Re: Dipping my toe in digital electronics
« Reply #3 on: October 12, 2020, 10:12:35 am »
I will try adding the series resistor, thanks. Sadly, this is being built on a breadboard, so my ground loops are unavoidably long (well, I should be able to shorten the ground loop when examining the direct output of the oscillator, but it gets harder when I start looking at the signals elsewhere in the circuit).

This is my first foray into digital circuits, and I don't quite trust my instruments (I'm using an oscilloscope that is almost 50 years old, and some of my other tools have either been unused for a decade or more, or required some of my inexpert repair work) so I'm always wondering if what I'm seeing is real, if it is an artifact of failing instruments, or if it's just as it should be and I simply don't know it.
 

Online joeqsmith

  • Super Contributor
  • ***
  • Posts: 11835
  • Country: us
Re: Dipping my toe in digital electronics
« Reply #4 on: October 12, 2020, 11:02:28 am »
Could be anything.  Poor construction, probing, termination, equipment....  Your scope should have a calibration output to at least check your 10X probe's compensation. 

Some time back a few of us were playing with a ring oscillator using TTL.   Maybe it will provide you with some ideas.
https://www.eevblog.com/forum/projects/waveforms-in-a-74ls04-ring-oscillator/msg640978/#msg640978

Online tggzzz

  • Super Contributor
  • ***
  • Posts: 20511
  • Country: gb
  • Numbers, not adjectives
    • Having fun doing more, with less
Re: Dipping my toe in digital electronics
« Reply #5 on: October 12, 2020, 11:52:58 am »
So, because I appear to have been driven insane by the solitude of quarantine I have decided to build a little 8-bit computer from chips and bits. The first thing I'm trying to build is the clock generator, but I'm having trouble right off the bat. I've got a full can, 3 MHz crystal oscillator which seemed easy enough to set up, but when I test the output with my scope I get a square wave with a lot of ringing, even after I've attached a couple of TTL loads to it. Should the oscillator output look like this? Is there something I should be doing to the output lines to damp the ringing?

Good for you trying something that is outside your comfort zone!

Start by realising that you have an analogue circuit with inputs/outputs which have restricted valid values.

Key questions:
  • what is the ringing frequency? (I'll bet ~100MHz)
  • are you using decoupling capacitors?
  • what is the construction technique you are using? If solderless breadboards then good luck to you, since they will cause you more problems than the circuit itself
  • what is your probing technique? (I'll bet there is a 6in ground lead in there)

For an introduction to some construction techniques see https://entertaininghacks.wordpress.com/category/homebrew-pcbs/

For an introduction to scope probes, see the references at https://entertaininghacks.wordpress.com/library-2/scope-probe-reference-material/
There are lies, damned lies, statistics - and ADC/DAC specs.
Glider pilot's aphorism: "there is no substitute for span". Retort: "There is a substitute: skill+imagination. But you can buy span".
Having fun doing more, with less
 
The following users thanked this post: jdutky

Online rstofer

  • Super Contributor
  • ***
  • Posts: 9932
  • Country: us
Re: Dipping my toe in digital electronics
« Reply #6 on: October 12, 2020, 02:21:32 pm »
I don't know if you have seen the Ben Eater project but it may provide inspiration.

https://eater.net/8bit/

 
The following users thanked this post: jdutky

Offline Mechatrommer

  • Super Contributor
  • ***
  • Posts: 11712
  • Country: my
  • reassessing directives...
Re: Dipping my toe in digital electronics
« Reply #7 on: October 12, 2020, 03:02:15 pm »
Sadly, this is being built on a breadboard, so my ground loops are unavoidably long...
ditto! there's the problem. breadboard and long ground loop is good recipe for ringing..
Nature: Evolution and the Illusion of Randomness (Stephen L. Talbott): Its now indisputable that... organisms “expertise” contextualizes its genome, and its nonsense to say that these powers are under the control of the genome being contextualized - Barbara McClintock
 

Offline Electro Fan

  • Super Contributor
  • ***
  • Posts: 3283
Re: Dipping my toe in digital electronics
« Reply #8 on: October 12, 2020, 04:04:07 pm »
Might be a breadboard issue, the oscillator, or something else but to make sure the probing/grounding technique itself isn't contributing to the ringing this video is super helpful:

https://www.bing.com/videos/search?q=w2aew+probe+grounding&view=detail&mid=2D6CED3B5A84FB0F4F512D6CED3B5A84FB0F4F51&FORM=VIRE
 
The following users thanked this post: jdutky

Offline Benta

  • Super Contributor
  • ***
  • Posts: 6215
  • Country: de
Re: Dipping my toe in digital electronics
« Reply #9 on: October 12, 2020, 05:58:12 pm »
Breadboards are not for this kind of a design. Use a perfboard. Much better.
 
The following users thanked this post: jdutky

Online tggzzz

  • Super Contributor
  • ***
  • Posts: 20511
  • Country: gb
  • Numbers, not adjectives
    • Having fun doing more, with less
Re: Dipping my toe in digital electronics
« Reply #10 on: October 12, 2020, 06:09:18 pm »
Breadboards are not for this kind of a design. Use a perfboard. Much better.

Manhattan or dead-bug.

Lots of prototyping techniques shown here: https://entertaininghacks.wordpress.com/2020/07/22/prototyping-circuits-easy-cheap-fast-reliable-techniques/
There are lies, damned lies, statistics - and ADC/DAC specs.
Glider pilot's aphorism: "there is no substitute for span". Retort: "There is a substitute: skill+imagination. But you can buy span".
Having fun doing more, with less
 
The following users thanked this post: Electro Fan, jdutky

Offline ledtester

  • Super Contributor
  • ***
  • Posts: 3249
  • Country: us
Re: Dipping my toe in digital electronics
« Reply #11 on: October 12, 2020, 06:11:36 pm »
... I've got a full can, 3 MHz crystal oscillator which seemed easy enough to set up, but when I test the output with my scope I get a square wave with a lot of ringing, ...

From what I've seen 1 MHz is kinda a limit for breadboards.

Consider using a slower clock - even 500 KHz - at least to get things working without having to worry that the ringing will introduce hard-to-debug spurious errors.
 
The following users thanked this post: jdutky

Online tggzzz

  • Super Contributor
  • ***
  • Posts: 20511
  • Country: gb
  • Numbers, not adjectives
    • Having fun doing more, with less
Re: Dipping my toe in digital electronics
« Reply #12 on: October 12, 2020, 06:19:39 pm »
... I've got a full can, 3 MHz crystal oscillator which seemed easy enough to set up, but when I test the output with my scope I get a square wave with a lot of ringing, ...

From what I've seen 1 MHz is kinda a limit for breadboards.

Consider using a slower clock - even 500 KHz - at least to get things working without having to worry that the ringing will introduce hard-to-debug spurious errors.

Completely false for digital circuits. The only thing that matters is the transition time; the period is completely irrelevant.

If you look at timing specs for digital circuits, the principal ones are the setup and hold times - and they remain constant whether the clock frequency is 1MHz or 1Hz.

If you look at voltage specs for digital circuits, they don't mention clock frequency. However a short transition time at any frequency will increase the chance of exceeding the voltage limits.

FFI with some theory and practical experiments, see https://entertaininghacks.wordpress.com/2018/05/08/digital-signal-integrity-and-bandwidth-signals-risetime-is-important-period-is-irrelevant/
There are lies, damned lies, statistics - and ADC/DAC specs.
Glider pilot's aphorism: "there is no substitute for span". Retort: "There is a substitute: skill+imagination. But you can buy span".
Having fun doing more, with less
 
The following users thanked this post: Electro Fan, jdutky

Offline jdutkyTopic starter

  • Regular Contributor
  • *
  • Posts: 103
  • Country: us
Re: Dipping my toe in digital electronics
« Reply #13 on: October 12, 2020, 06:25:03 pm »

Good for you trying something that is outside your comfort zone!

Start by realising that you have an analogue circuit with inputs/outputs which have restricted valid values.

Key questions:
  • what is the ringing frequency? (I'll bet ~100MHz)
  • are you using decoupling capacitors?
  • what is the construction technique you are using? If solderless breadboards then good luck to you, since they will cause you more problems than the circuit itself
  • what is your probing technique? (I'll bet there is a 6in ground lead in there)

Thanks! This is something I have always wanted to do, but never found the time for. What I'd really like to do is build a full computer from "discrete logic" but this seemed like a better first project: more likely to succeed while also exposing me to a wide range of issues and techniques.

The analog nature of the circuit was evident from the first time I powered it on. I've been very conservative in applying my bench power supply to the circuit, so I started with the current limit turned all the way down and slowly brought it up until the supply went from current limited to voltage limited at +5.0V. Watching the output of the oscillator (routed through a couple inverters on a 74LS04, in a vain attempt to produce a delayed two-phase clock) on the scope made it very clear that I was not really dealing with a simple digital circuit.

I have not tried to measure the frequency of the ringing, but I will have a look at that (though using the grounding spring instead of the ground clip on my scope probe revealed that a bunch of the ringing appears to be in how I'm probing the circuit. Using the ground spring produces remarkably clean square waves, which sadly I can not attach a picture of because I have no free hands when I'm not using the sprung hook and ground clip on the probe). From memory, though, I think that there are about 10 or 12 oscillations of the ringing per half square wave, which would make it something like 30-40 MHz, but my memory might easily be low by a factor of 2 or 3.

I am not using any decoupling caps, but I was just thinking that I should because I found ringing noise on the power line that is clearly coming from the oscillator.

I'm doing this on a solderless breadboard :-[ but I guess I should consider moving to something else.

My probing technique did indeed include a 6 inch ground lead. As I said, switching to the ground spring improved my results remarkably, but leaves me with no hands free to do other things.
 

Offline jdutkyTopic starter

  • Regular Contributor
  • *
  • Posts: 103
  • Country: us
Re: Dipping my toe in digital electronics
« Reply #14 on: October 12, 2020, 06:29:35 pm »
I don't know if you have seen the Ben Eater project but it may provide inspiration.

https://eater.net/8bit/



This was, in fact, my inspiration for this project.

I was never a fan of the 6502. I always wanted to build something from a 6809, which is what I'm trying to do. I should probably have used the 68B09 rather than the 68B09E, but I thought it would be instructive to build the external clock circuit for the 09E, even though it would have been easier to use the chip with the internal oscillator.
 

Offline Electro Fan

  • Super Contributor
  • ***
  • Posts: 3283
Re: Dipping my toe in digital electronics
« Reply #15 on: October 12, 2020, 06:34:33 pm »

Good for you trying something that is outside your comfort zone!

Start by realising that you have an analogue circuit with inputs/outputs which have restricted valid values.

Key questions:
  • what is the ringing frequency? (I'll bet ~100MHz)
  • are you using decoupling capacitors?
  • what is the construction technique you are using? If solderless breadboards then good luck to you, since they will cause you more problems than the circuit itself
  • what is your probing technique? (I'll bet there is a 6in ground lead in there)

Thanks! This is something I have always wanted to do, but never found the time for. What I'd really like to do is build a full computer from "discrete logic" but this seemed like a better first project: more likely to succeed while also exposing me to a wide range of issues and techniques.

The analog nature of the circuit was evident from the first time I powered it on. I've been very conservative in applying my bench power supply to the circuit, so I started with the current limit turned all the way down and slowly brought it up until the supply went from current limited to voltage limited at +5.0V. Watching the output of the oscillator (routed through a couple inverters on a 74LS04, in a vain attempt to produce a delayed two-phase clock) on the scope made it very clear that I was not really dealing with a simple digital circuit.

I have not tried to measure the frequency of the ringing, but I will have a look at that (though using the grounding spring instead of the ground clip on my scope probe revealed that a bunch of the ringing appears to be in how I'm probing the circuit. Using the ground spring produces remarkably clean square waves, which sadly I can not attach a picture of because I have no free hands when I'm not using the sprung hook and ground clip on the probe). From memory, though, I think that there are about 10 or 12 oscillations of the ringing per half square wave, which would make it something like 30-40 MHz, but my memory might easily be low by a factor of 2 or 3.

I am not using any decoupling caps, but I was just thinking that I should because I found ringing noise on the power line that is clearly coming from the oscillator.

I'm doing this on a solderless breadboard :-[ but I guess I should consider moving to something else.

My probing technique did indeed include a 6 inch ground lead. As I said, switching to the ground spring improved my results remarkably, but leaves me with no hands free to do other things.

Man, you are doing great!  This is a deluxe project at the start of the intersection of analog and digital.   :-+ :-+
 
The following users thanked this post: jdutky

Offline Electro Fan

  • Super Contributor
  • ***
  • Posts: 3283
Re: Dipping my toe in digital electronics
« Reply #16 on: October 12, 2020, 06:46:20 pm »
"I am not using any decoupling caps, but I was just thinking that I should because I found ringing noise on the power line that is clearly coming from the oscillator."

Might be worth a look-see at power supply ripple just to see what's there.  Probably not anything that is impacting digital at this point but as long as you're in the noise and ringing neighborhood....
 
The following users thanked this post: jdutky

Offline Benta

  • Super Contributor
  • ***
  • Posts: 6215
  • Country: de
Re: Dipping my toe in digital electronics
« Reply #17 on: October 12, 2020, 07:35:56 pm »
This is the kind of perfboard I'm talking about. Ideal for this type of project. Power lines are already laid out. It's very suitable for a digital project. Space for 12 pcs. 14...16 pin DIP ICs plus interconnects and decoupling:

https://www.conrad.de/de/p/tru-components-su527670-ic-platine-hartpapier-l-x-b-160-mm-x-100-mm-35-m-rastermass-2-54-mm-inhalt-1-st-1566656.html

Or this:

https://www.conrad.com/p/rademacher-vk-c-932-hp-laboratory-card-designed-for-twelve-16-pin-ics-with-connection-options-for-the-following-plugs-527370



« Last Edit: October 12, 2020, 07:49:47 pm by Benta »
 
The following users thanked this post: Electro Fan, jdutky

Online rstofer

  • Super Contributor
  • ***
  • Posts: 9932
  • Country: us
Re: Dipping my toe in digital electronics
« Reply #18 on: October 12, 2020, 08:02:42 pm »
The clock for a prototype CPU needs a lot of thought.  It should be capable of:

  • Full speed clock
  • Single clock pulse - a debounced pushbutton
  • Single instruction - deliver as many clocks as necessary for the current instruction.  Basically, turn off the clock when you get back to Instruction Fetch.  Full speed?  Variable speed?
  • Variable frequency clock (so you can watch the blinking lights
  • Some scheme for a breakpoint to change the mode back to Single Clock.  Breakpoint on PC matching some address in DIP Switches, I suppose

Each of these modes will be useful as you bring up the processor.  Ben Eater does some of this for his clock but I'm pretty sure he doesn't include the breakpoint feature.  This feature is helpful when bringing up the OS rather than just debugging hardware.  Sometimes you get pretty deep into running code before things turn south.
« Last Edit: October 12, 2020, 08:24:48 pm by rstofer »
 
The following users thanked this post: Electro Fan, jdutky

Online rstofer

  • Super Contributor
  • ***
  • Posts: 9932
  • Country: us
Re: Dipping my toe in digital electronics
« Reply #19 on: October 12, 2020, 08:28:55 pm »
Even production machines used to have some way to control execution.  My favorite machine, the IBM1130, had a rotary selector for things like single step.  See "Mode Switch" about 3/4 the way down this page:

http://www.ibm1130.net/functional/Console.html

Perhaps some modes are not appropriate.  But you get the idea, having a way to control the clock is important.
« Last Edit: October 12, 2020, 08:31:33 pm by rstofer »
 

Offline jdutkyTopic starter

  • Regular Contributor
  • *
  • Posts: 103
  • Country: us
Re: Dipping my toe in digital electronics
« Reply #20 on: October 12, 2020, 10:32:18 pm »
The clock for a prototype CPU needs a lot of thought.  It should be capable of:

  • Full speed clock
  • Single clock pulse - a debounced pushbutton
  • Single instruction - deliver as many clocks as necessary for the current instruction.  Basically, turn off the clock when you get back to Instruction Fetch.  Full speed?  Variable speed?
  • Variable frequency clock (so you can watch the blinking lights
  • Some scheme for a breakpoint to change the mode back to Single Clock.  Breakpoint on PC matching some address in DIP Switches, I suppose

Each of these modes will be useful as you bring up the processor.  Ben Eater does some of this for his clock but I'm pretty sure he doesn't include the breakpoint feature.  This feature is helpful when bringing up the OS rather than just debugging hardware.  Sometimes you get pretty deep into running code before things turn south.


The 6809 has a HALT pin that handles most of these cases (not the breakpoint, but that could be implemented with a comparator on the address lines and some glue logic to distinguish instruction fetches from data fetches. There is a signal, LIC, that tells you when a new instruction fetch is going to start, so that you can differentiate data and instruction fetches).

Even production machines used to have some way to control execution.  My favorite machine, the IBM1130, had a rotary selector for things like single step.  See "Mode Switch" about 3/4 the way down this page:

http://www.ibm1130.net/functional/Console.html

Perhaps some modes are not appropriate.  But you get the idea, having a way to control the clock is important.


I've been giving this some thought in terms of how to build a front panel for the 6809. I have fond memories of the front panels for a couple of different mini computers (Varians and DEC PDP-11s) and I would like to have something similar on this project, but it is more difficult if you don't have direct access to the internal registers, and if the CPU doesn't have a host of external signals indicating where it is in it's instruction cycle (as the 8086 has). I have an old 6800 demo system (the "HEP KIT Educator II Microcomputer Kit") that implements a front panel in software, but it's terribly limited compared to what you had on a nice mini, and I'm willing to blow my budget on this with extra glue logic and latches to hold addresses and data from different phases of the instruction, as well as doing what the Educator II did and update some of the front panel lamps in software on a HALT.

I've also been looking for a nice, reasonably priced 3-position key-lock switch that I can use for the OFF-STEP-RUN switch, which both Varians and at least some PDP-11s had. They used to be fairly common, but I'm having some trouble finding them now. Failing that I will settle for a simple 3-position rotary switch.
 

Offline james_s

  • Super Contributor
  • ***
  • Posts: 21611
  • Country: us
Re: Dipping my toe in digital electronics
« Reply #21 on: October 12, 2020, 11:44:32 pm »
A fast rise time like that on a breadboard is almost guaranteed to cause some ringing. It shouldn't really matter though, and if you want to clean it up I will second the advise to add a series resistor. That will reduce the slew rate somewhat and should help damp any ringing.
 

Online tggzzz

  • Super Contributor
  • ***
  • Posts: 20511
  • Country: gb
  • Numbers, not adjectives
    • Having fun doing more, with less
Re: Dipping my toe in digital electronics
« Reply #22 on: October 13, 2020, 12:58:38 am »
A fast rise time like that on a breadboard is almost guaranteed to cause some ringing. It shouldn't really matter though, and if you want to clean it up I will second the advise to add a series resistor. That will reduce the slew rate somewhat and should help damp any ringing.

Ringing can matter if the signal integrity is sufficiently poor that the inputs incorrectly interpret the analogue voltage.

Inserting a resistor has to be near the source, and if it is sufficient to reduce ringing then it will also reduce the transition amplitude. That can be a standard problem for inputs that are not at the end of the wire.

A fast transition can also cause ground bounce, which is a classic cause of intermittent pattern-sensitive failure.
There are lies, damned lies, statistics - and ADC/DAC specs.
Glider pilot's aphorism: "there is no substitute for span". Retort: "There is a substitute: skill+imagination. But you can buy span".
Having fun doing more, with less
 
The following users thanked this post: jdutky

Offline Martian Tech

  • Regular Contributor
  • *
  • Posts: 90
  • Country: us
Re: Dipping my toe in digital electronics
« Reply #23 on: October 13, 2020, 01:01:12 am »
I should probably have used the 68B09 rather than the 68B09E, but I thought it would be instructive to build the external clock circuit for the 09E, even though it would have been easier to use the chip with the internal oscillator.

FYI: There are 68B09 processors out there that are mismarked as 68B09E, so if it doesn't work as expected be sure to consider that possibility and don't immediately assume it's the breadboard...

 
The following users thanked this post: jdutky

Offline jdutkyTopic starter

  • Regular Contributor
  • *
  • Posts: 103
  • Country: us
Re: Dipping my toe in digital electronics
« Reply #24 on: October 13, 2020, 01:14:51 am »
I should probably have used the 68B09 rather than the 68B09E, but I thought it would be instructive to build the external clock circuit for the 09E, even though it would have been easier to use the chip with the internal oscillator.

FYI: There are 68B09 processors out there that are mismarked as 68B09E, so if it doesn't work as expected be sure to consider that possibility and don't immediately assume it's the breadboard...



Wow. That's where I got my (alleged) 68B09E. I will give that a try straight away.

I'll be kind of sad if this is the case, especially if they are not even 68B09s, both because I was hoping to run them at 2 MHz, and because I was all psyched to learn something along the way (and it sure looked like I was about learn a lot of something).
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf