My Mega Drive masterplan: electronics, EEPROM and whatnot

The Joy of Tech - Anything and everything about all things shiny..
User avatar
gravy
Sheepie Whore
Sheepie Whore
Posts: 19572
Joined: Wed May 01, 2002 1:28 pm 0
Location: The Other Place

Re: My Mega Drive masterplan: electronics, EEPROM and whatno

Post by gravy »

venusian wrote:What speed does the clock go on these cartridge ports? Does this generation still execute from ROM or copy to RAM? I'm guessing the former. I'm wondering how fast a microcontroller would have to be a service the bus directly.
The CPU definitely executes from ROM and runs at ~7.6mhz. The GPU and z80 have their own memory pools but I think you can DMA from the ROM as well. Not sure if the DMA and CPU can both read from ROM at once or if they share bandwidth.

Don't know much about microcontrollers but is it easy to get one with enough IO lines you'd need to plug it into the genesis?

EDIT

Yeah, the DMA controller freezes the 68k when transferring data from the 68k address range.It kind of looks like it works through the 68k so I -think- the DMA speed is limited by the CPU clock.
User avatar
Kamineko
Baaaaaaa!
Baaaaaaa!
Posts: 7569
Joined: Fri Dec 17, 2004 2:53 pm 0
Contact:

Re: My Mega Drive masterplan: electronics, EEPROM and whatno

Post by Kamineko »

Don't know much about microcontrollers but is it easy to get one with enough IO lines you'd need to plug it into the genesis?
There's only one thing for it. Multiple microcontrollers!
User avatar
gravy
Sheepie Whore
Sheepie Whore
Posts: 19572
Joined: Wed May 01, 2002 1:28 pm 0
Location: The Other Place

Re: My Mega Drive masterplan: electronics, EEPROM and whatno

Post by gravy »

I just had a bit of a look around, there's a load of cheap FPGA dev boards with a load of IO, quite a bit of RAM and stuff like USB / ethernet too :)
User avatar
Kamineko
Baaaaaaa!
Baaaaaaa!
Posts: 7569
Joined: Fri Dec 17, 2004 2:53 pm 0
Contact:

Re: My Mega Drive masterplan: electronics, EEPROM and whatno

Post by Kamineko »

Show show shoooow!

Maybe I could make a custom SNES board after that with a menu and all that jazz?
User avatar
gravy
Sheepie Whore
Sheepie Whore
Posts: 19572
Joined: Wed May 01, 2002 1:28 pm 0
Location: The Other Place

Re: My Mega Drive masterplan: electronics, EEPROM and whatno

Post by gravy »

User avatar
venusian
Baaaaaaa!
Baaaaaaa!
Posts: 6655
Joined: Wed Nov 06, 2002 2:22 pm 0
Location: South Gloucestershire

Re: My Mega Drive masterplan: electronics, EEPROM and whatno

Post by venusian »

Was thinking about an XMOS chip. Has custom hardware for dealing with high frequency IO and could probably service a bus at ~8MHz but has only 64KB of RAM so you'd have to shove the requests out to another chip which would probably introduce too much latency unless the access pattern is highly predictable, which it isn't going to be if there's direct execution going on.

Would be a good learning exercise for FPGA.
User avatar
Firefox
Sheepie Whore
Sheepie Whore
Posts: 11412
Joined: Fri Apr 26, 2002 6:15 pm 0
Location: Sheffield

Re: My Mega Drive masterplan: electronics, EEPROM and whatno

Post by Firefox »

I'm wondering if an STM32F4 (or similar) could do it.

Set aside 128kB of the microcontroller's SRAM as the cartridge image.

Sit the micro in a tight loop of four instructions: read the address from the Megadrive's address pins, look up the contents in SRAM, blat that out to the data pins, loop.

You could have a "magic button" connected to an interrupt pin on the micro that switches to a routine that puts a NOP opcode on the Megadrive data bus pins and lets you save/load ROM images.

The F4s I've used have run at 168MHz (I think there are some faster ones now), so it probably would be fast enough from the CPU standpoint if this simplistic approach would work. It might get a bit sticky if the Megadrive expects the full LDS/UDS, DTACK, OE, CE and all that to be respected. It would also depend on the latency of the micro's GPIO pins.
"I am a very considerate person. If I want to go out all night on my miniature golf course and shoot lizards, well, no reason to keep the neighbours awake..."
User avatar
Kamineko
Baaaaaaa!
Baaaaaaa!
Posts: 7569
Joined: Fri Dec 17, 2004 2:53 pm 0
Contact:

Re: My Mega Drive masterplan: electronics, EEPROM and whatno

Post by Kamineko »

Boards have been fabbed, depanelled and shipped. Gosh.
User avatar
Kamineko
Baaaaaaa!
Baaaaaaa!
Posts: 7569
Joined: Fri Dec 17, 2004 2:53 pm 0
Contact:

Re: My Mega Drive masterplan: electronics, EEPROM and whatno

Post by Kamineko »

Image

I ain't gonna lie to you. That's some real frickin' sweet stuff right there.
User avatar
Firefox
Sheepie Whore
Sheepie Whore
Posts: 11412
Joined: Fri Apr 26, 2002 6:15 pm 0
Location: Sheffield

Re: My Mega Drive masterplan: electronics, EEPROM and whatno

Post by Firefox »

Wow, that's really nice! (Excellent silkscreen, too!) :D

Was there anything special you had to do when laying out the edge connector? Do you have to add any extra specifications, like for the coating or anything?
"I am a very considerate person. If I want to go out all night on my miniature golf course and shoot lizards, well, no reason to keep the neighbours awake..."
User avatar
Kamineko
Baaaaaaa!
Baaaaaaa!
Posts: 7569
Joined: Fri Dec 17, 2004 2:53 pm 0
Contact:

Re: My Mega Drive masterplan: electronics, EEPROM and whatno

Post by Kamineko »

I used Bruce Tomlin's (http://atariage.com/forums/topic/164582 ... libraries/) edge connector library component in my eagle board, so I don't understand it fully. I just added the genesis library to the set, and plopped an instance of it on the schematic and wired away. It was really easy!

There's a few choices to pick from when you're putting it down: by default, you get the edge connector, standard Sega cart screwholes and the cutting outline of the bottom half of the board. You can pick a different part that has the EA oversized cart screwholes instead, or both sets of holes (which I used). You can also pick a part that just has the pads without the cutting outline if you wanted to make an unusually shaped cart.

I did have to do a little manual fiddling for the edge connector on the board. The edge connector is modelled as a series of rectangular areas with the routing origin of each connector in the centre. Left to its own devices Eagles autorouter will route things wherever it can find space, and tends to route the edge connector pads out of their left or right sides. It's 'fine', but I didn't think that having traces potentially under the edge contact fingers would be a good idea. You can manually route any part of the board you like though, whether you're laying a complete 'airwire' down onto the board, laying out -part- of an airwire or just adding new traces willy nilly. I manually partially routed the connections from the edge connector pads up the board a quarter of an inch to make them all safe, and then left the rest of the routing to Eagle.

I also went back to the schematic and categorised the connections as 'data' or 'power' and gave them custom separations and thicknesses. The power lines are supposed to have thicker traces (and I think they do, looking at the board) but the numbers I picked make it really subtle.

You can also put down tRestrict (41), bRestrict (42) and vRestrict (43) shapes onto the board to control the automatic routing. tRestrict and bRestrict prevent traces from being laid out on that side of the board in these areas. vRestrict prevents vias from being placed. This is all old hat if you've made a board before, so these notes are more for my benefit. :P

Image

Green here is vRestrict, which I've put down so there's no vias near where I'm gonna be doing all the soldering or near the edge connector. Blue and Red are tRestrict and bRestrict so I don't get traces near the screwholes if the board turns out wrong and I have to manually file things down. That'd only be the case if the measurements on Bruce's edge connector part were off, the fab produced the board wrong, or I bungled putting things down in the editor. I needn't have worried: Bruce's design was right on the money, OSH Park's fab is perfectly accurate, and I didn't make any novice mistakes.

As far as I'm aware there's no real trick to making a new placeable edge connector part in Eagle. Conductive areas (traces, the edge connector, vias, pads) all appear on the Top (1) and Bottom (16) Eagle layers. Layers tStop (29) and bStop (30) give the areas where you want the conductive layer exposed. The edge connector is just a bunch of rectangles on Top and Bottom, with matching areas on tStop and bStop. There's probably a helper macro in Eagle that you can use to make custom repeated things like that (give me X rectangles, 70 mil wide, 300 mil tall, 100 mil spacing, go!)

And speaking of making a new part, the (stolen) cat logo is a 'new part' that I created in Eagle using macro program that came with it. I think it's a Python script that converts a low resolution 1bit-per-pixel image into a series of rectangles on the silkscreen layer. You make your own custom parts library, make a 'catlogo' part (which opens the editor), run the script, and there he is, ready to be added to your board. Still can't believe it worked.

This is OSH Park's default board type. Top and bottom copper and a top silkscreen. Absolutely astonishing quality. Surprisingly heavy. Feels a bit like glass. The board isn't as bright as I thought it'd be. I thought it'd be visibly magenta. It's practically black with purple traces. Hella classy. They do other board types too; four layer boards if I remember right?

OSH Park were super helpful in looking over my board and all that stuff, and I didn't have to muck about with Gerber files: their semi-automated system accepts Eagle files and throws incredibly helpful preview images at you all the way through the process. I uploaded and deleted MegaBoard several times as I went through all the revisions. I'm glad I went for the expensive option rather than the cheaper Chinese guys. I'd much rather have (most likely) three crazy quality boards, than (most likely) five out of ten working boards which are slightly iffy. And I bet that if I ordered from China, they wouldn't be here for another month.

I've just tested all the connections on one of the boards. It's soldering time!
User avatar
Kamineko
Baaaaaaa!
Baaaaaaa!
Posts: 7569
Joined: Fri Dec 17, 2004 2:53 pm 0
Contact:

Re: My Mega Drive masterplan: electronics, EEPROM and whatno

Post by Kamineko »

As for coating specifically, I've just had a look in the editor and the edge connector does have tCream, bCream, tFinish and bFinish layers on its pads. I believe that OSH Park doesn't use them, but these would be the layers that you'd use to specify some kind of coating. You'd have to look up what your fab's conventions are.
User avatar
venusian
Baaaaaaa!
Baaaaaaa!
Posts: 6655
Joined: Wed Nov 06, 2002 2:22 pm 0
Location: South Gloucestershire

Re: My Mega Drive masterplan: electronics, EEPROM and whatno

Post by venusian »

That's fabulous. It seems like some kind of retro magic: you made a Megadrive cart, an actual real thing. Also 11/10 for the silkscreen.
User avatar
Firefox
Sheepie Whore
Sheepie Whore
Posts: 11412
Joined: Fri Apr 26, 2002 6:15 pm 0
Location: Sheffield

Re: My Mega Drive masterplan: electronics, EEPROM and whatno

Post by Firefox »

Many thanks for the writeup, Kamineko. That's really useful stuff.

I got most of the way through the Eagle tutorials a year ago when the project I was working on was stalled by the board layout technician being diverted to work on something else... I really should follow through and get something made, but I'm not sure quite what. :?

Anyway, awesome work! :)
"I am a very considerate person. If I want to go out all night on my miniature golf course and shoot lizards, well, no reason to keep the neighbours awake..."
User avatar
Kamineko
Baaaaaaa!
Baaaaaaa!
Posts: 7569
Joined: Fri Dec 17, 2004 2:53 pm 0
Contact:

Re: My Mega Drive masterplan: electronics, EEPROM and whatno

Post by Kamineko »

Image
Image
You can see all my neat parallel manually placed quarter-inch vertical traces at the bottom of the board here, and the line where Eagle's autorouter completes the job. This picture is making my soldering look much worse than it is... I maybe could get some 90% isopropyl alcohol to clean up that rosin debris there.

And you can definitely tell the difference between the 'power' and 'data' connections too. The thickness of the 'power' connections has made them appear purple, and the thinner 'data' lines are pink! Also also, board is semi transparent (like most PCBs I guess), so it looks pink when you hold it up to light and you can see both layers of traces through it. :)

One tip: don't try to prevent traces from passing between the edge connector pads by placing large horizontal bars of tRestrict and bRestrict. If your Restrict layers overlap the pads, Eagle will be prohibited from connecting anything to the pads at all.

How does this badass thing look in the machine?

Image
It looks like a boss, of course. I was a little worried that I might have mis-measured the height of the dome (using the hi-tech method of drawing across Arnold Palmer's face after sticking his cart in), but as you can see, this thing is precisely exactly how I wanted it to look. The sticking out chips and sockets are safely away from the dome. The board itself fits inside an EA cart, all I need to do is chop out the label section of an existing cart and there we go.

But does it WORK?

Image
Of course it does. I'm great.

This is MD Music Demo 1 Genesis Musicdisk/Chipdisk by Gigasoft. It's a music player with a bunch of Mega Man X and Final Fantasy tracks. At 29420 bytes, it's a perfectly sized test binary for my board. Yay! http://pdroms.de/genesis/md-music-demo- ... s-chipdisk

It didn't work first time, though. I wasn't quite sure how the endianness of the 68000 would interact with my cart. The address bus (A1-A16 and beyond) doesn't have an A0 (so it's always showing an address which is a multiple of two) so I link them to the A0-A15 on each EEPROM. In MegaBoard, the left chip is linked to D0-7 and the right chip is linked to D8-15. When I designed the board, I figured that the left chip would be serving bytes 0, 2, 4, 6 and the right chip would be serving bytes 1, 3, 5, 7, but the endianness of the 68000 must've flipped them round so what I assumed would be the 'high' chip needs to actually go in the left slot. If you put them in like I did in the image above, it won't work.

Or maybe I accidentally flashed the chips the wrong way round. Who can say! I'll have to verify that before I put the board design up for download.
That's fabulous. It seems like some kind of retro magic: you made a Megadrive cart, an actual real thing. Also 11/10 for the silkscreen.
Cheers. :3 Retro magic? More like a Christmas miracle. :)

That's two different twenty year old EEPROM chips from opposite corners of the globe put together on a board of my own design, soldered together in my bedroom and placed in an equally ancient console where they can each chuck out halves of an answer at a rate of millions of times per second. Blimey.

My favourite thing about the cart, apart from that I drew it out, soldered it and it FREAKIN' WORKS, is that it has my name on it. Too bad that 64kByte is bigger than even the smallest commercial MD rom (or so I'm told) but the board was never intended for that.

Now what am I gonna do with two spare boards...? I suppose that if I had a flawless completed debugged ROM image, I could flash and solder in some 28C256 chips directly* and make the board into some game permanently. Without the sockets it has the same profile as a commercial board, so it would fit into an existing EA case without a window**. I guess I'll put that idea on the shelf unless somebody wants to commission me to produce a real Mega Drive cart for them. :P

Now that I have MegaBoard v0.7 28C256 saved forever, there's no problem in swapping around the design for a much cheaper and more abundant 27C256 EPROM instead (or anything else really, board design in Eagle is misleadingly easy). They're just not my cup of tea and not what I had to hand. :)

* Ignoring that they're super valuable to me and I waited flipping months to get mine and you can't have them damn it.
** There are a couple of mounting pins at the top end of an EA case that need to be filed away and snapped off before a MegaBoard will lie in there perfectly. A future design might account for this I guess.
Post Reply