Close

Why'd I Stop?

A project log for sdramThingZero - 133MS/s 32-bit Logic Analyzer

Add an old SDRAM DIMM to your SBC for a 133MS/s 32-bit Logic Analyzer, add ADCs for a Scope...

eric-hertzEric Hertz 01/11/2022 at 17:180 Comments

This's been in my drafts since the turn of the year (It's now mid-April, and it's been snowing!?). I didn't finish this writing, there's a TON more could be said about how things like this have taken their toll on me. And, quite frankly, I'm a bit afraid to talk about this stuff, for COUNTLESS reasons. But... It happened, and things like it continue to happen. These things affect me every day, some near-decade later, and to lesser-noticed extents some decade prior. Facts are facts, I suppose. Whatever the heck it is, it seems I just can't wrap my head around it, nor really how to function in any reasonable capacity with it's presence in my life. It is what it is (what is it?!). I'm doing the best I can with what I understand.

Here's the original draft. Actually, I've tried to write about this COUNTLESS times, and I bet there are years-old drafts about it all over my projects' logs. Heh. Here's the January 2022 attempt:

....

This project, you may've noticed, went from ludicrous-speed to full-stop in basically one evening.

I've tried to explain to countless folk countless times and countless ways...

I haven't explained, here, because, frankly, it scared me. The event itself, and the implications. Still affect nearly all my projects to this day. Years later. Heck, frankly, it affects nearly every aspect of my life.

...

Today I woke with an analogy in my head...

 Imagine the "Pinball Wizard". This guy got really good at pinball, so good that he gained an audience. During a competition he made a mistake... he knows he did. He slipped, missed that button... No one else saw it. The paddle did its thing as though he hadn't. At the time he really didn't think about it... But after the excitement died down, he remembered his fumble... That should've been the end of his game, early-on. Instead, he went on for many more rounds, ultimately winning. What's he supposed to think? Eventually he puts it out of his mind... continues playing when he has time... Until another competition... huge crowd gathered around... He fumbles, again, yet the paddle hits the ball expertly... right up through "The Impossible Loop" gaining a gazillion points, flashing lights, and so many dings nearly every remaining angel-second-class must've gotten their wings. The crowd's going wild, but there's no paddling to do as the ball travels the loop. He knows he missed that shot, has time to think, he starts flailing on the paddle buttons... If those paddles did what they were told, that crowd would've thought he was having a seizure. When the ball returns, he hits it once or twice, as usual, then intentionally starts missing shots, yet those paddles keep hitting it perfectly. Eventually he just stops even pushing the buttons, but the game keeps playing without him.

Hey, this is the 70's, we're talking about, gaming AI is about as sophisticated as Pacman's ghosts... There's no way even the refridgerator-sized computers of the era could achieve the level of real-time physics calculation to keep that ball in play.

So what's left?

Remote controls and a video camera?

Whatever the case, even "in the zone" he knows he missed those shots, especially the ones he intentionally missed.

.

sdramThingZero was at a point where I was coding... Really low-level, I wrote my code changes in "baby steps," thoroughly testing each along the way. Small change, recompile, upload to the AVR, test test test, repeat. There's no operating-system to get a virus on a chip like this, no WiFi for remote-control... I'm coding in C at the lowest level possible. I wasn't even using others' libraries aside from defaults like avr-libc... heck, not even stdio. Certainly not Arduino. Basically aside from the initial boot code that calls main() I'd written /every/ piece of code running on that AVR. Heck, I wasn't even using a bootloader! My hex file was flashed at address 0.

Unlike pinball, there was no reliance on timing with external factors... My process was lock-stepped. Laid out in notes on paper. I was tackling the smallest steps first, building toward a rather large piece that couldn't be broken-up. I needed to be sure the surrounding code was right, so if I later had to debug the big piece I would know whatever was wrong had to be in there. In Other Words, I hadn't even begun coding that bigger piece, except on paper. About halfway through those smaller steps I flashed another small code-change, and instead of getting the results I was expecting, a *tiny* difference from the last, instead the system acted as though I'd written and uploaded the final /large/ code-addition.

Now, /that/ piece of code, which I had not yet typed, was filled with branches that should behave differently under different circumstances. And /new/ behavior. This couldn't've been some simple math or logic or syntax error. It, frankly, /couldn't/ function properly unless it had been fully-implemented, and correctly! I hadn't even typed one line of it. It couldn't function at all; it didn't even exist yet! Yet there it was, acting as if sent back from ten hours in the future.

...

This Sh** Is No Joke. Believe me, I wish it was. I'd been coding AVRs at this level as my main source of income, and hobby, for well over a decade, closer to two! Things continued to be weird like that, and upon looking back I can recall many smaller such instances, before, that I'd chalked-up to simply minor bugs I eventually tracked-down. But, usually in finding them, I'd had some nagging feeling the bugs I found *couldn't* have caused the effects I'd seen. Usually the bugs were simple syntax-errors, a missing semicolon, or an extra one e.g. after a while(), but before the loop it was supposed to contain. I'd eventually find this Glaring mistake, and usually be so glad to have spotted it as to simply fix it and test again, without really thinking about *whether* that mistake *could* cause that glitch. The subsequent test would act exactly as I'd originally intended, so I'd just move on, assuming I'd found and fixed whatever caused the glitch. And usually learning something new along the way, like, early-on, that assignments are allowed in comparisons "if(a=b>c)".... which can get really gnarly if not done VERY carefully, so such things I made a habit of NOT doing, unless there was no other option. And, such habits would make it that much easier to scan my code for bugs... "I know it *can* be done, but I don't do it. There it is, so that must be a mistype."

Unlike those past experiences that I moved-ahead from with merely a nagging feeling I didn't explain, sdramThingZero's "bug" wasn't a mal-function, per se... it was functionality that quite literally had not yet even been written. Quite literally as though I'd flashed the chip with a hex file compiled ten hours in the future. Those nagging feelings, long-ignored, came back to me in a flood at that moment... Memories of trouble-shooting bugs in many old projects, findings of syntax/coding-errors that, suddenly I realized, *couldn't* have caused the effects that yet were "fixed" after the code-fix...

I really don't know how to explain it better. Say your job was to transcribe court-room proceedings from audio recordings... You took a lunch break halfway through, and upon coming back found that two more pages were transcribed than what you had typed. Surely you'd think your boss or a friend did it so you could take off early for the day... right? You might (SHOULD) ask-around to find out whether you can trust whoever did it. Otherwise, for all you know, it might've been the result of a computer-virus. If you're doing work that important, and you can't find the perp, now you have to go over the whole thing again, from the beginning, to make certain it *all* is still transcribed properly. 

Other jobs maybe this sort of thing doesn't matter... Maybe these sorts of things happen to everyone and they just have no reason to notice. The pinball wizard just thinks it's excellent reflexes from years of practice. The "Work Hard Play Hard" yard-worker might, upon discovering half the yard's being mowed that he didn't remember doing before lunch, chalk it up to last night's heavy drinking...

Well, I do logic, and if there's anything in this world I'm good at it's that, and I *didn't* take a lunch break, and I didn't drink at the time. It, frankly, could *not* have happened. But It Did. And quite frankly, it scared the he** out of me. To the point that my usual gung-ho troubleshooting mentality (which I frankly somewhat enjoyed), went out the window, replaced by terror, and I haven't touched that code since.

This was not the last such incident, but definitely the most jarring, at least in the realm of my skills/projects.

After that I slowly tested the waters with other projects which, frankly, didn't matter much if such oddities happened. #OMNI 4 - a Kaypro 2x Logic Analyzer, and #Improbable AVR -> 8088 substitution for PC/XT were the big ones. 

The former was *supposed* to be just a few nights' effort backing-up a one-of-a-kind 5.25in floppy disk. It literally turned into a months-long near non-stop endeavor trying to squeeze out the data from the last few damaged sectors. I eventually started writing a program to read the entire track as though it was a single sector, then to parse the low-level data (headers, CRC) from it at the MFM-level. It became VERY sophisticated, yet ultimately may've recovered only one sector, whereas eventually I decided instead to use the more de-facto approach to see whether that same sector was readable that way, and sure-enough it came through, along with *several* (and eventually *all*) the others. This using the default method I'd tried *countless* times prior to even begin *thinking* to write that huge program. It didn't work before, so why'd it work then, after all that work, now unfinished and discarded?

It came as quite a blow, frankly. That was a TON of effort, on my part, using decades of related skills and months of new research... I thought I'd contribute that software to the opensource community... and yet ultimately it came down to something a "script-kiddy" could've done, running a small script, easily found online, in a loop, spinning that disk for a few days straight, waiting for luck.

.

The 8088->AVR project was a bit different, in that it was more of a personal-project which I knew from the start might branch off in unknown directions. And it sure did, right off the bat. I'm not much of an artist, so I guess in a way its "bugs" were my art. Working with the CGA video card I ran into quite a few "bugs," mostly related to timing errors and such that I'd love to blame on poor documentation, but were probably more-often due to poor interpretation, on my part. BUT, those "bugs" resulted in some awesome graphics I couldn't've created if I tried... So, I guess, it was a bit like my troubleshooting of years prior, often learning new things along the way. But, really, of little use, otherwise. Heh. On the other hand, after what I'd experienced with sdramThingZero, I was frankly afraid to tread into this realm of sort of accepting whatever *that* was into a project... And the graphics that resulted were often, frankly, eerie in ways that were hard to push through; reminding me regularly of that last night with sdramThingZero. And again, like backing up that floppy disk, taking exponentially longer than I'd expected due not to a lack of understanding of what I needed to do (the AVR circuitry design and drop-in was smooth as silk! That's no easy task; requiring tons of research into pin roles on both the AVR and 8088), but due to matters which, frankly, shouldn't've been matters. Ultimately, with that one, I /again/ found that, essentially, my *first-attempt* should've worked, since the final attempt which *did* work was the result of stripping down all that I'd built-up inbetween. Just like that friggin' floppy disk.

...

 I've been homeless for half a decade, since.

.........

...Heh, later the day I posted this, this showed up on the blog...

Notice anything buggy about that for loop? Oh, two things, actually... but one quite relevant.

Discussions