Close
0%
0%

Bipolar Discrete UART

Because making discrete clocks is not an end in itself.

Similar projects worth following
Using a bunch of bipolar transistors is fun and making clocks is a very demonstrative and useful project but there is much more to electronics ! The design of a processor however is very complex and tedious. So what can be done in-between ?
A UART has it all, state machines, sequential logic, you name it, and reuses a lot of concepts and circuits from clocks, like dividers, shift registers and other nifty tricks. Oh and it's also very useful because you can then communicate with another computer !
So I'll try to design and build an asynchronous serial emitter and receiver with the fewest parts possible. Possibly in the 200 to 300 transistors range, because that's how many I got from Jaromir .
Then it will become a bridge between old and new technologies !

The principle is very simple and both the receiver and the emitter are based around the same module, made of 3 transparent latches, replicated 8 times. Then it's only a matter of properly sequencing the right signals.

Here is the version for the receive circuit :

The CPU can read the receive buffer while another byte is being shifted in, which increases the bandwidth.

The same system is used, in reverse, for the emitter, but instead of using the last bit of the shift register as a "terminal flag", a AND performed.

Each "bit slice" contains 3 "SCR-like latches":

  • 3 PNP
  • 6 NPN
  • 6 diodes (?)
  • 15 resistors

Multiply by 8 (bits) and then 2 (emit & receive) again and you get:

  • 48 PNP
  • 96 NPN
  • 96 diodes (?)
  • 240 resistors

The baud generator is not yet included.


Logs:

1. First log: a minimal parts count shift register !
2. First slice
3. Clock Driver
4. Baud generation
5. Oscillator mysteries
6. Frequency sources
7. Frequency sources épisode deux
8. Canned oscillator
9. Tx with fewer parts
10.   .

  • Tx with fewer parts

    Yann Guidon / YGDES03/11/2020 at 06:32 0 comments

    The FlipFlops use a significant amount of parts so the fewer, the better !

    There is not much to do for the receive part but the emitter could get a little fewer latches. The initial design uses 3 latches per bit, or 24 latches (72 transistors overall). 8 latches are required for the emit buffer anyway (24T). Using a Johnson counter can create the semi-decoded system, with 5 stages or 10 states, one for each bit as well as the start and stop bits.

    A binary counter would not save much because that would require 4 latches, not far from 5, and the binary decoder uses gates as well : I have covered binary selectors (MUX trees) at From XOR to MUX already and each bit requires 3 transistors in average. So it's roughly equivalent (though less delicate than Flip Flops)...

    The 10 outputs of the Johnson counter will directly select one bit to output (there would be 8 ANDs and a big OR) and the Johnson counter would use the technique explained at Reduction by mirroring: the clock pulse ripples through RC cells to trigger successive pulses. This saves transistors because there is no need of a Master/Slave duplicated configuration. That's 4T per bit, or 20 for a 5-stages Johnson counter. Total (for the datapath) : 20+24=44T (including 5 complementary). The big AND/OR is not counted... There might be a need for a latch at the output to prevent spurious pulses, because the ripple will be nasty...

    Oh and I recently heard about http://www.6502.org/users/dieter/uart/ :-)

    Tx is "simpler" because it doesn't require synchronisation with the receiver so it's easier to start with.

  • Canned oscillator

    Yann Guidon / YGDES03/08/2020 at 22:21 0 comments

    Among the crystals I received, there is a couple of 1.8432 MHz integrated oscillators and I put them to the test today. The power is quite low : 2mW !

    * The operating voltage looks pretty low : 2V !
    * The operating current is just about 1mA.

    I can pull/push the frequency with :

    • adjusting the voltage : lower voltage => higher frequency
    • adjusting the output load : tbd
    • temperature : tbd

    From the start it's working at a few Hz away from the expected/rated frequency and it's great. An integrated CMOS or TTL frequency divider would provide all the needed operating frequencies.

  • Frequency sources ├ępisode deux

    Yann Guidon / YGDES03/03/2020 at 21:31 0 comments

    So I received the quartz tubes and I'm characterizing them :-)

    The 2-transistors circuit mentioned earlier works like a charm. The GS507 from @jaromir.sukuba  flies without effort.

    There is one tube marked as 2400Hz on the box but with no marking on the tube itself and I just measured it a 2402,4 Hz. I don't see how to center it better to 2400 precisely, as temperature and supply voltage don't affect the frequency enough.

    I started playing with the liaison capacitor and it indeed has an effect but not the one expected : too low and it oscillates on 5th harmonic and sometimes more (11th harmonic ?). However this confirms what @SHAOS said about its importance.

    I'm still playing with the circuit and it's a lot of fun, you can hear something like tinnitus if you hold the crystal to your ear and the driving strength is high enough. The oscillator can work down to a very low voltage, which is very fun to do with germanium :-D

    I'm not overly concerned by the 1/1000th of frequency mismatch because it's still well below 1% required for serial communications and the other tube is clocked at 2403.1 Hz.

    The quartz has a large inertia and can stand some power that would damage a wristwatch crystal. The output of the oscillator is strong enough to drive a simple amplifier. It's so fun to see a crystal that is more than 60 years old become part of a digital circuit ! However the circuit saturates a lot. Maybe the crystal is designed for a Pierce oscillator ?


    I also tried the 19200 Hz quartz tubes from Ukraine (another great find on sr71's eBay shop) and they are easier to "pull" due to a different cut, probably, as well as 30 years younger. I find a 5Hz drift that is easier to remove by adjusting the feedback capacitance, it's only 1/5000 to correct instead of the much larger relative drift of the slower crystals.

    The OC139 drive it easily, even with swapped emitter & collector... It's fun that I can also pull the frequency by shining light on the black-tinted glass ;-) the paint is not perfectly opaque and now I understand why the metal cans have been a necessary evolution.

    The GS507 seem to work well at 19K2Hz and the digital logic should work fast enough.

  • Frequency sources

    Yann Guidon / YGDES02/24/2020 at 03:41 6 comments

    At first I was like "OK I will try to run at 115200 bauds" and then I realised tht the GBWP of certain transistors wouldn't allow that.

    Anyway I started searching for 1.8432 MHz quartz crystals (I ordered some) and the first thing to do is to drop the frequency as much as possible, first by factors of 2-4-8-16 so more complex gates/circuits can be used at lower frequencies.

    Then I encountered tiny 38.4KHz crystals on eBay : this won't provide much bandwidth but it is much more suitable for Germanium trannies. I don't mind that it won't run at 115200 bauds because it saves a lot of high frequency dividers... But we're only getting started !

    These modern tiny crystals will come from China, someday, when/if the export problems (due to the virus epidemic) are solved. No such problem with Ukraine : our old friend bird_sr71a has some better resonators, at "only" 19200Hz ! In the worst case, if I have to divide by 2, I can still reach 9600 bauds, a pretty standard and useful frequency, though I'll see if/how I can keep up with 19.2kbps.

    It's much more classy and more coherent with the rest of the technologies I'll deploy :-)

    But we can go even further...

    Closer to Paris, a British store offers European vintage crystals that are even older.

    Now it's very, very slow... and I hope the OC70 will not complain ! Worst case will be 1200 bauds, which is still "pretty fast" if you were born in the 70s in France : the Minitel used 1200 bauds over POTS.

    I'm expecting to receive a pair of these ultra-slow resonators, so there would be one for the send side and one for the receive side.

    Driving these tubes would be easy with a pair of OC70 and the oscillator circuit that I discussed in the last log.


    So I have a frequency source for a variety of transistor technologies :
    • OC70/OC139 "lazy germanium" in glass tubes -> 2.4Kbps would be good
    • I have faster germanium transistors but very very few NPN for 19.2K
    • KT315 & KT361 : silicon planar Russian complementary trannies : they could work at 38.4K easily. I hope.
    • I have a very good supply of BC550/549 and BC559 and I hope they can manage to reach 115200 bps :-)

    Anyway : I still lack tons of NPN germaniums. The price of the OC139/OC140/OC141 has skyrocketted  due to the "DIY disto pedal frenzy", along with many others... I have ample supplies of OC70 but my minimal latch circuit requires NPN as well :-/

  • Oscillator mysteries

    Yann Guidon / YGDES02/23/2020 at 02:41 2 comments

    I think I cracked another mystery !

    Thanks to Falstad :

    This is just the same circuit as this one (found there) :

    It has been discussed at 12. It just works and 7. Crystal Oscillator (Germanium Edition) from some years ago. I had noticed that the value of C2 was meaningful and tuning R2 and R4 would affect the gain.

    It is simply because, when one simplifies the crystal down to a capacitor, the whole circuit is just an equivalent to an astable multivibrator !

    So the Rs and Cs need to be tuned to resonate around/at the expected frequency, then the crystal replaces one of the capacitors, and there you have it !


    It started raising my suspicion that C2 was more important than I thought, when I saw some strange "motorboating" and the circuit would send a spike at regular intervals.

    Usually I set C2 to a pretty large value because I considered it as a DC blocking capacitor that would feed the output signal back to the driver. But regularly, I would see spikes that would "shake" the crystal and change its operating conditions.

    I thought it was a great thing because it would "kick" the crystal by itself, without manually snapping it with a finger. I would just have to find a suitable period, like, 10ms or such, to enable a fast startup. When the oscillation is settled, some other mechanism would prevent the LFO from "kicking in".

    But if the whole circuit is tuned, the gain is much better and there is no need to periodically kick/pulse anything. Then the only question is : what is the equivalence capacitance of the crystal ? From there, t=RC and a crude value for the resistors can be found.

    So yes @SHAOS  you were right ! the value of C2 matters ;-)


    The other nice thing is that it can generate "non overlapping pulses" that could drive the flip-flops. However the tuning of the capacitors makes it very frequency-dependent.

    Here is the schematic at work :

    The capacitors generate negative spikes (triangles) that can be sensed to drive the amplifiers on each side. The string of diodes as well as the series resistors 2.2K/10K help tune the width and overlap of the pulses shown at the bottom.

    with ideal transistors and 22pf capacitors, the system reaches 1.8MHz in the simulator, which can be increased by reducing the base and collector resistors.

  • Baud generation

    Yann Guidon / YGDES02/22/2020 at 05:48 0 comments

    Supposing the whole shift register and the processor can sustain 115200bps, the clock generation looks like this :

    It seems I can't find an oscillator slower than 1.8432MHz so I settle with that. I found an old large Xtal on eBay so the electronics will be deliciously weird. I'll use the circuit with 2 transistors shown atIt just works because it works indeed :-) However I have no idea of the impedance and other parameter of that laaarge crystal... I went through that study 4 years ago and logged everything so it will not be a serious problem.

    The delicate part will be the buffer because my past experience with #Yet Another (Discrete) Clock shows that impedance matching is quite hard and even the 'scope can affect the very sensitive oscillator. Then that very weak signal must be amplified to a few milliamperes....

    Then the signal goes through a modified unipolar div-by-4 cell. The input drives both PNP and NPN pass gates. The 2 outputs signals are then combined to create 2 non-overlapping pulses (code 01 and 10).

    The non-overlapping pulses drive another NPN-only div-by-4. Again the outputs are combined into non-overlapping pulses to drive the shift register.

    In theory it should work, right ?


    Why do I use "div-by-4" cells instead of "div-by-2" ?

    There is no disadvantage to this choice, but a few notable advantages, in particular for the type of cells I use.

    Complexity-wise, dividing by 4 or twice by 2 is the same : same number of parts (roughly) but the output is 2× slower, so it's better, and easier to turn into a pair of "non-overlapping signals" thanks to a pair of transistors in ANDN configuration.

  • Clock Driver

    Yann Guidon / YGDES02/21/2020 at 01:07 0 comments

    One nasty part of this kind of design is to drive the pass gates with non overlapping pulses. Otherwise it's a terrible mess...

    I have found this simple complementary driving system, using only a pair of transistors, and a bunch of diodes. The cool part is where the duty cycle (and pulse width) is determined by a potentiometer, and there is no capacitor in sight so it should work at medium speed without problem. The input signal is also supposed to have a slope...

    Here is the driver :

    There is still some freedom in the choice of the number of diodes and the value of the potentiometers, though make sure that there are enough diodes to prevent a direct current from Vcc to GND ;-) At 3V the minimum would be 6 diodes.

    The 1K pull resistor would be the actual load (2K2 resistors with each a BJT base and stuff).

    I believe this driver would drive the first divide-by-4 cell. This cell would then output 2 non-complementary non-overlapping signals, suitable to drive the slower clocks. A divide-by-4 cell has 4 states and 2 BJT can detect two of the opposite states...

    The version with 6 diodes works quite well too:

    But now the shape of the input signal is the next critical problem.

  • First slice

    Yann Guidon / YGDES02/20/2020 at 23:08 0 comments

    So one latch "building block" is this :

    BOM:

    • 1 PNP
    • 2 NPN
    • 1 diode for the output (might be removed in certain cases, such as when driving another base)
    • 3× 2K2
    • 2× 4K7 (could be 2× 2K2 if needed)

    A "slice" is a "DFF and a half" : one master latch and two slaves, one of them can be connected to the processor.

    Source here.

    This is pretty easy to place & route on a small board.

    In this example, the "slice" is configured for the receive circuit (SIPO). The 3 latches must be connected differently to perform the PISO function, so each "slice board" would have each individual latch connected to the outside so a backplane can configure the correct function.

  • Building block : divide by two

    Yann Guidon / YGDES02/09/2020 at 23:10 0 comments

    See at the bottom for a slightly better version


    This circuit shows a variation on the one presented in the first log :

    This shows the "SCR slices" linked by two NPN "pass gates". The output is looped back to the input with an additional NPN.

    So it is possible to have two configurations :

    • either 3 PNP and 3 NPN per DFF, or
    • 2PNP and 4 NPN.

    The choice depends on the availability of the transistors, and influences the clocking scheme : using "NPN pass gates" only requires the creation of two independent non-overlapping pulses per clock cycle.

    Apparently the clock system will be a whole problem in itself...


    Here is the source code :

    $ 1 1e-9 1.2182493960703473 66 5 43
    g 672 432 672 464 0
    w 624 144 624 224 1
    w 624 320 528 320 3
    w 624 128 624 144 2
    w 624 320 624 336 0
    w 640 320 624 320 0
    w 672 272 672 304 2
    w 624 400 624 432 1
    w 624 320 624 288 2
    w 672 432 624 432 0
    w 672 336 672 432 1
    w 672 112 656 112 0
    w 672 96 672 112 2
    w 624 0 624 96 1
    w 624 0 672 0 0
    w 672 0 672 32 1
    w 672 112 672 144 1
    r 672 144 672 208 0 2000
    r 624 224 624 288 0 2200
    r 672 32 672 96 0 1000
    r 624 336 624 400 0 2200
    t 656 112 624 112 0 -1 2.930529235861507 -1.1867824944999938e-8 100
    t 640 320 672 320 0 1 -2.9305256619877182 0.06947075183066788 100
    r 512 144 512 224 0 2200
    t 512 288 512 320 1 1 0.5968215934651058 0.5973307394672914 100
    w 496 432 624 432 0
    w 512 -32 512 144 0
    w 512 224 512 288 3
    d 672 208 672 272 2 default
    d 752 304 672 304 2 1N4148
    w 928 272 976 272 0
    w 976 496 448 496 0
    w 768 224 768 272 3
    w 736 0 816 0 0
    w 768 -32 768 144 0
    w 816 0 816 -48 1
    w 672 432 880 432 0
    w 784 304 784 320 0
    t 768 272 768 304 1 1 -2.8805655700300177 0.11937009322376849 100
    r 768 144 768 224 0 2200
    t 896 320 928 320 0 1 -2.607606715813171 3.037300559797447e-8 100
    t 912 112 880 112 0 -1 2.908745716789634 -0.09125424512435565 100
    r 880 336 880 400 0 2200
    r 928 32 928 96 0 1000
    r 880 224 880 288 0 2200
    r 928 144 928 272 0 3300
    w 928 112 928 144 1
    w 928 0 928 32 1
    w 880 0 928 0 0
    w 880 0 880 96 1
    w 928 96 928 112 2
    w 928 112 912 112 0
    w 928 336 928 432 1
    w 928 432 880 432 0
    w 880 320 880 288 2
    w 880 400 880 432 1
    w 928 272 928 304 2
    w 896 320 880 320 0
    w 880 320 880 336 0
    w 880 128 880 144 2
    w 880 320 784 320 1
    w 880 144 880 224 1
    w 816 0 880 0 1
    w 672 0 736 0 1
    R 816 -48 816 -80 0 0 40 3 0 0 0.5
    S 624 -112 624 -48 0 1 false 0 2
    R 624 -112 624 -144 0 0 40 3 0 0 0.5
    w 608 -48 512 -32 0
    w 640 -48 768 -32 0
    t 464 384 496 384 0 1 0.5300334614902087 0.6000133593230622 100
    w 496 320 496 368 3
    w 496 400 496 432 0
    r 976 288 976 496 0 22000
    w 448 496 448 384 0
    w 448 384 464 384 0
    r 608 -48 624 0 0 1000000000
    w 976 288 976 272 3
    o 2 4 0 4355 1.25 0.0015625 0 2 2 3
    o 6 4 0 4354 5 0.1 0 2 6 3
    o 31 4 0 4354 0.625 0.0015625 0 2 31 3
    o 31 4 0 4355 0.625 0.00009765625 0 2 31 3
    o 60 4 0 4355 1.25 0.0015625 0 2 60 3

    Here is a slightly optimised version, one diode less, less current, using only 2K2 and 4K7 resistors.

    current on the GND node doesn't exceed 2.8mA,  cycles through

    1.1mA 1.8mA, 2.8mA, 2mA

    Base resistors are all 2K2. 4K7 connects the complementary sides to reduce the curent.

    This circuit also shows how to "drive" the first element of a shift register : with a simple pull-down transistor.

  • First log: a minimal parts count shift register !

    Yann Guidon / YGDES02/09/2020 at 22:49 0 comments

    It all starts with this circuit :

    The goal is to make a shift register that works at about 115200 bps (hopefully) for receive and send, with one receive and send buffer, with the minimal count of transistors. The above circuit is the basis, the building block for the rest. I don't think a sophisticated and optimised structure would make sense, so I'll focus on a single module with 3 "SCR-style" latches, a pair for the shift register and the third for the in\out buffer (depending on the configuration).

    The source code for Falstad is pretty long, sorry...
    $ 1 1e-9 0.9487735836358526 60 5 43
    d 768 288 672 288 2 1N4148
    w 880 0 816 0 1
    w 800 288 800 304 0
    t 768 320 800 320 1 1 0.5898352006989318 0.5895778354142961 100
    r 752 208 752 256 0 2200
    t 896 320 928 320 0 1 0.603203789466672 0.6297696664295094 100
    t 912 80 880 80 0 -1 -0.5878533226791691 -0.6294666250239822 100
    r 880 336 880 400 0 2200
    r 928 16 928 80 0 2200
    r 880 224 880 288 0 2200
    r 928 224 928 288 0 2200
    w 928 96 928 224 1
    w 928 0 928 16 1
    w 880 0 928 0 0
    w 880 0 880 32 1
    w 928 80 928 96 2
    w 928 80 912 80 0
    w 928 336 928 432 1
    w 928 432 880 432 0
    w 880 320 880 288 2
    w 880 400 880 432 1
    w 928 288 928 304 2
    w 896 320 880 320 0
    w 880 320 880 336 0
    w 880 96 880 112 2
    w 880 336 800 336 1
    w 880 112 880 128 1
    R 816 0 784 0 0 0 40 3 0 0 0.5
    w 752 272 752 256 3
    w 768 320 752 320 0
    w 1024 80 1008 80 1
    r 1040 112 1040 160 0 2200
    t 1040 112 1040 80 0 -1 0.04161325390746562 0.000009567860214332313 100
    w 1056 80 1072 80 3
    w 752 144 752 208 1
    w 1040 208 1040 160 1
    w 752 272 752 320 0
    w 768 288 800 288 0
    w 1040 208 752 208 0
    w 1152 112 1152 80 0
    w 1152 0 1200 0 0
    d 1152 208 1152 288 2 default
    t 1120 320 1152 320 0 1 -2.9986849584196444 6.600983002054078e-10 100
    t 1136 112 1104 112 0 -1 2.999990370503179 -0.000009568036190898965 100
    r 1104 336 1104 400 0 2200
    r 1152 16 1152 80 0 2200
    r 1104 208 1104 272 0 2200
    r 1152 144 1152 208 0 2200
    w 1152 128 1152 144 1
    w 1152 0 1152 16 1
    w 1104 0 1152 0 0
    w 1104 0 1104 32 1
    w 1152 112 1152 128 2
    w 1152 112 1136 112 0
    w 1152 336 1152 432 1
    w 1152 432 1104 432 0
    w 1104 400 1104 432 1
    w 1152 288 1152 304 2
    w 1120 320 1104 320 0
    w 1104 320 1104 336 0
    w 1104 128 1104 144 2
    w 1104 272 1104 320 1
    w 960 432 1104 432 0
    w 928 0 1104 0 0
    w 1040 208 1232 208 0
    w 1104 32 1104 96 0
    w 1152 80 1072 80 0
    w 880 32 880 64 0
    d 880 128 880 224 2 default
    d 960 128 1008 128 2 default
    w 1008 128 1008 80 0
    w 960 128 880 128 0
    g 1152 432 1152 464 0
    d 1280 288 1232 288 2 1N4148
    w 1152 432 1360 432 0
    w 1280 288 1280 304 0
    t 1248 320 1280 320 1 1 0.5898352012281517 0.5895776955139157 100
    r 1232 208 1232 256 0 2200
    t 1376 320 1408 320 0 1 0.6032038700972324 0.6297697242398047 100
    t 1392 80 1360 80 0 -1 -0.5878533230430105 -0.6294666249949361 100
    r 1360 336 1360 400 0 2200
    r 1408 16 1408 80 0 2200
    r 1360 224 1360 288 0 2200
    r 1408 192 1408 288 0 2200
    w 1408 96 1408 192 1
    w 1408 0 1408 16 1
    w 1360 0 1408 0 0
    w 1360 0 1360 32 1
    w 1408 80 1408 96 2
    w 1408 80 1392 80 0
    w 1408 336 1408 432 1
    w 1408 432 1360 432 0
    w 1360 320 1360 288 2
    w 1360 400 1360 432 1
    w 1408 288 1408 304 2
    w 1376 320 1360 320 0
    w 1360 320 1360 336 0
    w 1360 96 1360 112 2
    w 1360 336 1280 336 1
    w 1360 112 1360 128 1
    w 1232 272 1232 256 3
    w 1248 320 1232 320 0
    w 1504 80 1488 80 1
    r 1520 112 1520 160 0 2200
    t 1520 112 1520 80 0 -1 0.04161325351457945 0.00000956783734107347 100
    w 1200 0 1360 0 0
    w 1536 80 1552 80 3
    w 1520 208 1520 160 1
    w 1232 272 1232 320 0
    w 1152 288 1200 288 0
    w 1520 208 1232 208 0
    w 1632 112 1632 80 0
    d 1632 208 1632 288 2 default
    t 1600 320 1632 320 0 1 -2.998684961523275 6.600340191111187e-10 100
    t 1616 112 1584 112 0 -1 2.999990370526181 -0.000009568013317640123 100
    r 1584 336 1584 400 0 2200
    r 1632 16 1632 80 0 2200
    r 1584 208 1584 272 0 2200
    r 1632 144 1632 208 0 2200
    w 1632 128 1632 144 1
    w 1632 0 1632 16 1
    w 1584 0 1632 0 0
    w 1584 0 1584 32 1
    w 1632 112 1632 128 2
    w 1632 112 1616 112 0
    w 1632 336 1632 432 1
    w 1632 432 1584 432 0
    w 1584 400 1584 432 1
    w 1632 288 1632 304 2
    w 1600 320 1584 320 0
    ...
    Read more »

View all 10 project logs

Enjoy this project?

Share

Discussions

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates