Image 1 — My overengineered EEPROM programmer (+ my perfboarding technique)
Image 2 — My overengineered EEPROM programmer (+ my perfboarding technique)
Image 3 — My overengineered EEPROM programmer (+ my perfboarding technique)
Image 4 — My overengineered EEPROM programmer (+ my perfboarding technique)
Image 5 — My overengineered EEPROM programmer (+ my perfboarding technique)
▲ 169 r/KiCad+2 crossposts

My overengineered EEPROM programmer (+ my perfboarding technique)

(Sorry for reposting, the images didn't show up as a carousel properly the first time and I don't know how else to fix it)

Howdy, guys. As several others seem to enjoy doing here, I've made a permanent version of my Arduino Nano EEPROM programmer module. I want to preface by saying that I didn't even watch Ben's video past where he started writing code, because I knew I could do it all on my own and then watch what he did, as that would be interesting.

Major differences:

  • I didn't even know shiftOut() existed. I used SPI COPI (D11) as my serial output and SCK (D13) as my serial clock pin, and used the Arduino SPI module to shift out bytes. You simply tell SPI the LSB_FIRST or MSB_FIRST order and clock speed, and then send bytes out. It even has a "transfer16" function that takes an int and would fill both 595's.
  • I made all my pins have configurable assignments, which will be significant in a second.
  • I made a serial interface with both a read and write function. I did take inspiration from Ben's "read" format. My serial interface asks how many chunks you want to see and prints them out, and the write interface uses a "chunking" technique that currently reads chunks that are at most 64 bits wide, before sending an "ACK" byte for the sender to respond to and send the next 64 bytes. It then reads the ROM contents back and prints error messages if certain bytes did not write properly. The hardware serial input bus is 64 bits, so you need chunking to avoid buffer overruns from data being written faster than you can write it out when you are trying to write the whole chip's 2 kilobytes. The serial buffer ends up "catching up" and dropping bytes at any speed faster than like 1200 baud, which is absurdly slow and I was not going to stand for it.
  • I actually followed the datasheet specification and made my write flashes last under 1000 nanoseconds by using register-level outputs and assembly NOP operations to make my write flashes last about 400 nanoseconds each. I didn't think I could get away with what Ben did, I kind of jumped the gun here.
  • I realized I don't even need two shift registers. One is just fine including the Arduino's digital pins. It's actually really close, but it's perfect with only one 595.

https://preview.redd.it/6t1ecczrdibh1.png?width=954&format=png&auto=webp&s=e34c9eab38a30a99ab9e7124d3c2ef331f8263d2

https://preview.redd.it/i7qhc6l8eibh1.png?width=735&format=png&auto=webp&s=b54a5fd989b8a0366a561332eb3660f63b89bd48

https://preview.redd.it/cio9pdyuzibh1.png?width=921&format=png&auto=webp&s=652a7c69bf31e4b9036f626eac5f34a89da970c9

https://preview.redd.it/g5ev7sxj3jbh1.png?width=615&format=png&auto=webp&s=59dd36195d1af7c213c1bd6be6d1d313c34ada05

https://preview.redd.it/bbqy8g1h3jbh1.png?width=485&format=png&auto=webp&s=de1e74150d52b8e41cd2f2d78232dccfc68e5f8b

A few years ago I devised a technique for perfboard planning, where I abuse KiCad, making it act like a perfboard routing simulator.

  • I created the schematic and ONLY placed the connections that were absolutely set in stone (SPI pins with SPI pins, power distribution, strict "no connect" marks on unused pins etc.) and I left all usable digital pins open, to be distributed during actual routing. This is because digital pins can just be assigned to their jobs in the software, which lets the hardware be far nicer.
  • I made the grid size 2.54 mm to enforce the perfboard geometry.
  • I made the "traces" the same exact width as my spool wire, so I could visualize how much space they would actually take up.
  • I treated the front and back of the "PCB" as the front and back of the perboard, giving me insight into where I could weave wires, though I like to avoid this.

It worked first try, which I would have hoped after all that. I hope y'all find this cool and my biggest hope is that my perfboarding technique gives others ideas. I'm sure it's been done before, but I came up with it myself and haven't seen others do something like it. I love aesthetically pleasing circuits.

u/HydroPage — 5 hours ago
▲ 101 r/beneater

Instruction counter clocking somehow affected by RAM write edge-detector…?

(SOLVED: The RC edge detector is a high pass filter, so just as the rising edge makes a positive spike, the falling edge makes a negative spike, which makes everything behave completely wrong. I'm going to use a diode to prevent the reverse current from making the clock voltage negative)

Hey guys, I’ve encountered a super weird issue. I just built my instruction counter module, and I plugged it into the full system powered on to see if it would behave properly, and it doesn’t follow the clock rising edges whatsoever. It acts totally erratically.

I figured out that adding a 1k or so pulldown resistor to the clock pin of the counter did the trick, but I wasn’t satisfied. I disconnected sections from the clock one by one until I isolated that somehow the edge detector of the RAM writing logic is somehow connected to this. If I remove the capacitor, effectively disconnecting the edge detector, the instruction counter behaves beautifully, completely following the clock.

I am out of ideas at the moment, embarrassingly. Does anyone have a clue what this could be caused by? The system clock edge looks just fine under an oscilloscope and so does the edge detector response, just looks like an exponential decay, and it was working just fine to write the RAM before.

EDIT:

Sorry guys, I jumped the gun a little bit. I shouldn't have assumed it was the RC edge detector's fault just because I disconnected the capacitor and that worked. The problem went away if I disconnected the edge detector output from the input of the NAND gate it's connected to, implying somehow the issue is further down the chain than the edge detector, perhaps more to do with that NAND gate or something connected to it.

Sorry for jumping to conclusions, but the issue is still present, and I want to understand what is causing this.

u/HydroPage — 17 days ago

But WHY do we need series resistors on our data LEDs? (video and small write-up)

Hey guys, HydroPage here. I am a computer engineer new to this community and I've been working on Ben's 8-bit CPU project. I recently made a silly mistake in my project that I quickly caught with analog intuition, and I've come to realize this issue is more prevalent than I thought.

I had built my registers for the computer and I wanted to test that I could transfer data from one bus to another, while directly attaching some LEDs to the "main bus" to show what was being output for the other register to read. It was not working: the "reading" register would read all 0s no matter what the "writing" register was outputting. I thought what the heck is going on here, and I quickly looked at the circuit and realized the LEDs were the issue. Here we see people make this mistake and tell them "please add a resistor to all LEDs", and that will fix the issue... but why?

Let me explain, because I think it's really cool and important to see the analog reason. I've made a video and cut it down to be somewhat short.

https://reddit.com/link/1u8guvo/video/ebvpo2upoa8h1/player

Summary of the video:

I built a very simple bit-transfer circuit where I write to a register, and then write the first output to the next chip. I show that it clearly isn't working, which is very weird. I demonstrate that removing the first red LED makes the circuit work just fine, so I try different colors: yellow doesn't work either, but somehow blue does. What the heck is going on here?

https://preview.redd.it/y1vpkj8ipa8h1.png?width=1202&format=png&auto=webp&s=deac50978fb077a428d986d11c4711ec66df504e

LED's true behavior:

An LED is a diode, a "light emitting diode", and all diodes have a characteristic, approximately constant voltage across them when they are conducting (it does increase with current, but very slowly). My specific red and yellow LEDs seem to have low-current Vf of about 2 Volts, and my blue one about 2.7 Volts.

Logic output true behavior:

A logic chip's output has one goal: keep the output voltage at the highest level it can, while supplying as much current as you want. To achieve this, it must have zero impedance, which is impossible, so it does its best. My specific chips refuse to output more than around 60 mA before sacrificing something else to make the output happy: the output voltage. In essence, the chip goes "I can't give you all the current you're asking for at the voltage you want it at, so I'll give you all the current I can and drop the voltage down". This is catastrophic. If the LED's Vf is about 2, the output may settle at, say, 2.2 or so for me, which is not enough for the next chip to see as a 1.

I measured where these registers detect a 0/1, and it's at about 2.6V, so if an LED has a low forward voltage like 2, and the output settles at about 2.2 when the chip outputs a 1, the next chip sees a 0 no matter what because of low voltage.

This also explains why the blue LED worked. It's low-current forward voltage is 2.7 Volts, which by itself is enough for the next chip to detect a "1" when the LED is on.

https://preview.redd.it/0h9rgy4tpa8h1.png?width=1426&format=png&auto=webp&s=ab81923929ba2b0855b3bbb86f49a84ceaaf602a

What if we add a series resistor?

Well, let's see. The open-circuit / open voltage of my output pins is about 4.8V. Here's our situation now:

Now the question is, "how much current are we asking the chip for?". Let's pretend we have a red LED (Vf = 2), a 220 Ohm resistor, and that the chip is able to hold the 4.8V steady on the output (assume we aren't asking it for more current than it can give us):

4.8 = 2 + Iout * 220

Iout = 12.7 mA

etc. for any resistor value you want. (To approximate the Vf of an LED / its "minimum on-voltage", try turning it on with a very large resistor so that little current is flowing, and measure the voltage across the LED.)

Is this good?

Absolutely. The chip will happily give you 12.7 milliamps for your LED while simultaneously holding the output voltage at well over the threshold to represent a digital 1 for the next chip. This solves the issue of possible data corruption.

Conclusion:

You need to add resistors to your data-view LEDs for several reasons:

  • If the output's value is needed by another input, a resistor prevents the LED from asking for too much current and dragging the output voltage down. This prevents data corruption.
  • To protect the LED itself. LEDs themselves have very low internal resistance, and will happily try to take tens of milliamps that a chip can give, which may burn them.
  • To protect the logic chip. Truth is, I kind of lied when I said a logic chip wants to give you current: no it doesn’t… it can tolerate giving it to you, but they are not actually designed to do this. You’ll find the datasheet of these register chips only wants you to ask the chip for about 3 milliamps, which is not much. Technically you should be using buffer ICs or transistors meant to drive these large currents. This is one of the more pedantic points I will make over a little breadboard project though, it’s not a big deal for us.
  • You only have limited current from your power supply. If you have a bunch of LEDs asking for tens of milliamps on at the same time, you will be in a little trouble with your power supply.

I'm probably going to be revising and editing this but I really hope this clears up some mystery for people about how direct connected LEDs can cause data corruption, and provide insight on LED resistor calculation and supply current budgeting. Thanks.

reddit.com
u/HydroPage — 19 days ago
▲ 266 r/beneater

I’m going all out on routing…

Howdy everyone. I’ve wanted to build Ben’s CPU for years, since I was in middle school. I finally got around to it as a computer engineering student, and I fully understand mostly everything he explains, but it’s lovely to see how he explains it.

I treat breadboarding as something very beautiful and personal, and I’m trying to route it better than he did (not in a “his routing sucks” way, but in a “I respect Ben a lot and I want to do the best I possibly can on his project”). I’m treating it almost like a craft project because I understand it anyway, so I want to make it as beautiful as I can.

Purely because of this, I discovered bit scrambling to make parallel buses route neatly. Last night I finished the RAM first try. Here is what I have so far (clock + RAM + instruction reg, and Arithmetic Unit).

I understand going this hard is harder to modify or change later, but that isn’t the point since the system is mostly planned out anyway.

What do y’all think so far?

u/HydroPage — 29 days ago

How much would you appreciate a final chat?

Howdy, I’d like to ask something. Is it really as uncommon as it looks for students to not really treat you like fellow people?

I am a computer engineer junior, and have taken two courses with probably my favorite professor I’ve ever had and will ever have. During the two courses I was the only student to ever interact with him during class and ask plenty of questions, I’d go to his office and ask him things I was curious about, and help struggling students in his office when there were too many, because I got very good at his content.

I found out a while ago he was retiring, and this semester that just ended was his last. Before I went home for the summer I asked to meet with him just one last time, and we just talked for 2+ hours, about everything, looking back on his career, hearing his story of everywhere he taught and how he felt, some technical topics sprinkled in. We only stopped because he had to go. We talked almost like friends, with clearly a lot of respect between us. At one point I shed some tears as I told him I hope he understands he will always come to mind when I want to do better as an educator, and I’m never going to forget him (I am a TA and want to be a professor of practice some day).

He’s the kind to not show a ton of emotion like me, I don’t really have a sense of how much he appreciated my gesture. Is it very uncommon for students to do this? Would you appreciate this a lot as a professor? I’m just wondering, and also just kind of wanted to vent since I’m a little sad about him leaving.

reddit.com
u/HydroPage — 2 months ago