Reading real cartridges (Update - IT LIVES! - video)

Show off your completed Game Boy Zero, or post your build logs here!
User avatar
abrugsch
Posts: 971
Joined: Tue Aug 02, 2016 10:00 am
Has thanked: 356 times
Been thanked: 430 times
Contact:

Re: Reading real cartridges

Post by abrugsch » Wed Jan 11, 2017 7:38 am

Ah ok, some translation ;)
I also want to have a TFT in DPI mode
The usual way everyone is connecting their screens up uses the composite out of the pi. the screens then convert this mushy, lossy, analogue signal into the native pixel format of the LCD. However the Pi has the capability to drive screens directly without the double conversion, giving the best possible image quality. See @Kite's AIO board as he's doing this (which is one of the reasons why a kite AIO build is so tasty as it removes yet another PCB from the project) I was originally going to use an Adafruit PiTFT connected via SPI (another digital serial bus) and the image quality is great, but the lag is terrible. HOWEVER the Pi can drive the PiTFT directly but it comes with a downside of using nearly every single GPIO pin available.
takes I2C bus pins away
I2C is a digital serial bus that the GPIO port expanders use in this cart reader project, but if I enable DPI on the Pi, then the pins for I2C are re-appropriated
use SPI as the MCP23017
MCP23017 is the port expander chip I'm using in this project. lets me effectively have 16 extra GPIO pins per chip to play with. I'm using 2 so get an extra 32 pins which is great since to do cart reading I need 27. I already mentioned SPI and there's a variant of the 23017 called the MCP23S17that uses SPI instead of I2C. SPI is significantly faster than I2C.
I2C ends up being a bottleneck
In testing on my breadboard lash up I've been hitting the speed limitations of doing this on an ultra gnarly loose-wire setup and the larger cartridges take an age to download. it's entirely possible I'll hit the limitation of the I2C bus when I go to a PCB prototype, in which case I can switch up to SPI.
even in RGB565 mode.
back to talking about DPI mode - to use the full range of DPI - 24 bit colour - you need 8 bits per colour channel or RGB888 (8 bits Red, 8 bits Green, 8 bits Blue) but most emulated systems don't have that kind of colour depth so we can reduce the fidelity to RGB666 or even RGB565. what we lose in colour depth, we gain in GPIO pins being available. Unfortunately there's only so much tweaking you can do to configure which pins on the GPIO header are substituted and in every instance it seems that the pins I'm interested in are unavailable, which is a bit of a bugger!

User avatar
abrugsch
Posts: 971
Joined: Tue Aug 02, 2016 10:00 am
Has thanked: 356 times
Been thanked: 430 times
Contact:

Re: Reading real cartridges

Post by abrugsch » Wed Jan 11, 2017 9:16 am

kite wrote: it could be possible to make the Arduino read the data and transmit it over serial
yeah, that's what insidegadgets does on his cart reader (which my code was derived from) however the serial interface is major bottleneck from what I could tell. (the I2C method I have is I think already faster than the speeds that insidegadgets arduino implementation offers based on some of his blog posts for time taken to dump cartridges)
There is technically a second I2C port on the Pi, which is on the camera connector
ORly? this changes everything. what I2C id is it and how do you enable it?
How do you get the SPI out with DPI on? the only possible config mode I saw still blocked the CS pin (or I guess I can just hold it low and still address the IC's as per I2C)

User avatar
abrugsch
Posts: 971
Joined: Tue Aug 02, 2016 10:00 am
Has thanked: 356 times
Been thanked: 430 times
Contact:

Re: Reading real cartridges

Post by abrugsch » Wed Jan 11, 2017 10:10 am

Ooh!
Lots of options. Libftdi appears to be in raspbian jessie so that usb chip is a definite option. Cool.
Downside... ftdi lol.
Well I'll try a few things with i2c 0 as a first port of call. If I can run these 23017's at 1.7MHz then I think that should be plenty fast enough, potentoally nearing the throughput of the original cart bus...

User avatar
abrugsch
Posts: 971
Joined: Tue Aug 02, 2016 10:00 am
Has thanked: 356 times
Been thanked: 430 times
Contact:

Re: Reading real cartridges

Post by abrugsch » Wed Jan 11, 2017 5:19 pm

really starting to look like something proper now.
got some testing to do before I send it to be fabbed but now with added decoupling caps :D
altfront.png
altfront.png (300.29 KiB) Viewed 8951 times
altback.png
altback.png (378.26 KiB) Viewed 8951 times

User avatar
abrugsch
Posts: 971
Joined: Tue Aug 02, 2016 10:00 am
Has thanked: 356 times
Been thanked: 430 times
Contact:

Re: Reading real cartridges

Post by abrugsch » Mon Jan 16, 2017 6:00 am

Minor update, I've sent the PCB to OSHPark to be fabbed so should get it in a couple of weeks.

I've also updated the github repo to include a wiring diagram for anyone foolish enough to attempt this themselves ;)
https://github.com/abrugsch/GBCartSlurp ... iagram.svg

jellybelly
Posts: 219
Joined: Wed Nov 16, 2016 3:04 am
Location: UK
Has thanked: 3 times
Been thanked: 73 times

Re: Reading real cartridges

Post by jellybelly » Mon Jan 16, 2017 6:26 am

So forgive me for being somewhat at the dumber end of the spectrum here

But this will connect to a pi and produce a ton file from the game at the you put in it

:geek:

User avatar
abrugsch
Posts: 971
Joined: Tue Aug 02, 2016 10:00 am
Has thanked: 356 times
Been thanked: 430 times
Contact:

Re: Reading real cartridges

Post by abrugsch » Mon Jan 16, 2017 6:39 am

jellybelly wrote:But this will connect to a pi and produce a ton file from the game at the you put in it
ROM and savegame files (or just one or the other)

once you have the .sav file, you can use it with your emulator, play from the savegame.... then when you save back to it you can re-write the .sav back to the cart.

also useful for backing up a savegame before changing a battery

jellybelly
Posts: 219
Joined: Wed Nov 16, 2016 3:04 am
Location: UK
Has thanked: 3 times
Been thanked: 73 times

Re: Reading real cartridges

Post by jellybelly » Mon Jan 16, 2017 8:20 am

Hhmmm nice might solve my Lego Star Wars issue lol

User avatar
abrugsch
Posts: 971
Joined: Tue Aug 02, 2016 10:00 am
Has thanked: 356 times
Been thanked: 430 times
Contact:

Re: Reading real cartridges

Post by abrugsch » Mon Jan 16, 2017 9:27 am

yeah I read that thread. I haven't written GBA handling yet though...
once I get the PCB back that'll be my next port of call. My prototype lashup uses a DMG cart port which (I think) won't take a GBA cart...

User avatar
smithincanton
Posts: 13
Joined: Sun Sep 25, 2016 1:40 pm
Has thanked: 6 times
Been thanked: 7 times

Re: Reading real cartridges

Post by smithincanton » Tue Jan 17, 2017 2:40 pm

I had this SAME idea about a custom PiBoy Zero build. Will you be putting this up in the market? I would totally buy one.

Post Reply

Who is online

Users browsing this forum: Google Adsense [Bot] and 1 guest