Notice: A non well formed numeric value encountered in /sites/ on line 96 Notice: A non well formed numeric value encountered in /sites/ on line 96 Notice: A non well formed numeric value encountered in /sites/ on line 96 Deprecated: Function create_function() is deprecated in /sites/ on line 104 Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /sites/ on line 845 Deprecated: Function create_function() is deprecated in /sites/ on line 111 FS#10415 : Cowon D2 SD(HC) driver



FS#10415 - Cowon D2 SD(HC) driver

Attached to Project: Rockbox
Opened by Rob Purchase (shotofadds) - Wednesday, 08 July 2009, 19:46 GMT
Last edited by Rob Purchase (shotofadds) - Wednesday, 12 August 2009, 21:15 GMT
Task Type Patches
Category Drivers
Status Closed
Assigned To No-one
Operating System Another
Severity Low
Priority Normal
Reported Version Version 3.3
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No


WARNING: This driver has not been widely tested and it may eat your SD cards. You have been warned, TRY IT AT YOUR OWN RISK!

This is a read/write SD(HC) card driver for the D2. It isn't complete, but it seems to work, and it seems reasonably fast (~7MB/s real-world read from a file).

There is NO hotswap ability yet, so you need to have the card inserted before bootup. It also doesn't support MMC cards.

The attached patch uses an SD card INSTEAD OF the internal flash. In order to use both drives, the multi-driver rework ( FS#9545 ) will need to be finished and applied.

I've tested this driver with a couple of different cards (SD and SDHC) without problems. Files seem to be saved correctly and chkdsk didn't report any problems.

However, when this driver was at an earlier stage of development (and contained more bugs than it does now!) I did manage to accidentally destroy my main 16Gb SDHC card.

So be warned, be careful which cards you use!
   sd.diff (18.6 KiB)
Closed by  Rob Purchase (shotofadds)
Wednesday, 12 August 2009, 21:15 GMT
Reason for closing:  Accepted
Additional comments about closing:  This is now enabled in SVN
Comment by Rob Purchase (shotofadds) - Monday, 13 July 2009, 21:00 GMT
The attached version integrates with the multi-driver patch to provide access to both SD and NAND drives. Make sure you apply  FS#9545  first.

With this version the SD card becomes the primary drive, so features such as saving settings/playlists/database etc etc work properly like they do on other Rockbox targets. Files on the internal flash drive are accessible by going to "<microSD1>" in the file browser (yes I know this is mis-labelled!)

Once you have updated the bootloader, you will need have an SD card with .rockbox folder inserted in order to boot Rockbox. I don't think that's too much to ask for the benefit of being able to save your settings/playlists... ;-)

I've also added support for hot-swapping SD cards to this version - although I haven't tested this much. We'll have to wait & see to find out how well Rockbox copes with swapping out the primary drive while running (just make sure you have the same version of .rockbox on both cards...!)

File read access seems to be generally faster with SD than from NAND, but the initial FAT mount / bootup seems to take longer from the SD card. I'm not sure why this is.
Comment by Rob Purchase (shotofadds) - Monday, 13 July 2009, 22:51 GMT
^^^ I described the above behaviour incorrectly. If there is no SD card inserted, bootup should fall back to the internal NAND - so you can still boot without an SD card if you want (you just won't be able to save settings etc). You can still insert an SD card afterwards and play music from it.

I've noticed a strange problem with one of my cards (a 16Gb Transcend SDHC). The FAT mount takes *ages* (and I guess eventually times out and fails), and when Rockbox eventually boots, it boots from the internal NAND instead of SD. The only files listed in the Files menu are from the internal flash. BUT the weird thing is, if I then hotswap to this card it works fine!

I need to do some more debugging :/
Comment by Rob Purchase (shotofadds) - Tuesday, 14 July 2009, 19:19 GMT
The attached v3 patch fixes the above problem - all 4 cards I tested now work properly at bootup, with no excessive delay.
Comment by Rob Purchase (shotofadds) - Thursday, 16 July 2009, 22:51 GMT
Update to sync with  FS#9545  v8, and to remove any remaining ambiguity between drive numbers and card numbers.

NOTE: If you boot with an SD card inserted and then remove it, there is currently a bug where you can't access files on the internal NAND either until you insert a card again. Need to look into this...
Comment by Maurus Cuelenaere (mcuelenaere) - Sunday, 19 July 2009, 00:21 GMT
This probably breaks compiling for the simulator; if so try moving the HAVE_MULTIDRIVE, HAVE_HOTSWAP & NUM_DRIVES defines into a #ifndef SIMULATOR block.
Comment by Rob Purchase (shotofadds) - Sunday, 19 July 2009, 14:42 GMT
I ran into that myself yesterday and did the same change. I'll commit the patch with this fix included later today.

For clarity, the remaining issues are:

1) Files on the internal memory (NAND) are found under "<microSD1>" in the File browser (this is just a display issue)

2) If you boot with an SD card inserted, and later remove the card, the File broswer won't show any files at all (not even those on the internal memory). All files become available again when you re-insert the card. I guess there's an assumption somewhere in the File browser code that drive(or volume?) 0 will always be present.

3) MMC cards are not supported. This driver is based on the PP microSD driver, which does not support MMC cards. MMC support could be added later, if there are actually D2 users who use these cards.