USB Mass Storage device STM32

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.

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 :slight_smile:

Cheers

Phil

Oops, double post (it looked like it had hung!)

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

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:

…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 :slight_smile:

It should be quite a bit quicker now.

Cheers

Phil