Reverse engineering the 1988 NeXT keyboard protocol
journal.spencerwnelson.com
journal.spencerwnelson.com
This is why I've never quite liked the Arduino ecosystem, the way it exists. Sure, it works and it's accessible to newcomers... but it doesn't encourage understanding the inner workings of the platform enough, which is something that is extremely valuable and accessible when you're working with simple 8-bit microcontrollers. Learning about hardware registers and clocks and cycle accuracy really isn't that scary, that's the point of using a tiny (and frankly obsolete) 8-bit platform!
But when you give people an API that takes an integer number of microseconds, and then approximates it, people are going to think they can bit bang an async serial protocol in C using it, and they will be very confused when it doesn't work (as happened here), and you end up in cargo cultish land of trying to work with bad data instead of developing an actual understanding of the hardware you're working with.
I've seen so many people thinking they need to design their bespoke board around an Arduino shield connector because the thought of just throwing on the ATMega directly scares them, even though the thing only needs 5V, GND, and crystal (if that), because what would they do outside the comfortable ecosystem? And it just makes me sad. If you're at the point you're designing your own semi complex boards and you haven't graduated from Arduino yet, you're not letting yourself grow.
(Or maybe I'm just an old millennial and I think these zoomers should be learning microcontrollers by programming in assembly like I did when I was 10 and using the PIClist delay routine generator and counting my cycles before Arduino existed, now get off my lawn? You decide :-) )
Like, I couldn't (or at least wouldn't) have gotten started on this project if I had to read the ATMega reference manuals from the very first step. But I did feel very frustrated that the Arduino "delayMicroseconds" function is so far off from accurate, and I felt frustrated also whenever I looked for deeper explanations of almost anything. It's a very copy-and-paste culture.
I eventually did find programming things more directly to be quite rewarding and worthwhile. My code is still in a ".ino" file, and uses some Arduino stuff, but it's basically built around ISRs in some frankencode middle state.
There's a lot of room for someone to create good tutorials and material for ramping up and out of Arduino. Would have helped me a lot, at least.
And then it should have an "export self-contained project" feature that gives you a directory containing a Makefile and all the dependencies to build your .ino, as source code form (and none of the ones you don't use), so you can easily see exactly what is getting built under the hood and can use that as a bridge to working outside the ecosystem. At the scale of 8-bit micros there's no reason not to work with copies of your dependencies, and it's very educational seeing everything in one place (and being able to hack on it) instead of having it scattered in a bunch of global package paths.
The frameworks and libraries are useful (if opaque and quirky and underdocumented), but the IDE is just so underwhelming... heck, it doesn't even manage to be a decent text editor.
Getting started with Arduino makes total sense, nobody's expecting newcomers to start off with the IC datasheet... but they should be able to eventually read the parts they need and work with it directly, instead of relying only on software abstractions. That's the beauty of these systems.
Good news they do exist (at least if i understood your statement correctly), You just need to search with the keywords "AVR", "atmega328", or whichever version you intend to use instead of "Arduino".
I attempted to make a simple PLC this summer and these resources were a great help :
[book] Make: AVR Programming https://www.amazon.com/AVR-Programming-Learning-Software-Tec...
and this complementary (or introductory) video to the book by the author i believe https://www.youtube.com/watch?v=ERY7d7W-6nA
[Youtube-videos] A playlist of Cornell's ECE 4760 AVR Lectures by the very chill "Bruce Land" (from 2012) : https://www.youtube.com/playlist?list=PLD7F7ED1F3505D8D5
The course website (labs, exercises and readings) : https://people.ece.cornell.edu/land/courses/ece4760/index_20...
Homeworks : https://people.ece.cornell.edu/land/courses/ece4760/homework... Labs : https://people.ece.cornell.edu/land/courses/ece4760/labs/old...
Although the course was centered around an atmega16 or something? i really don't recall sorry but the knowledge i gained was invaluable and easily transferable to a 328p.
Fundamentals of Microcontrollers - Arduino bare-metal breakdown (A playlist of a guy "Mitch Davis" exploring an atmega328 barebone and using tools like AVRdude etc..) https://www.youtube.com/playlist?list=PLNyfXcjhOAwOF-7S-ZoW2...
Atmel Programming Tutorial (by Chris Dahms ) https://www.youtube.com/playlist?list=PLoLaqVexEviMZu55Y4JO6...
Hope this helps.
Or, more accordingly, don't think the computer is magical.
Edit: it's a bit funny seeing someone trying to discover things by themselves but saying "it's difficult to measure pulse width with an oscilloscope" just triggered me - pun intended
I know it's cliché to tell people to go code in assembler but... this is where you do it, and why you do it. And it's easy. Seriously. These things are so simple it is not hard at all to learn how to code for them in asm. And it opens up a whole world of cool timing hacks you just can't do in C.
I haven't done much microcontroller stuff recently, but here's a thing I wrote for an ATtiny a while ago. This kind of tight timing bit banging hack is just not possible to do reliably in C.
But - to your point about Arduino's gaps - I have just no idea whatsoever how to build something like that. Not so much how to write the assembly - I've written a bit, and I'm sure I could work that out. No, I mean literally how I link and assemble the final program and get it to work on the chip.
I don't know whether that's just an Arduino problem, either. I find this stuff hard to google, but maybe I'm using the wrong terms - these are the perils of learning as you go.
But yes, mixing asm and C should be a lot easier and well documented. The repo I linked is a simple example of how to do it stand-alone, without any libs or Arduino anything, but... yeah.
This isn't exactly an Arduino problem; the "template project" issue is pretty common across the embedded industry. But for something as popular as Arduino not to have done a better job is unfortunate.
In the meantime, please read the manual or look up some tutorials on Youtube on how to use the oscilloscope. They're complicated for sure, but I think you had a popular hobbyist model and there should be help to be found. Failing that, look for the word "cursor" on the front panel; cursors is usually how you measure things and it's like at the core of scope functionality so it should not be hard.
Yes, it might be (easier if the timings are more flexible), but a naive sleep (that might be trying to use an internal timer) will throw you off
That's exactly my point, they would need assembler for that (or at least "predictable" C instructions)
For reliable embedded software I try and get the peripherals of the microcontroller to do all the timing critical work and my code sits up at a high level handling complete messages etc. Kind of the equivalent of "not blocking the event loop" in node, or functional vs imperative programming.
But the arduino libraries etc don't really fit well with this style, because they have to accommodate lowest common denominator chips like the ATMega. At least it's not PIC 8s I suppose...
For getting into embedded, I would strongly recommend the Teensy series (the 4.1 is joyful overkill for virtually any project). They are far more functional processors which are supported very well by the arduino ecosystem and have their own excellent set of libraries maintained by Paul which make full use of the hardware in the MCU. Being ARM based means that on chip debugging is relatively painless if it comes to that.
... and yet Arduino isn't actually teaching people how to do that :(
I'm a staunch proponent of using up to date MCUs, which means ARM these days, but I'd be completely on board with still using an ATMega as the default in 2022 for this kind of educational purpose if the point were actually being educational.
At least it's not a PIC16F84, I suppose. All the microcontroller books spent a decade teaching literally the lowest end, crappiest, and more expensive PIC in the series because it was the first model with Flash memory, and ignoring everything that came after it. Even those that were backwards compatible for all intents and purposes, and not any harder to incrementally learn.
Sadly, I'll never live in that universe.
Too bad windows and Linux don’t come with standard layouts that are more like Mac and probably next.
*The keyboard in the post has | in the right place but all my NeXT keyboards had it in some wackass position over the ten-key. Ridiculous.
Does anyone have a good overview of the free-software signal-analyzer-software/oscilloscope-software landscape? I've played with sigrok a little bit, enough to get it to decode some PS/2 signals I captured on an Arduino. OpenHantek looks pretty great over in oscilloscope-land. What else is out there, and what's better or worse, or why?
btw, some people tried to reverse engineer and rewrite the firmware for this Rigol https://www.eevblog.com/forum/projects/rigol-ds10xxz-firmwar...
Indeed teardown reveals https://blog.lvu.kr/kingst-la1010-logic-analyzer/ is using older FPGA and no dedicated memory buffer. Compare to LA1016 https://www.cnx-software.com/2014/12/30/la1016-la2016-and-la...
> 100 m @ 3 channels, 50 m @ 6 channels, 32 m @ 9 channels, 16 m @ 16 channels
all <40MB/s, so its purely streaming LA like original Salea.
Edit: ah, so its further optimized https://sigrok.org/wiki/KingST_KQS3506-LA16100 direct Salea logic16 clone, everything makes sense.
Stuff I find better with benchtops: - display update rates (I've caught random glitches I would never have been on a PC scope) - sample buffers - display options (persistent, colouring etc) - segmented capture modes (Siglent call it "history) - protocol triggering, which is incredibly useful for working with UART/CAN/SPI etc. Keysight nailed this. - glitch triggering - just triggering in general - realtime online protocol decode - user interface (in terms of having knobs and buttons rather than clicking on stuff)
Basically, I use my scope a lot as a more powerful logic analyzer for signals using less than 4 channels. I do have a backup LA, and Sigrok/Pulseview are fantastic when required (and support a lot more protocols). But a logic analyzer is never going to show you if you've got signal integrity issues.
As to why there aren't any open source benchtop scopes, good point. At least my Siglent is Zynq based with Linux for the UI/rendering/networking and FPGA for the quicker bits. The Keysight's have custom ASICs.
Bunny's Novena could be a good start towards the hardware.
I tend to simply set the sample count higher than needed and stop the capture prematurely.
https://www.eevblog.com/forum/testgear/logic-analyzer-that-i...
Still in production, still incredibly useful.
Still one of my favorite keyboards ever. And the Cube itself was so far ahead of everything else out there at the time that it felt like pure magic.
Ah, the good old days, when I used to argue with my buddy that my SGI Indigo was more magical than his NeXTcube. It was even more fun than the old Mac/PC arguments. The Android/iOS fights today just don't have the same lustre.
I admittedly enjoy the passion shown on both sides of any divisive issue in this peculiar realm: vi vs Emacs, sysd vs sysv, xorg vs Wayland, etc.
Pretty good thread: http://www.nextcomputers.org/forums/index.php?topic=3428.0
I also sometimes used an ADB NeXT keyboard with various Macs in the 1990s.
Appreciate the negativity though!