Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Micro SD card support #26

Open
ledah90 opened this issue Mar 16, 2023 · 15 comments
Open

Micro SD card support #26

ledah90 opened this issue Mar 16, 2023 · 15 comments

Comments

@ledah90
Copy link

ledah90 commented Mar 16, 2023

I have tested 4 different brand micro sd cards all formatted using the SD Card Formatter suggested in the instructions. I am unable to do anything on any card I place into the device. It is never registered as an available device. Does it need to be some special cluster size or brand? The brands I have tried are Sandisk, Samsung, Monster, and PNY. All micro SD cards are 4gb or less and FAT32 format with default cluster size.

@Ryzee119
Copy link
Owner

Hmm that's interesting

Have you enabled -DMSC_XMU=0 here

-DMSC_XMU=0
when compiling?

Also try increasing this a bit. The max is 4096.

-DXMU_SIZE_MB=8

@ledah90
Copy link
Author

ledah90 commented Mar 17, 2023

Yes, I have DMSC set to 1 and size set to 2048. I cleaned the solution and rebuilt again and I get "The memory unit you inserted isn't functioning; it may be damage." This is the same result on all 4 different cards. Does it need to match 4096 if I have a 4GB card?

@Ryzee119
Copy link
Owner

Nah that size doesn't have to match the SD card size.
Looks like you're doing everything right. it might be a bug. I'll have to look into it

Thanks for reporting the issue

@Ryzee119
Copy link
Owner

Does it work in your PC?

It should on first power up read the SD card for XMU_MSC.bin. if not present it will create it.

If you plug it into your PC does it show up as a mass storage device with that file?

@ledah90
Copy link
Author

ledah90 commented Mar 21, 2023

If I place the SD card in my computer, there is a file called XMU_MSC.bin that is 0 bytes. If I change the DXMU_SIZE_MB to 8mb, it creates the file as it should. With this 8mb file, I am still presented with the same "The memory unit you inserted isn't functioning; it may be damage." message. I have tried this on a 1GB, 2GB, and 4GB micro SD card.

@vwbug2007
Copy link

have anyone have issue with 3d printed case usb port crushing the sd card due to clearance issue i had one broken microsd card because of that i think the stl file needs to be changed to allow more clearnce ....if you have issues with microsd card check if its not bent or cracked in half....

@vwbug2007
Copy link

IMG_20230409_020849
IMG_20230409_020914

See?

@Ryzee119
Copy link
Owner

Ryzee119 commented Apr 9, 2023

@vwbug2007 this repo has no 3d printed case so we can't help here.

Please keep this issue clear as it relates to SD card firmware issues

@vwbug2007
Copy link

Yes, I have DMSC set to 1 and size set to 2048. I cleaned the solution and rebuilt again and I get "The memory unit you inserted isn't functioning; it may be damage." This is the same result on all 4 different cards. Does it need to match 4096 if I have a 4GB card?

same error as your hmmm....

@vwbug2007
Copy link

vwbug2007 commented Apr 9, 2023

If I place the SD card in my computer, there is a file called XMU_MSC.bin that is 0 bytes. If I change the DXMU_SIZE_MB to 8mb, it creates the file as it should. With this 8mb file, I am still presented with the same "The memory unit you inserted isn't functioning; it may be damage." message. I have tried this on a 1GB, 2GB, and 4GB micro SD card.

yeah samething i can see the file only zero bytes when i had it compiled with size 4096 on an old 8gb card ...

@vwbug2007
Copy link

one more thing on formatting microsd card to fat32 at what cluster size?

@ledah90
Copy link
Author

ledah90 commented Jul 29, 2023

Ok, I tested a few things out and figured out quite a bit. First the micro SD card I tested with is a SanDisk 2GB and formatted at 16byte cluster size. All tests were done on a 1.6 Xbox console using one 8bitdo v2 adapter and Xbox one controllers via Bluetooth. I tested viewing the memory card on a few dashboards. UnleashX and EvoX do not recognize the micro SD bin as a memory card or device. UIX Lite does see there is a memory card, but registers it as corrupted and unusable. The MS dashboard however sees the memory card just fine and can read and write to it. I also tested using a disc based game and the same game installed internally, but neither can see the memory card. You can use a USB hub connected to the controller USB port to connect 2 USB drives to act as a memory cards as well as use the ogx360. Hopefully some of this information is helpful in giving you some kind of direction. What console version and dashboard were you testing your original code on? I have several different consoles I can test against and want to replicate what you are using if possible.

@djholt
Copy link

djholt commented Aug 4, 2024

@ledah90 and anyone else who might be experiencing SD card read/write failures: my initial testing of the XMU emulation showed a lot of inconsistencies and failures like you're describing. My initial logic was to use older/smaller SD cards, because the Xbox is picky with memory storage, requires 4GB or less, etc. But the opposite strategy tends to work better here: try using newer/faster/larger SD cards.

The Teensy is mounting and accessing the SD card, not the Xbox directly, so it seems the better performance you can get from the SD card, the better the emulation works, at least in my testing. Larger SD cards generally have better read/write performance, so remember that while the max XMU size is 4096MB (just under to be safe), the SD card itself can be larger. I'm using a Samsung EVO 128GB micro SD card with a 4095MB XMU image written to it. It's working great for me.

I hope this helps someone seeing intermittent performance from the XMU emulation.

Also, for anyone interested in mounting the XMU image for reading/writing on a PC, refer to this.

@Ryzee119
Copy link
Owner

Ryzee119 commented Aug 4, 2024

Right, im fairly sure this is to do with SD card latency. The timeouts on xbox are very strict and all the overhead talking with the SD card can exceed the timeout sometimes and cause the Xbox to bail out.

Maybe some clever use of buffering into RAM could help here.

The way the code works is that is presents itself to the xbox as whatever the filesize of XMU_MSC.bin on the SD card is, so the size of the SD card does not matter.

If you get zero bytes on the file, try deleting the file on the SD card and trying again or generating your own XMU_MSC.bin file that is 8MB (can just contain zeros or whatever). This is a bug that doesnt recover very well.

@djholt
Copy link

djholt commented Aug 4, 2024

Makes a lot of sense. I do find it a little ironic that SD card latency becomes an issue over USB 1.1 bus speeds. Any recently-manufactured SD card really should be able to keep up, but not always the case.

And yes, I did observe more stability with slower cards when pre-initializing the .bin file to its intended size. I went a step further and wrote the fatx header to the file at the same time, but that was mostly after seeing some strange behavior from the Xbox when formatting XMUs >8MB.

Buffering in RAM is a great idea, but honestly, it's working really well for me currently with not-ancient SD cards.

Thanks @Ryzee119 !

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

No branches or pull requests

4 participants