Follow updates on Twitter using #ctrUSB
[Update Sep 26th, 2018]
I was able to write some bits to the SPI flash on Lego Starwars cartrdige, and the data got corrupted and the game did format the flash and resaved the data again. Which is very good news, I’m still not able to read from the Flash yet, but I’m almost there.
The USB cartridge is a project I’ve been planning for a long time, it’s basically a custom cartridge that has a micro USB port at the end of it and it will enable us to do data transfers to and from the 3DS, of course for those who are fortunate enough to have homebrew installed.
The planning for this project took more time than I thought it would, it’s very complicated to achieve, as there’s no built-in USB port or controller in the 3DS, but looking at the structure of the cartridge slot we can see multiple data pins, I’m using this amazing reference from 3dbrew.org those data pins specifically the ones related to the savegame chip 13 through 16 can even do SPI which a very good news.
The first approach
My first approach to the project was a very n00b like approach, I thought it would be very easy to directly tap into those pins using the APIs from DevkitPro, but I think I was wrong, as the APIs for the gamecard slot are very specific and won’t give us direct access to the physical pins, I was planning on sending data through the slot, and having a breakout cartridge with a USB port on the other end of it and do standard SPI and use the USB port to redirect the data to a serial terminal and view the data there. Which I think isn’t possible.
That one that might work
Looking at libctru filesystem services APIs I can find few methods that directly relate to the gamecard, all of them are gamesave related.
The API is all based on SPI connection between the device and the SPI Flash (NOR Flash) chip on the card, which might be the answer to all this, I think there’re two ways to use those APIs and the NOR Flash chip for the project.
I was able to use the CARDNOR APIs to write and read from the cartridge NOR Flash on LEGO Starwars 3 cartridge, and by looking on the internet I found multiple SPI Flash chips identical to the one 3DS cartridges use, so if I put one on a breakout cartridge board, and get a homebrew application to write data to it successfully this could be the answer to all this fuss that I got.
See from what I understood from those APIs, the savegame and SPI Flash are using specific FS structure (I may be wrong about this), so what will happen if I use the SPI Flash as a buffer, write all kinds of data to it temporarily and use another controller chip to forward that data to the USB port in a protocol that we can use with computers and then empty that SPI Flash just like a buffer, which may allow us to transfer files or even do screen video capturing,
All of the above is still theoretical, and I’m trying my hard to take as much time as possible from my evenings after work to debug this and get results, I did also order some flash chips and designed a debugging cartridge to use in this project.
You can find the debugging cartridge eagle files in here https://github.com/AhmedTheGeek/3DS-Gamecard
I’m by no means an expert in electronics nor 3DS development, I’m just a curious guy who loves to experiment, so if you have a better idea on how to do this, please let me know.
I’ll keep posting updates on this project as I make progress, so it would be nice to have a short name for it, so if you got an idea for a cool short name please write it in the comments.