Skip to content

Add DSpico flashcart SD card support - #987

Open
tasken wants to merge 10 commits into
d0k3:masterfrom
tasken:dspico-sd-support
Open

tasken wants to merge 10 commits into
d0k3:masterfrom
tasken:dspico-sd-support

Conversation

@tasken

@tasken tasken commented Oct 13, 2026 •

Copy link
Copy Markdown

Adds support for the SD card of a DSpico flashcart.

  • The DSpico SD shows up as its own drive, H:/, and works like the regular SD card
  • R+SELECT unmounts or remounts it, with a warning if the cart is pulled while mounted
  • Images can be mounted from it or alongside it, and existing drives are unchanged
  • Also works in script runner builds

Fixes #968

@Wolfvak

Wolfvak commented Oct 13, 2026

Copy link
Copy Markdown
Collaborator

It shares 7:/ with FAT images, so only one can be mounted at a time

I don't own a DSpico, what is the intended usecase here?

If it is moving data to/from the external cart SD to the internal SD or NAND, I think it makes more sense to share the drive with #9 (the RAMdrive) as people might still want to access the NAND partitions at the same time as the DSpico, but I can't imagine a usecase for moving data from the DSpico to the RAMdrive.

But I'm happy to be proven wrong on this too.

Comment thread arm9/source/gamecart/command_dspico.c Resolved
Comment thread arm9/source/gamecart/command_dspico.c Resolved
Comment thread arm9/source/gamecart/command_dspico.c Resolved
@tasken

tasken commented Oct 14, 2026

Copy link
Copy Markdown
Author

It shares 7:/ with FAT images, so only one can be mounted at a time

I don't own a DSpico, what is the intended usecase here?

If it is moving data to/from the external cart SD to the internal SD or NAND, I think it makes more sense to share the drive with #9 (the RAMdrive) as people might still want to access the NAND partitions at the same time as the DSpico, but I can't imagine a usecase for moving data from the DSpico to the RAMdrive.

But I'm happy to be proven wrong on this too.

The use case is moving files between the DSpico SD and the internal SD/NAND, yes.

My concern with 9:/ is that in my PR the DSpico automounts, and current GM9Megascript stages files in 9:/sdcompiled and then moves them to 0:/ for some operations. With the DSpico on 9:/, that would write to the DSpico card instead. The downside of 7:/ is that a NAND image can't be mounted at the same time.

Please let me know what you think.

@tasken

tasken commented Oct 15, 2026

Copy link
Copy Markdown
Author
  • DSpico transfers now wait with no timeout, same as the official DSpico dldi driver
  • Failed transfers and listing the cart don't reset the card anymore, that was causing the resets while copying
  • The cart drive now shows "DSPICO CART" so it doesn't get mixed up with the DSpico SD

@Wolfvak

Wolfvak commented Oct 15, 2026

Copy link
Copy Markdown
Collaborator

My concern with 9:/ is that in my PR the DSpico automounts, and current GM9Megascript stages files in 9:/sdcompiled and then moves them to 0:/ for some operations. With the DSpico on 9:/, that would write to the DSpico card instead. The downside of 7:/ is that a NAND image can't be mounted at the same time.

Please let me know what you think.

Then yeah, looks like we'll have to reuse this one.

DSpico transfers now wait with no timeout, same as the official DSpico dldi driver

I'm not against time-based timeouts, I think they're a good thing, but they shouldn't affect the critical path and ideally should only affect the error paths. If the official DLDI driver does this, then I think it's reasonable.

Failed transfers and listing the cart don't reset the card anymore, that was causing the resets while copying

Do you have any performance numbers? I'm not expecting a huge change as this sounds very bus limited (4 MHz / MiB/s?) but the higher the number, the better for us, as long as it's stable.

@tasken

tasken commented Oct 16, 2026 •

Copy link
Copy Markdown
Author

Did some extra debug, performance numbers on a 624 MB:

  • read: ~4.5 MiB/s (file hashing)
  • write: ~3.7 MiB/s (virtual to pico)

clock is the default 6.7 MHz, so ~6.4 MiB/s at most if it moves one byte per clock (haven't checked the gap cycles). I think the rest is the pico's per-command latency: the firmware serves one 512 byte sector per E5 and the read loop polls E4 before each one

@tasken

tasken commented Oct 16, 2026

Copy link
Copy Markdown
Author

Last commit: DSpico SD can now save the .sha file, like on the regular SD card

@fox8091

fox8091 commented Oct 18, 2026

Copy link
Copy Markdown
Contributor

Any chance we could just add a new drive? I know @Wolfvak mentioned not seeing a reason to transfer between RAMdrive and DSPico, I could see users wanting to transfer between two DSPicos or even two different flashcarts if support is ever added. That'd also give a new place to cleanly support Gateway carts, which I've wanted to implement for a while anyways, and a new drive letter would make a nice place to standardize on.

@Wolfvak

Wolfvak commented Oct 19, 2026

Copy link
Copy Markdown
Collaborator

Did some extra debug, performance numbers on a 624 MB:

* read: ~4.5 MiB/s (file hashing)

* write: ~3.7 MiB/s (virtual to pico)

clock is the default 6.7 MHz [...]

I think this is perfectly acceptable, nobody's expecting the NDS cart to be ultra fast, especially not when running on a microcontroller that has to deal with protocol overheads.

Sorry about not making many updates here but I'm still racking my brains trying to figure out a trivial way to add this drive without messing too much with GM9's insides, but do ping me here, on Discord or IRC if I haven't gotten back to you in a timely manner.

(if you figure out a way I'd be more than happy to hear it)

@Dionicio3

Dionicio3 commented Nov 7, 2026 •

Copy link
Copy Markdown

I've been waiting for this feature for a while now. One thing I do wanna say is that I cannot mount the DSpico's SD card when the default.nds flashed onto the cart is an ntrboot image of this build (I just get Cart init failed).

@tasken

tasken commented Nov 10, 2026 •

Copy link
Copy Markdown
Author

@Dionicio3, could you confirm if you are using this ntrboot image from the guide or a different one?

If you are building one yourself, could you try implementing this PR in it?

@Dionicio3

Dionicio3 commented Nov 10, 2026 •

Copy link
Copy Markdown

I was using a custom image I built by compiling this version of GM9, using firm-to-nds to convert to a usable nds with proper blowfish keys, and compiling it with the standard version of dspico-firmware. I did just try with edo's fork you posted right now, and while it did initially show the same error, removing and reinserting the cart got the SD to read properly. I have a feeling this may just be an issue with how you're detecting if a cart is a DSpico

@edo9300

edo9300 commented Nov 10, 2026

Copy link
Copy Markdown

@Dionicio3 if you only have flashed a ntrboot image and no ds/dsi mode rom to the pico, then the detection will fail as there won't be a rom with the DSPI or NTRJ gamecode exposed

@Dionicio3

Copy link
Copy Markdown

Yeah that's what I figured, hopefully something can be done to find a different way to detect a DSpico

@edo9300

edo9300 commented Nov 10, 2026

Copy link
Copy Markdown

Unfortunately there's no way, the dspico firmware wasn't tought with an ID command (which in hindsight would've been useful), and the moment you send an unknown command the cart locks up :(, so the only way is to check for known rom images it presents itself at. Still, with my fork you can get ntrboot while also serving a retail rom, making it work for this setup (so really having the pico only serving a ntrboot rom is not really a need).

@Dionicio3

Copy link
Copy Markdown

That's true, I suppose the only thing that should be addressed now is the cart not correctly initializing until it's removed and reinserted, maybe this could be solved by resetting the cart slot once it's fully booted? I want to be able to use the GM9 script runner with files from the DSpico's SD card, but the need to remove the cart initially may hinder that

@edo9300

edo9300 commented Nov 10, 2026

Copy link
Copy Markdown

That's true, I suppose the only thing that should be addressed now is the cart not correctly initializing until it's removed and reinserted, maybe this could be solved by resetting the cart slot once it's fully booted? I want to be able to use the GM9 script runner with files from the DSpico's SD card, but the need to remove the cart initially may hinder that

That should be accounted by the Cart_Init call here
https://github.com/tasken/GodMode9/blob/f8ee2cf208498d8f296931bee8bc4aa871c65068/arm9/source/gamecart/gamecart.c#L172

It does a cart reset which on the firmware side should trigger https://github.com/LNH-team/dspico-firmware/blob/3818a427a3932f7345295cf022a2f606a4c40f33/src/main.cpp#L92

@tasken

tasken commented Nov 10, 2026 •

Copy link
Copy Markdown
Author

Last commits, and marking this ready for review:

  • The DSpico SD now has its own drive, H:, so images can be mounted in parallel (using FAT_VOLUME_STRS)
  • Fixed the SD size on cards from wonky formatting tools
  • R+SELECT mounts/unmounts the DSpico SD, R+X is only unmounting images
  • Better handling when the DSpico SD fails to mount or is missing
  • Scripts can use the DSpico SD in script runner builds (@Dionicio3 request)

@tasken
tasken requested a review from Wolfvak November 10, 2026 19:20
@tasken
tasken marked this pull request as ready for review November 10, 2026 19:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE REQUEST] Support for accessing the DSpico SD card

5 participants