TK. Posted March 14, 2010 Report Share Posted March 14, 2010 Indeed an interesting result! Could you please add a "benchmark" command (*) ? :) Best Regards, Thorsten. (*) e.g. generate a 1 MB file. Measure the time how long it takes to write and to read the file. Thereafter copy the file and measure the time again. At the end we will know the read and write performance + the handling performance on copy operations Quote Link to comment Share on other sites More sharing options...
philetaylor Posted March 14, 2010 Report Share Posted March 14, 2010 Here is the same MMC+ card using the new "benchmark" function, the copy overhead isn't much at all really.. [3101294.650] benchmark [3101300.205] benchmark: Starting [3101300.205] Write: 1048576 bytes in 1.375 seconds (762 KB/s) [3101300.205] Read: 1048576 bytes in 1.364 seconds (768 KB/s) [3101300.205] Copy: 1048576 bytes in 2.814 seconds (372 KB/s) Quote Link to comment Share on other sites More sharing options...
strophlex Posted March 14, 2010 Report Share Posted March 14, 2010 I ran the program on the FAT12 card. This is what I got. [12277.248] format [12277.250] Formatting SDCARD.... [12277.250] [GET_SECTOR_COUNT] Count is 1020 [12277.250] Drive Format Aborted! Quote Link to comment Share on other sites More sharing options...
philetaylor Posted March 14, 2010 Report Share Posted March 14, 2010 That is strange, can you try running this version (I have enabled debugging) Phil project.hex Quote Link to comment Share on other sites More sharing options...
strophlex Posted March 14, 2010 Report Share Posted March 14, 2010 That is strange, can you try running this version (I have enabled debugging) Phil [15701.245] ==================== [15701.245] SD Card Tools [15701.245] ==================== [15701.247] [15701.256] SD Card has been connected! [15701.276] Mounting SD Card... [15701.276] [disk_init] size = 4294967295 [15701.276] [disk_read] sector 0 (#1/1) [15701.276] [disk_read] sector 1 (#1/1) [15701.276] Failed to open directory / - error status: 13 [15701.276] ERROR while mounting SD Card! [15719.729] format [15719.731] Please type "format yes" to format sd/mmc card [15728.233] format yes [15728.236] Formatting SDCARD.... [15728.236] [disk_init] size = 4294967295 [15728.236] [GET_SECTOR_COUNT] Count is 1020 [15728.239] Drive Format Aborted! Quote Link to comment Share on other sites More sharing options...
philetaylor Posted March 14, 2010 Report Share Posted March 14, 2010 I know this really isn't helping you to get a working sd card but it gives me some really interesting debug info :) It looks like your card doesn't confirm to the SD spec fully. All of the SD/MMC cards that I have tested, all report csd->RdBlockLen of 9 whereas looking at your previous posts, yours reports 0. The format routine needs to know how many 512byte sectors can be written at a time and this uses RdBlockLen. Attached is a quick hack which forces rdblocklen to 9 if it is returned as 0...... Cheers Phil project.hex Quote Link to comment Share on other sites More sharing options...
strophlex Posted March 14, 2010 Report Share Posted March 14, 2010 I know this really isn't helping you to get a working sd card but it gives me some really interesting debug info :) It looks like your card doesn't confirm to the SD spec fully. All of the SD/MMC cards that I have tested, all report csd->RdBlockLen of 9 whereas looking at your previous posts, yours reports 0. The format routine needs to know how many 512byte sectors can be written at a time and this uses RdBlockLen. Attached is a quick hack which forces rdblocklen to 9 if it is returned as 0...... Cheers Phil This one did the trick! Quote Link to comment Share on other sites More sharing options...
strophlex Posted March 14, 2010 Report Share Posted March 14, 2010 But now OS X cant read it... I will format it in Windows now... Quote Link to comment Share on other sites More sharing options...
philetaylor Posted March 14, 2010 Report Share Posted March 14, 2010 That's great. Since I started looking at SDHC/MMC support some months ago, I have discovered that all cards were not created equal :) I will see if I can find a better solution (as that was a very quick hack). Cheers Phil Quote Link to comment Share on other sites More sharing options...
philetaylor Posted March 14, 2010 Report Share Posted March 14, 2010 But now OS X cant read it... I will format it in Windows now... before you format it in windows, could you just run the "filesys" command please? Cheers Phil Quote Link to comment Share on other sites More sharing options...
strophlex Posted March 14, 2010 Report Share Posted March 14, 2010 before you format it in windows, could you just run the "filesys" command please? Cheers Phil I am really sorry... Have already formatted in Windows. It now works perfect in all systems. If it is of any interest, here is the sdcard response for the card after format in windows: [ 271.359] SD Card Informations [ 271.359] ==================== [ 271.359] -------------------- [ 271.359] CID: [ 271.361] - ManufacturerID: [ 271.361] - OEM AppliID: [ 271.361] - ProdName: D016W [ 271.361] - ProdRev: 32 [ 271.363] - ProdSN: 0x097a1a00 [ 271.363] - Reserved1: 182 [ 271.363] - ManufactDate: 415 [ 271.365] - msd_CRC: 0x18 [ 271.365] - Reserved2: 1 [ 271.387] -------------------- [ 271.387] -------------------- [ 271.387] - CSDStruct: 0 [ 271.387] - SysSpecVersion: 9 [ 271.387] - Reserved1: 2 [ 271.387] - TAAC: 0 [ 271.387] - NSAC: 50 [ 271.387] - MaxBusClkFrec: 31 [ 271.387] - CardComdClasses: 1432 [ 271.387] - RdBlockLen: 0 [ 271.387] - PartBlockRead: 1 [ 271.387] - WrBlockMisalign: 1 [ 271.387] - RdBlockMisalign: 1 [ 271.387] - DSRImpl: 0 [ 271.387] - Reserved2: 0 [ 271.387] - DeviceSize: 1019 [ 271.387] - MaxRdCurrentVDDMin: 7 [ 271.387] - MaxRdCurrentVDDMax: 1 [ 271.387] - MaxWrCurrentVDDMin: 6 [ 271.387] - MaxWrCurrentVDDMax: 3 [ 271.387] - DeviceSizeMul: 7 [ 271.387] - EraseGrSize: 31 [ 271.387] - EraseGrMul: 28 [ 271.387] - WrProtectGrSize: 18 [ 271.387] - WrProtectGrEnable: 0 [ 271.387] - ManDeflECC: 2 [ 271.387] - WrSpeedFact: 0 [ 271.387] - MaxWrBlockLen: 0 [ 271.387] - WriteBlockPaPartial: 0 [ 271.387] - Reserved3: 0 [ 271.387] - ContentProtectAppli: 0 [ 271.387] - FileFormatGrouop: 1 [ 271.387] - CopyFlag: 1 [ 271.387] - PermWrProtect: 1 [ 271.387] - TempWrProtect: 0 [ 271.387] - FileFormat: 3 [ 271.387] - ECC: 3 [ 271.387] - msd_CRC: 0x6d [ 271.387] - Reserved4: 1 [ 271.389] -------------------- [ 271.389] Content of root directory: [ 271.389] MBSEQ_HW.V4 [ 271.391] [ 271.391] Checking SD Card at application layer [ 271.391] ===================================== [ 271.393] Retrieving SD Card informations - please wait! [ 271.393] SD Card: 'TODO': 4294 of 0 MB free [ 271.395] File MBSEQ_B1.V4: doesn't exist [ 271.395] File MBSEQ_B2.V4: doesn't exist [ 271.397] File MBSEQ_B3.V4: doesn't exist [ 271.397] File MBSEQ_B4.V4: doesn't exist [ 271.399] File MBSEQ_M.V4: doesn't exist [ 271.399] File MBSEQ_S.V4: doesn't exist [ 271.399] File MBSEQ_G.V4: doesn't exist [ 271.401] File MBSEQ_C.V4: doesn't exist [ 271.401] File MBSEQ_HW.V4: valid [ 271.403] done. Quote Link to comment Share on other sites More sharing options...
SMIDIRIN Posted March 16, 2010 Report Share Posted March 16, 2010 hi, still not able to format my 4gb, the sd formatter chnaged it from 128kb to 96kb! phil, your tool reports the following: [520691.203] format yes [520691.203] Formatting SDCARD.... [520691.203] Drive has no work area [520827.359] filesys [520827.359] Failed to open directory - error status: 12 i'm gonna borrow a card reader soon but till then i wonder if this card is trashed? s. Quote Link to comment Share on other sites More sharing options...
philetaylor Posted March 16, 2010 Report Share Posted March 16, 2010 i'm gonna borrow a card reader soon but till then i wonder if this card is trashed? It is possible that the card is faulty but it is also possible that the size detection algorythm that I am using is wrong :) I have made various changes to the detection code as it uses the cards CSD (Card Specific Data) to find the size etc of the card. Unfortunately, when I wrote the SDHC (V2.0) detection code I didn't realise that the CSD format had also changed. This is why csd->DeviceSize was reported as 0 in your earlier post. The CSD should now be correctly reported so could you try the CSD command on mios32_tools now please and post the results? The problem is that there are at least 3 distinct types of card, SD SDHC and MMC, each one requires special handling and although I do have one of each (which are working fine), different manufacturers seem to interpret the spec differently. Most of mine are SanDisk cards and because they wrote the SD/SDHC spec, hopefully they are the most compliant :) Cheers Phil Quote Link to comment Share on other sites More sharing options...
SMIDIRIN Posted March 22, 2010 Report Share Posted March 22, 2010 hi phil, thanks for the ongoing help with this one! heres what i get from CSD with tools from svn: [1001626.341] ==================== [1001626.341] SD Card Tools [1001626.341] ==================== [1001626.341] [1001626.431] SD Card has been connected! [1001626.435] Mounting SD Card... [1001626.437] SUCCESS: SD Card mounted! [1001632.796] csd [1001632.791] -------------------- [1001632.791] - CSDStruct: 1 [1001632.791] - SysSpecVersion: 0 [1001632.791] - Reserved1: 0 [1001632.791] - TAAC: 14 [1001632.791] - NSAC: 0 [1001632.791] - MaxBusClkFrec: 50 [1001632.791] - CardComdClasses: 1461 [1001632.791] - RdBlockLen: 9 [1001632.791] - PartBlockRead: 0 [1001632.791] - WrBlockMisalign: 0 [1001632.791] - RdBlockMisalign: 0 [1001632.791] - DSRImpl: 0 [1001632.791] - Reserved2: 0 [1001632.791] - DeviceSize: 0 [1001632.791] - MaxRdCurrentVDDMin: 3 [1001632.792] - MaxRdCurrentVDDMax: 5 [1001632.792] - MaxWrCurrentVDDMin: 4 [1001632.792] - MaxWrCurrentVDDMax: 1 [1001632.792] - DeviceSizeMul: 6 [1001632.792] - EraseGrSize: 31 [1001632.792] - EraseGrMul: 28 [1001632.792] - WrProtectGrSize: 0 [1001632.792] - WrProtectGrEnable: 0 [1001632.794] - ManDeflECC: 0 [1001632.794] - WrSpeedFact: 2 [1001632.794] - MaxWrBlockLen: 9 [1001632.794] - WriteBlockPaPartial: 0 [1001632.794] - Reserved3: 0 [1001632.794] - ContentProtectAppli: 0 [1001632.794] - FileFormatGrouop: 0 [1001632.794] - CopyFlag: 0 [1001632.794] - PermWrProtect: 0 [1001632.794] - TempWrProtect: 0 [1001632.794] - FileFormat: 0 [1001632.794] - ECC: 0 [1001632.794] - msd_CRC: 0x28 [1001632.794] - Reserved4: 1 [1001632.794] -------------------- [1001672.203] format yes [1001672.199] Formatting SDCARD.... [1001672.199] [GET_SECTOR_COUNT] Count is 1024 [1001672.199] Drive Format Aborted! :shocked: i've noticed i still have DeviceSize: 0 ?! oh, mine is toshiba brand if that's any help? :blink: s. Quote Link to comment Share on other sites More sharing options...
philetaylor Posted March 22, 2010 Report Share Posted March 22, 2010 i've noticed i still have DeviceSize: 0 ?! It looks like I never committed my latest changes to mios32_sdcard.c (oops!) Can you download the latest svn and try again please? Cheers Phil Quote Link to comment Share on other sites More sharing options...
SMIDIRIN Posted March 22, 2010 Report Share Posted March 22, 2010 well @ least it's not zero anymore.. [1036398.809] ==================== [1036398.809] SD Card Tools [1036398.809] ==================== [1036398.809] [1036398.898] SD Card has been connected! [1036398.902] Mounting SD Card... [1036398.904] SUCCESS: SD Card mounted! [1036415.906] csd [1036415.895] -------------------- [1036415.895] - CSDStruct: 1 [1036415.895] - SysSpecVersion: 0 [1036415.895] - Reserved1: 0 [1036415.895] - TAAC: 14 [1036415.895] - NSAC: 0 [1036415.895] - MaxBusClkFrec: 50 [1036415.895] - CardComdClasses: 1461 [1036415.895] - RdBlockLen: 9 [1036415.895] - PartBlockRead: 0 [1036415.895] - WrBlockMisalign: 0 [1036415.895] - RdBlockMisalign: 0 [1036415.895] - DSRImpl: 0 [1036415.895] - Reserved2: 0 [1036415.895] - DeviceSize: 7559 [1036415.895] - MaxRdCurrentVDDMin: 0 [1036415.895] - MaxRdCurrentVDDMax: 0 [1036415.895] - MaxWrCurrentVDDMin: 0 [1036415.895] - MaxWrCurrentVDDMax: 0 [1036415.895] - DeviceSizeMul: 240 [1036415.895] - EraseGrSize: 31 [1036415.895] - EraseGrMul: 28 [1036415.896] - WrProtectGrSize: 0 [1036415.896] - WrProtectGrEnable: 0 [1036415.896] - ManDeflECC: 0 [1036415.896] - WrSpeedFact: 2 [1036415.896] - MaxWrBlockLen: 9 [1036415.896] - WriteBlockPaPartial: 0 [1036415.896] - Reserved3: 0 [1036415.896] - ContentProtectAppli: 0 [1036415.896] - FileFormatGrouop: 0 [1036415.896] - CopyFlag: 0 [1036415.899] - TempWrProtect: 0 [1036415.899] - FileFormat: 0 [1036415.899] - ECC: 0 [1036415.899] - msd_CRC: 0x28 [1036415.899] - Reserved4: 1 [1036415.899] -------------------- [1036431.859] format yes it appeared hung here so i rebooted. only then did mios studio say: [1036683.414] Formatting SDCARD.... [1036683.414] [GET_SECTOR_COUNT] Count is 7741440 [1036683.414] [GET_BLOCK_SIZE] Block Size is 0 [1036683.414] [disk_write] error while writing to sector 13973 [1036683.414] Disk Function Error [1036683.415] SD Card disconnected! [1036683.417] [disk_initialize] error while checking for SD Card (status 0) [1036683.417] [disk_read] error while reading sector 0 [1036683.417] Failed to open directory / - error status: 1 so it was formatting? but REALLY slowly? how long should it take? :ahappy: progress! s. Quote Link to comment Share on other sites More sharing options...
philetaylor Posted March 22, 2010 Report Share Posted March 22, 2010 It should be pretty quick (a few seconds).... This looks like another CSD issue: [1036683.414] [GET_BLOCK_SIZE] Block Size is 0 This should be (16<<csd.DeviceSizeMul) although for some reason your DeviceSizeMul is 240 and 16<<240 will wrap quite a few times. I would expect DeviceSizeMul to be between 7 and 9 !!! Leave it with me for a while and I will see what I can do :) Cheers Phil Quote Link to comment Share on other sites More sharing options...
philetaylor Posted March 22, 2010 Report Share Posted March 22, 2010 (edited) Oops, double post (it looked like it had hung!) Edited March 22, 2010 by philetaylor Quote Link to comment Share on other sites More sharing options...
philetaylor Posted March 22, 2010 Report Share Posted March 22, 2010 OK try it now. I have tried another option which uses: 16 << (csd.DeviceSizeMul>>4) which should be a more reasonable number. Try the latest svn! Cheers Phil Quote Link to comment Share on other sites More sharing options...
SMIDIRIN Posted March 23, 2010 Report Share Posted March 23, 2010 somethings not right, but it's close (very close even). [1083763.251] Formatting SDCARD.... [1083763.251] [disk_init] size = 4294967295 [1083763.251] [GET_SECTOR_COUNT] Count is 7741440 [1083763.251] [GET_BLOCK_SIZE] Block Size is 524288 [1083763.251] [disk_write] sector 0 (#1/1) ...this took ~3hrs! [1093998.712] [disk_write] sector 524351 (#1/1) [1093998.712] [disk_write] sector 64 (#1/1) [1093998.849] [disk_write] sector 70 (#1/1) [1093998.849] Operation completed successfully then.. [1095689.218] filesys [1095689.217] [disk_init] size = 4294967295 [1095689.217] [disk_read] sector 0 (#1/1) [1095689.217] [disk_read] sector 63 (#1/1) [1095689.217] [disk_read] sector 64 (#1/1) [1095689.217] 64 sector/s per cluster, 112770 clusters. [1095689.217] 524192 sectors per FAT, first FAT at sector #96, root dir at #2. [1095689.217] 0 root dir entries (not valid for FAT32) [1095689.217] Filesystem: 0x03 (FAT32) is it usable now? :ermm: Quote Link to comment Share on other sites More sharing options...
philetaylor Posted March 23, 2010 Report Share Posted March 23, 2010 ...this took ~3hrs! That may be my fault... I inadvertantly left debugging on when I committed my last change. That logs every read and write to MIOS Studio which will "massively" slow the operation down :) It should be quite a bit quicker now. Cheers Phil Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.