Older entries are here
On 3d printing and cases..
It has been too long since I updated this blog space - about 10 months or so; i actuality, the last zikzak hackery was probably 6 or 8 months back, as I started to think about making a case for it, which led me back to the idea of a 3d printer .. and to buy one, or make one from scratch? I ended up tooling around with designing my own CNC machine (cutter) and combine it with a 3d printer (additive) - they're really the same machine design more or less, where you cut with one and draw with the other, but the same x-y-z machine, right? Well turns out with CNC you make waste, and little bits of wood or metal are flying off all over the place so you need a vacuum and a shield, and its noisey as all hell. Awesome to be sure, but just not as useful for me, right now. Also, its a lot more stress on the machine to do CNC (lateral grinding) than to just draw out a bead of plastic. Of course, drawing plastic is a whole world of pain too – thermal control is a nightmare, to heat and cool at just the right spots (cool on top, so molten plastic doesn't spooge out of your assembly; hot inside, so it flows; cool again, so that it doesn't melt all over the place and puddle, when you want it to stick; then heat underneath, so it doesn't cool _too quickly_ … ugggh). In the end, I built a incrementally better and better 3d printer, and then started merging in pieces from kits since I got less interested in designing my own printer to actually wanting it to be productive… so now I've got a beast half frankenstein thing of mine, with some really nice kit parts to make it work. So there, that was last winters project :) Then summer came.. and well, with a 3d printer, and summer, what things can you do … so I designed and flew a tricopter and quadcopter. Designed and fly RC machines is really tricky stuff.. but success! I suck as a pilot, but the blasted things work.
Did I end up with a case for zikzak? Well .. no. Not yet. But I've got a 3d printer, and learnt enough CAD that I could.. and thats a whole other exercise; the zikzak sbc rev3 pcb is a pretty nice board, but all the jacks on it are just header pins .. I figured at the time, just mount jacks on a case, and run the jumper wires to the header pins.. good to go right? Jacks take up a lot of space, and the pcb is already pretty darned tight, and you pay for every mm of size on there. Well, in practice, screwing metal jacks onto a printed plastic case is asking for cracks when those jacks are used (especially cartridge ports with a lot of stress around them.) The jacks should really be on the PCB, where you can screw them down and have a lot of solder, so they're good and sturdy, and no janky jumper wires to get loose.
There were a couple changes to make rev3 .. the audio chip just did not seem happy on the main system bus; all the signals are good, just the chip can't seem to get the data bus values. I suspect the waitstates are just not long enough for the old chip - a 1983 chip working with somethign 20 years its junior. Being sick of making costly revisions I've tied the eZ80 spare GPIO to the data bus on the audio chip, and now all is well.. excepting that GPIO is nolonger spare when the audio chipselect is active. A real shame not having a completely spare GPIO, but on the off chance it gets needed.. add some chipselect handling in your GPIO consumer, or don't drive audio at the same time :) (Or use the joystick GPIOs, or I2C, or SPI, or the cartridge expansion slot or stm32 spare GPIO or… lots of options. Anyway.)
I've also added the option to go to 512K RAM chip (128KB, 256KB and 512KB supported now – same pinout more or less); there are some extra pads added for setting a few choices or even adding a USB bus.
But all told, I think this is a 'good' gate; I've not tested everything (need to write a keyboard protocol driver to really test that, and make sure the full colour DAC still working), but none of that has changed in some revisions.
So. what is next?
Lots of roads to go down in the software side – making an actual cart game or two? getting BASIC interpreter working? formalizing the BIOS and memory map? Adding a SD card reader shield? A larger actual cart .. maybe an EPROM instead of EEPROM (seems they're getting harder to get..)
Some sick ideas are .. now that 512KB of RAM is in place, could perhaps port over uclinux; imagine a Linux cartridge for a Z80 system? Minds blown!
Or NuttX port..
Whose to say?
See the revisions page for a few details about these guys; I will have to update the site here to make it a little cleaner .. maybe have the dev blog as the default page and stick About on the side, since the blog is the real meat of things anyway, right?
I've been fortunate that all the revisions have worked well; a few glitches are to be expected, but overall I've been very pleased!
The “SBC” is the single-board-computer model of zikzak; previous versions were multiboard to make them easier to build and test and design, and to afford the possible idea of stacking them up to make a little inexpensive cube; combining into a SBC form makes the pcb a little more expensive, but is much easier to work with.
Rev1 was the first stab at this integration, and broadly works; the audio was acting up however.. turns out the Pokey (PSG, AY-3-8910, AY-3-8912, YM2149 by other names) wasn't really well behaved on the bus .. so whenever trying to read from ROM or RAM, it was clobbering some of the values. With just audio chip it worked fine, and without audio worked fine.. but all of them together, and glitchy display etc.. blast! Most of my tests are in isolation, and I managed to not perform a combined audio+others test on the previous standalone component boards. Oops.
Rev2 was a quick modification to address that; time has been very tight, so just applied a change to AY-3-8913 from -8912 edition. Same chip, but with a few less pins; the -8910 base model has a lot of extra pins no one used - dual I/O ports that could be handy for CPUs to avoid building their own IO system; -8912 has a single IO port, saving a bunch of pins; -8913 has no IO ports, but does have a proper chipselect (just like a RAM or ROM has.) So -8913 shoudl be better behaved on the bus .. when not its turn to function, it should get out of the way. Well, turns out it was still janky a little – the eZ80 even with slow crystal is too fast, and the data bus is not holding long enough; the audio wouldn't sound, since as the opcodes step by the data bus in updating, and not enough wait states. If only the AY-3-891x had a WAIT pin to inform the CPU when it was done latching the values…
Rev3 will be another stab to try and correct the audio; I've popped out the -8913 chip and plugged into a breadboard; then jumper over the data lines from the eZ80 GPIO-B port to the audio data bus lines, and jumpered over the other regular bus control pins to breadboard - essentially just using GPIO to drive the databus, but leaving everything else the same. This works a treat .. playing music out of zikzak SBC just fine. I really hate to lose GPIO-B as an available port, so I'll just leave the breakout header for it on the SBC.. if you're not driving the audio chip at the same time, you can use GPIOB just fine. - as a bonus though, with just a little bit of free time, I'll rotate a couple of the headers around to make using them easier - why not add a RAM upgrade? Currently 128KB but very similar pinout to go to 256KB or 512KB, and still support all 3 - Maybe add a USB header in case we want to talk to a USB device without goofing around…
One interesting aspect of robotics hacking is the broad skillset required; building my own retro computer from scratch was a lot of work but mostly in digital electronics, CAD, protocols like VGA etc.. Working on a robot car implies mechanical, learning about control of motors and servos and cameras, analog electronics and high voltage and high amperage management. Discovering that when a motor jams its amperage doubles and melts your wiring is an eye opener!
One of the bigger challenges I've encountered and generally avoided is making cases and support structures.. You can hit ebay for a bag of capacitors cheap.. But struts or metal or plastic plates, no dice!
Well, it turns out you can buy 4' by 8' sheets of hdpe plastic for say $50cdn at local shops. The thin stuff is used in making pop bottles.. Its strong by weight and light; it doesn't splinter like glass or acrylic.. Instead it tears. You can cut it with a jigsaw or hacksaw or circular saw etc so its nice to work with.
I don't need 32 square feet of material but the plastic guys sell scraps cheap! I picked up some square foot pieces quarter inch and 3/8 inch thick.. Can get half dozen good pieces in multiple colors for a ten spot!
Awesome find.. Good for Bolting pcbs and motors and sensors and such to, for making little ramps.. Wood is stronger but when you want some shiny black plates for making multilevel floors to sandwhich components between this stuff seems ideal. Doesn't break when you toss a quarter inch thick piece straight into a wall either.
(My current little car needs a layer for motor driver and batteries, a layer for distance sensors and radio/wifi receivers, maybe some ultrasonic sensors.. And a little ceiling piece perhaps. Once 'done' could add walls around to afford it some protection and look better.)
The zik80 SBC (or zikzak single board computer) pcb revision arrived a little while ago; this is 'everything on one board', excepting power; my current power pcb is needing a full redesign (using the 7805 at near an amp of draw is ridiculous .. the down conversion of voltage and current bleeds off as heat, and that much current needs a heat sink the size of your fist.) The actual computer/console design itself is pretty solid - the features are where I want them, the pcb layout is pretty good (not perfect, but few things ever are), and the damned thing works :) (mostly.)
The GPU-only pcb went through 2 revisions; the CPU pcb was only 1; putting them together so far - just one revision, but one wart has shown through. Blast! Still, it is probably fixable with just a jumper wire ('bodge'), but I'll get thigns fully working with hacks before making another pcb revision.. the pcb is large enough (6“x4”) that is costs a bit to make, and the components add up a little.
What went right? - merging it all into one pcb has mostly succeeded! A big complex board, but gorgeous imho; the cpu-only and gpu-only previous pcbs will be great for general projects (which is why they're full of breakout headers) so I don't consider them 'lost' or purely as 'cost of research' .. they're great little project boards; anyway, the SBC board works - RAM works, ROM works, audio works, CPU↔GPU via RAM works; I've not tested ps/2 keyboard yet (I need to write a driver for eZ80 yet), but using USB→serial→ works to either/both CPU and GPU; I've got a nice full colour little text menu shown when no cart present, to do some debug tests and demos. I have every confidence 99% of the board works.
What went wrong? - turns out I've managed not to test graphics and sound _at the same time_ before; when the AY-3-891x PSG Pokey sound chip is not taking instructions, its screwing with my bus for some reason. Maybe theres a little bug in the design somewhere, or maybe that chip just does that. Or maybe the address range for the audio isn't set right and the chip select is going at the wrong time. Either way.. it should be fixable; I may have to slice the current trace on the pcb, and jumper from an unused high address pin (or from an unused GPIO, or i2c, or some spare pin), and use that as the one control pin to audio .. or maybe I blew the inverter or something. Will check datasheets later. –> for now.. pop the PSG out of the socket and the RAM bus works fine; pop i tin, and I have to use every other address. Will sort it out soon.
Whats awesome? - added a basic 8×8 pixel font, and can draw text or graphics onto the raw framebuffer, and the gpu shows it. Pretty amazing. See video on youtube!
What to change? - At full 60 frames per second, sending 64KB of framebuffer data each time, sure kills the bus (and by extension, the eZ80 CPU's available time.) I was thinking of sending a scenegraph of instructions over RAM instead - a script of things to do (“draw lines here; draw sprites here”), which would reduce memory bandwidth enormously, but be a little goofy.. and non-retro. So instead I think I'll work on a tilemap based solution instead.. with 8×8 tiles, you end up with 1KB needed in RAM for a full screen tilemap; add in some slots for 'sprite 1, goes to (x,y)', and you're essentially needing just over a KB of data for each frame .. instead of 64KB/frame. (You also push the compositing from the eZ80 over to the GPU, but the GPU is pretty quick so thats okay.) This is also retro - thats more or less how the C64 does it, or the SNES, etc. “More or less”, without getting into details.
So .. the pcb is 'nearly there', just one or two small little issues (blast!), but otherwise working very well. *Happy*