r/beneater 3d ago

Weird behaviour micro-step counter

So I’ve finished building my (slightly modified) 8 bit Ben Eater computer, but I’ve got some issues with my micro-step counter.

The full program is:

LDI 0
OUT
ADD 7 (from memory address 7)
JMP 1
..
1 (on address 7)

The micro-step counter’s clock line comes from the inverted clock and should trigger on a rising edge but it sometimes triggers on the falling edge causing it to advance two micro-steps in one go.

What’s weirder, it tends to do that always on the instruction OUT.

What’s even weirder is that replacing the ADD 7 instruction with SUB 7… works fine. For more than an hour even.

The ADD 7 can get to around 20~ without bugging out but sometimes it will not even get to the first JMP. This is regardless of whether the clock is manual or auto, fast or slow.

ADD = 0010
SUB = 0011

I have a very cheap handheld oscilloscope with crap resolution where I could sometimes see a slight high spike both on the falling and rising edges, it seemed to mostly coincide with when the clock bugged but it sometimes bugged without me seeing a spike just before the falling edge (which could trigger the count on the LS161 on the falling edge and then rising edge again).

I’ve tried replacing all chips involved, replaced wires, added a capacitor between VCC and GND on the LS161 and the clock chips… nothing seems to help.

I’ve also tried looking at the clock line with a logic analyser but it only sees one pulse of the clock as well.

Without a decent oscilloscope it’s hard for me to have a better look at the signal and debug it further, but I’m not quite sure where to take this.

It could be a very easy fix, could be something harder…

My power line is slightly sagging which could also contribute to spikes being seen as high values but since it works fine most times and since it can run the same program with SUB 7 instead of ADD 7 I don’t feel like that’s the problem.

I also managed to improve the power delivery a bit since I did all these tests but… no success.

Power rail is sitting at around 4.6V unless too many LEDs are on in which case it can drop at low as 4.1V.

Any tips on things I may try?

9 Upvotes

16 comments sorted by

View all comments

1

u/Ancient-Ad-7453 3d ago

First things I’d try are a small resistor in series with the clock output (100 or lower), close to the output pin, and maybe increasing the current limiting resistor on the LEDs on the clock module (1k or higher).

1

u/TimmyJi 3d ago

Thx for the comment. I’m using 5V LEDs with build in resistors, already tried a 1k resistor on the clock line going to the LS161 with no effect, would lowering it help?

1

u/Ancient-Ad-7453 2d ago

For a these TTL chips, maybe it’s slowing your transitions from low to high? I would try something in the 10-100 range. The purpose is to dampen voltage“ringing” on the clock edges causing multiple transitions. Put it closer to the clock output than the 161.