Forum Rule: Always post complete source code & details to reproduce any issue!
Page 3 of 20 FirstFirst 1 2 3 4 5 13 ... LastLast
Results 51 to 75 of 477

Thread: Many TLAs: MTP MSC FS SD SDFat LittleFS UsbMSCFat to work with each other 8)

  1. #51
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    8,906
    Aargh and

    Sometimes it is the simple things!

    Like the right number of msc objects!

    I pushed up a change in my temporary branch...

    Sorry in this push, that I removed compiler stuff for MSC examples and accidentally pushed up my Sublimetext project/worksspace and build file... When I merge the stuff back over to the next higher
    version I won't include these changes...

    But the main change was:
    From: MSCClass msc[USE_MSC_FAT];
    To: MSCClass msc[USE_MSC_FAT_VOL];


    I still have hack in place that does not get the correct free space for partitions > 3gb... Will work on that again soon.


    But if anyone is still playing you might try picking that little change up and see if it works better for you.

  2. #52
    Senior Member wwatson's Avatar
    Join Date
    Aug 2017
    Posts
    424
    Quote Originally Posted by KurtE View Post
    Aargh and

    Sometimes it is the simple things!

    Like the right number of msc objects!

    I pushed up a change in my temporary branch...

    Sorry in this push, that I removed compiler stuff for MSC examples and accidentally pushed up my Sublimetext project/worksspace and build file... When I merge the stuff back over to the next higher
    version I won't include these changes...

    But the main change was:
    From: MSCClass msc[USE_MSC_FAT];
    To: MSCClass msc[USE_MSC_FAT_VOL];


    I still have hack in place that does not get the correct free space for partitions > 3gb... Will work on that again soon.


    But if anyone is still playing you might try picking that little change up and see if it works better for you.
    It's those little details that get me to. You know, the obvious ones that are so obvious you never notice them until they bite you
    Anyway tonight I will download your latest and hopefully this weekend I can play with it. I tend to keep several backups of anything I do a major change on. That's why I have the three computers and several backup drives. I am tempted to try using Windows 10 just to be aligned with you guys but am afraid to use it after the major lose of my work of several years due to ransom ware. This being Window 7 with antivirus protection. I do not want to spend money on antivirus programs and every year and fight anti virus settings which is what I did before and still lost. Maybe things have changed with Windows 10? Have not had the time to explore it

  3. #53
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    Location
    New York
    Posts
    6,835
    Quote Originally Posted by KurtE View Post
    Aargh and

    Sometimes it is the simple things!

    Like the right number of msc objects!

    I pushed up a change in my temporary branch...

    Sorry in this push, that I removed compiler stuff for MSC examples and accidentally pushed up my Sublimetext project/worksspace and build file... When I merge the stuff back over to the next higher
    version I won't include these changes...

    But the main change was:
    From: MSCClass msc[USE_MSC_FAT];
    To: MSCClass msc[USE_MSC_FAT_VOL];


    I still have hack in place that does not get the correct free space for partitions > 3gb... Will work on that again soon.


    But if anyone is still playing you might try picking that little change up and see if it works better for you.
    Morning all

    Gave the change quick try using a hub plus 1 old thumb drive formatted for 2GB and the 32GB SDCard/Adapter. Seems to come up a lot faster, and looks like it picks up the 2 drives and all the partitions. 3 partitions on the 32GB Card (1 partition is broke as I mentioned before so it bypassed that one) plus the the Thumb drive:
    Click image for larger version. 

Name:	Capture.PNG 
Views:	12 
Size:	21.3 KB 
ID:	23911

    Here is the entire dump of the SerMon if you are interested:
    Code:
    MTP_test
    SDIO Storage 0 254 sdio failed or missing
    SD Storage 1 10 sd1 failed or missing
    sd_addFilesystem: 0 20007038 RAM1
    RAM Storage 0 RAM1 199936 512
    sd_addFilesystem: 1 20007100 RAM2
    RAM Storage 1 RAM2 3999744 4096
    sd_addFilesystem: 2 200039a0 PROGM
    Program Storage 0 PROGM 983040 8192
    sd_addFilesystem: 3 20003ee0 QSPI
    QSPI Storage 0 QSPI 16777216 8192
    sd_addFilesystem: 4 20003fb4 sflash5
    SPIFlash Storage 0 5 sflash5 67108864 8192
    sd_addFilesystem: 5 2000408c sflash6
    SPIFlash Storage 1 6 sflash6 67108864 8192
    SPIFlash Storage 2 7 prop failed or missing
    sd_addFilesystem: 6 20007ba0 WINBOND1G
    Storage 0 3 WINBOND1G 131596288 9175040
    sd_addFilesystem: 7 20007c90 WINBOND2G
    Storage 1 4 WINBOND2G 265289728 9306112
    
    Initializing USB MSC drives...
    USB Drive Inserted
      Try Partiton:1 on MSC Index:0
    UsbBase::mscBegin called 200071e0 0 1
        After usbDriveBegin
    PFsVolume::begin(2000836c)
        ** SUCCEEDED **
    >> USB partition 1 valume ID: NEW VOLUME
    sd_addFilesystem: 8 20007ed8 MSC0-NEW VOLUME
      Try Partiton:2 on MSC Index:1
    UsbBase::mscBegin called 200071e0 0 2
        After usbDriveBegin
    PFsVolume::begin(2000881c)
      Try Partiton:3 on MSC Index:1
    UsbBase::mscBegin called 200071e0 0 3
        After usbDriveBegin
    PFsVolume::begin(2000881c)
      Try Partiton:4 on MSC Index:1
    UsbBase::mscBegin called 200071e0 0 4
        After usbDriveBegin
    PFsVolume::begin(2000881c)
    USB Drive Inserted
      Try Partiton:1 on MSC Index:1
    UsbBase::mscBegin called 200076c0 0 1
        After usbDriveBegin
    PFsVolume::begin(2000881c)
        ** SUCCEEDED **
    >> USB partition 1 valume ID: system-boot
    sd_addFilesystem: 9 20008388 MSC1-system-boot
      Try Partiton:2 on MSC Index:2
    UsbBase::mscBegin called 200076c0 0 2
        After usbDriveBegin
    PFsVolume::begin(20008ccc)
        ** SUCCEEDED **
    >> USB partition 2 valume ID: NEW VOLUME1
    sd_addFilesystem: 10 20008838 MSC1-NEW VOLUME1
      Try Partiton:3 on MSC Index:3
    UsbBase::mscBegin called 200076c0 0 3
        After usbDriveBegin
    PFsVolume::begin(2000917c)
        ** SUCCEEDED **
    >> USB partition 3 valume ID: exFat
    sd_addFilesystem: 11 20008ce8 MSC1-exFat
      Try Partiton:4 on MSC Index:4
    UsbBase::mscBegin called 200076c0 0 4
        After usbDriveBegin
    PFsVolume::begin(2000962c)
    sd_addFilesystem: 12 2000423c sdio
    
    **** dir of sd[0] ****
    
    Setup done
    CMD: 1002(OPEN_SESSION)l: 16 T:0 : 1
    RESP:2001(RSP:OK)l: 16 T:0 : 1
    CMD: 1001(GET_DEVICE_INFO)l: 12 T:1
    RESP:2001(RSP:OK)l: 12 T:1
    CMD: 1014(GET_DEVICE_PROP_DESC)l: 16 T:2 : d402
    RESP:2001(RSP:OK)l: 16 T:2 : d402
    CMD: 1004(GET_STORAGE_IDS)l: 12 T:3
    RESP:2001(RSP:OK)l: 12 T:3
    CMD: 1005(GET_STORAGE_INFO)l: 16 T:4 : 1
    1 0 name:RAM1 vol:
    1 0 name:RAM1 vol:
    RESP:2001(RSP:OK)l: 16 T:4 : 1
    CMD: 1005(GET_STORAGE_INFO)l: 16 T:5 : 2
    2 1 name:RAM2 vol:
    2 1 name:RAM2 vol:
    RESP:2001(RSP:OK)l: 16 T:5 : 2
    CMD: 1005(GET_STORAGE_INFO)l: 16 T:6 : 3
    3 2 name:PROGM vol:
    3 2 name:PROGM vol:
    RESP:2001(RSP:OK)l: 16 T:6 : 3
    CMD: 1005(GET_STORAGE_INFO)l: 16 T:7 : 4
    4 3 name:QSPI vol:
    4 3 name:QSPI vol:
    RESP:2001(RSP:OK)l: 16 T:7 : 4
    CMD: 1005(GET_STORAGE_INFO)l: 16 T:8 : 5
    5 4 name:sflash5 vol:
    5 4 name:sflash5 vol:
    RESP:2001(RSP:OK)l: 16 T:8 : 5
    CMD: 1005(GET_STORAGE_INFO)l: 16 T:9 : 6
    6 5 name:sflash6 vol:
    6 5 name:sflash6 vol:
    RESP:2001(RSP:OK)l: 16 T:9 : 6
    CMD: 1005(GET_STORAGE_INFO)l: 16 T:a : 7
    7 6 name:WINBOND1G vol:
    7 6 name:WINBOND1G vol:
    RESP:2001(RSP:OK)l: 16 T:a : 7
    CMD: 1005(GET_STORAGE_INFO)l: 16 T:b : 8
    8 7 name:WINBOND2G vol:
    8 7 name:WINBOND2G vol:
    RESP:2001(RSP:OK)l: 16 T:b : 8
    CMD: 1005(GET_STORAGE_INFO)l: 16 T:c : 9
    ###FatPartition::freeClusterCount: FT:16 start:69 todo:61679
        m_sectorsPerCluster:32
        m_clusterSectorMask:31
        m_sectorsPerClusterShift:5
        m_fatType:16
        m_rootDirEntryCount:512
        m_allocSearchStart:1
        m_sectorsPerFat:241
        m_dataStartSector:583
        m_fatStartSector:69
        m_lastCluster:61678
        m_rootDirStart:551
        m_bytesPerSector:512
    9 8 name:MSC0-NEW VOLUME vol:
    9 8 name:MSC0-NEW VOLUME vol:
    RESP:2001(RSP:OK)l: 16 T:c : 9
    CMD: 1005(GET_STORAGE_INFO)l: 16 T:d : a
    ###FatPartition::freeClusterCount: FT:32 start:2080 todo:516192
        m_sectorsPerCluster:1
        m_clusterSectorMask:0
        m_sectorsPerClusterShift:0
        m_fatType:32
        m_rootDirEntryCount:0
        m_allocSearchStart:1
        m_sectorsPerFat:4033
        m_dataStartSector:10146
        m_fatStartSector:2080
        m_lastCluster:516191
        m_rootDirStart:2
        m_bytesPerSector:512
    10 9 name:MSC1-system-boot vol:
    10 9 name:MSC1-system-boot vol:
    RESP:2001(RSP:OK)l: 16 T:d : a
    CMD: 1005(GET_STORAGE_INFO)l: 16 T:e : b
    11 10 name:MSC1-NEW VOLUME1 vol:
    11 10 name:MSC1-NEW VOLUME1 vol:
    RESP:2001(RSP:OK)l: 16 T:e : b
    CMD: 1005(GET_STORAGE_INFO)l: 16 T:f : c
    12 11 name:MSC1-exFat vol:
    12 11 name:MSC1-exFat vol:
    RESP:2001(RSP:OK)l: 16 T:f : c
    CMD: 1005(GET_STORAGE_INFO)l: 16 T:10 : d
    13 12 name:sdio vol:
    13 12 name:sdio vol:
    RESP:2001(RSP:OK)l: 16 T:10 : d
    CMD: 9801(GET_OBJECT_PROPS_SUPPORTED)l: 16 T:11 : 3000
    RESP:2001(RSP:OK)l: 16 T:11 : 3000
    CMD: 9801(GET_OBJECT_PROPS_SUPPORTED)l: 16 T:12 : 3001
    RESP:2001(RSP:OK)l: 16 T:12 : 3001

  4. #54
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    8,906
    @mjs513, now We need to find way to update the free/used space.

    And need to test unplugging a device and do we properly remove the partitions...

    Also I again want to try updating the StorageIDs... They are currently not to specification. The high word should be storage and low word is sort of sub-storage...
    I am curious if that will allow the names to show up on Linux and the like...

    Also for example if you look at some of the messages/events like:
    G.2.6 StoreRemoved
    Event Code: 0x4005
    Parameter 1: StorageID
    Parameter 2: None
    Parameter 3: None
    The indicated stores are no longer available. The opposing device may assume that the StorageInfo datasets and ObjectHandles associated with those stores are no longer valid.
    The first parameter is used to indicate the StorageID of the store that is no longer available. If the store that has been removed is only a single logical store within a physical store, the entire StorageID shall be sent, which indicates that any other logical stores on that physical store are still available. If the physical store and all logical stores upon it are removed (for example, removal of an ejectable media device that contains multiple partitions), the first parameter shall contain the PhysicalStorageID in the most significant sixteen bits, with the least significant sixteen bits set to 0xFFFF.
    Which in the case of one of our MSC drives being removed this feels more appropriate...

  5. #55
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    Location
    New York
    Posts
    6,835
    @KurtE
    Ran a couple of test cases just out of curiosity.

    First case was as described in my previous post which we know worked. But then I unplugged the SDcard adapter and plugged it back it - it seemed to work but I had to do a refresh to refresh to get all the partitions back again:
    Code:
    *MTPD::send_Event(4005) a
    *MTPD::send_Event(4005) b
    *MTPD::send_Event(4005) c
    *MTPD::send_Event(400b)
    CMD: 1007(GET_OBJECT_HANDLES)l: 24 T:13 : 1 0 ffffffff
    RESP:2001(RSP:OK)l: 24 T:13 : 1 0 ffffffff
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:14 : 18 dc02 (FORMAT)
    RESP:2001(RSP:OK)l: 20 T:14 : 18 dc02
    CMD: 9802(GET_OBJECT_PROP_DESC)l: 20 T:15 : dc41 3000 (PERSISTENT_UID)
    RESP:2001(RSP:OK)l: 20 T:15 : dc41 3000
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:16 : 18 dc41 (PERSISTENT_UID)
    RESP:2001(RSP:OK)l: 20 T:16 : 18 dc41
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:17 : 17 dc02 (FORMAT)
    RESP:2001(RSP:OK)l: 20 T:17 : 17 dc02
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:18 : 17 dc41 (PERSISTENT_UID)
    RESP:2001(RSP:OK)l: 20 T:18 : 17 dc41
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:19 : 16 dc02 (FORMAT)
    RESP:2001(RSP:OK)l: 20 T:19 : 16 dc02
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:1a : 16 dc41 (PERSISTENT_UID)
    RESP:2001(RSP:OK)l: 20 T:1a : 16 dc41
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:1b : 15 dc02 (FORMAT)
    RESP:2001(RSP:OK)l: 20 T:1b : 15 dc02
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:1c : 15 dc41 (PERSISTENT_UID)
    RESP:2001(RSP:OK)l: 20 T:1c : 15 dc41
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:1d : 14 dc02 (FORMAT)
    RESP:2001(RSP:OK)l: 20 T:1d : 14 dc02
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:1e : 14 dc41 (PERSISTENT_UID)
    RESP:2001(RSP:OK)l: 20 T:1e : 14 dc41
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:1f : 13 dc02 (FORMAT)
    RESP:2001(RSP:OK)l: 20 T:1f : 13 dc02
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:20 : 13 dc41 (PERSISTENT_UID)
    RESP:2001(RSP:OK)l: 20 T:20 : 13 dc41
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:21 : 12 dc02 (FORMAT)
    RESP:2001(RSP:OK)l: 20 T:21 : 12 dc02
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:22 : 12 dc41 (PERSISTENT_UID)
    RESP:2001(RSP:OK)l: 20 T:22 : 12 dc41
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:23 : 11 dc02 (FORMAT)
    RESP:2001(RSP:OK)l: 20 T:23 : 11 dc02
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:24 : 11 dc41 (PERSISTENT_UID)
    RESP:2001(RSP:OK)l: 20 T:24 : 11 dc41
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:25 : 10 dc02 (FORMAT)
    RESP:2001(RSP:OK)l: 20 T:25 : 10 dc02
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:26 : 10 dc41 (PERSISTENT_UID)
    RESP:2001(RSP:OK)l: 20 T:26 : 10 dc41
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:27 : f dc02 (FORMAT)
    RESP:2001(RSP:OK)l: 20 T:27 : f dc02
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:28 : f dc41 (PERSISTENT_UID)
    RESP:2001(RSP:OK)l: 20 T:28 : f dc41
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:29 : e dc02 (FORMAT)
    RESP:2001(RSP:OK)l: 20 T:29 : e dc02
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:21 : 12 dc02 (FORMAT)
    RESP:2001(RSP:OK)l: 20 T:21 : 12 dc02
    1 vol:
    RESP:2001(RSP:OK)l: 16 T:e : b
    sterSectorMask:31
        m_sectorsPerClusterShift:5
        m_fatType:16
        m_rootDirEntryCount:512
        m_allocSearchStart:1
        m_sectorsPerFat:241
        m_dataStartSector:583
        m_fatStartSector:69
        m_lastCluster:61678
        m_rootDirStart:551
        m_bytesPerSector:512
    ‚ YhԨj6-Ÿ]:]qƒ,P
    yxpy	wD˜b-}’{T.›U:œ0!"o5œ0.VoŒ5‘p" –ˆ/%9803(GET_OBJECT_PROP_VALUE)l: 20 T:2a : e dc41 (PERSISTENT_UID)
    RESP:2001(RSP:OK)l: 20 T:2a : e dc41
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:2b : d dc02 (FORMAT)
    RESP:2001(RSP:OK)l: 20 T:2b : d dc02
    CMD: 9802(GET_OBJECT_PROP_DESC)l: 20 T:2c : dc41 3001 (PERSISTENT_UID)
    RESP:2001(RSP:OK)l: 20 T:2c : dc41 3001
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:2d : d dc41 (PERSISTENT_UID)
    RESP:2001(RSP:OK)l: 20 T:2d : d dc41
    CMD: 9802(GET_OBJECT_PROP_DESC)l: 20 T:2e : dc01 3001 (STORAGE_ID)
    RESP:2001(RSP:OK)l: 20 T:2e : dc01 3001
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:2f : d dc01 (STORAGE_ID)
    RESP:2001(RSP:OK)l: 20 T:2f : d dc01
    CMD: 1007(GET_OBJECT_HANDLES)l: 24 T:30 : 1 0 d
    RESP:2001(RSP:OK)l: 24 T:30 : 1 0 d
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:31 : 23 dc02 (FORMAT)
    RESP:2001(RSP:OK)l: 20 T:31 : 23 dc02
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:32 : 23 dc41 (PERSISTENT_UID)
    RESP:2001(RSP:OK)l: 20 T:32 : 23 dc41
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:33 : 22 dc02 (FORMAT)
    RESP:2001(RSP:OK)l: 20 T:33 : 22 dc02
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:34 : 22 dc41 (PERSISTENT_UID)
    RESP:2001(RSP:OK)l: 20 T:34 : 22 dc41
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:35 : 21 dc02 (FORMAT)
    RESP:2001(RSP:OK)l: 20 T:35 : 21 dc02
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:36 : 21 dc41 (PERSISTENT_UID)
    RESP:2001(RSP:OK)l: 20 T:36 : 21 dc41
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:37 : 20 dc02 (FORMAT)
    RESP:2001(RSP:OK)l: 20 T:37 : 20 dc02
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:38 : 20 dc41 (PERSISTENT_UID)
    RESP:2001(RSP:OK)l: 20 T:38 : 20 dc41
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:39 : 1f dc02 (FORMAT)
    RESP:2001(RSP:OK)l: 20 T:39 : 1f dc02
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:3a : 1f dc41 (PERSISTENT_UID)
    RESP:2001(RSP:OK)l: 20 T:3a : 1f dc41
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:3b : 1e dc02 (FORMAT)
    RESP:2001(RSP:OK)l: 20 T:3b : 1e dc02
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:3c : 1e dc41 (PERSISTENT_UID)
    RESP:2001(RSP:OK)l: 20 T:3c : 1e dc41
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:3d : 1d dc02 (FORMAT)
    RESP:2001(RSP:OK)l: 20 T:3d : 1d dc02
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:3e : 1d dc41 (PERSISTENT_UID)
    RESP:2001(RSP:OK)l: 20 T:3e : 1d dc41
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:3f : 1c dc02 (FORMAT)
    RESP:2001(RSP:OK)l: 20 T:3f : 1c dc02
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:40 : 1c dc41 (PERSISTENT_UID)
    RESP:2001(RSP:OK)l: 20 T:40 : 1c dc41
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:41 : 1b dc02 (FORMAT)
    RESP:2001(RSP:OK)l: 20 T:41 : 1b dc02
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:42 : 1b dc41 (PERSISTENT_UID)
    RESP:2001(RSP:OK)l: 20 T:42 : 1b dc41
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:43 : 1a dc02 (FORMAT)
    RESP:2001(RSP:OK)l: 20 T:43 : 1a dc02
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:44 : 1a dc41 (PERSISTENT_UID)
    RESP:2001(RSP:OK)l: 20 T:44 : 1a dc41
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:45 : 19 dc02 (FORMAT)
    RESP:2001(RSP:OK)l: 20 T:45 : 19 dc02
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:46 : 19 dc41 (PERSISTENT_UID)
    RESP:2001(RSP:OK)l: 20 T:46 : 19 dc41
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:47 : 19 dc01 (STORAGE_ID)
    RESP:2001(RSP:OK)l: 20 T:47 : 19 dc01
    CMD: 1007(GET_OBJECT_HANDLES)l: 24 T:48 : 1 0 19
    RESP:2001(RSP:OK)l: 24 T:48 : 1 0 19
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:49 : 2d dc02 (FORMAT)
    RESP:2001(RSP:OK)l: 20 T:49 : 2d dc02
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:4a : 2d dc41 (PERSISTENT_UID)
    RESP:2001(RSP:OK)l: 20 T:4a : 2d dc41
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:4b : 2c dc02 (FORMAT)
    RESP:2001(RSP:OK)l: 20 T:4b : 2c dc02
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:4c : 2c dc41 (PERSISTENT_UID)
    RESP:2001(RSP:OK)l: 20 T:4c : 2c dc41
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:4d : 2b dc02 (FORMAT)
    RESP:2001(RSP:OK)l: 20 T:4d : 2b dc02
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:4e : 2b dc41 (PERSISTENT_UID)
    RESP:2001(RSP:OK)l: 20 T:4e : 2b dc41
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:4f : 2a dc02 (FORMAT)
    RESP:2001(RSP:OK)l: 20 T:4f : 2a dc02
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:50 : 2a dc41 (PERSISTENT_UID)
    RESP:2001(RSP:OK)l: 20 T:50 : 2a dc41
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:51 : 29 dc02 (FORMAT)
    RESP:2001(RSP:OK)l: 20 T:51 : 29 dc02
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:52 : 29 dc41 (PERSISTENT_UID)
    RESP:2001(RSP:OK)l: 20 T:52 : 29 dc41
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:53 : 28 dc02 (FORMAT)
    RESP:2001(RSP:OK)l: 20 T:53 : 28 dc02
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:54 : 28 dc41 (PERSISTENT_UID)
    RESP:2001(RSP:OK)l: 20 T:54 : 28 dc41
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:55 : 27 dc02 (FORMAT)
    RESP:2001(RSP:OK)l: 20 T:55 : 27 dc02
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:56 : 27 dc41 (PERSISTENT_UID)
    RESP:2001(RSP:OK)l: 20 T:56 : 27 dc41
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:57 : 26 dc02 (FORMAT)
    RESP:2001(RSP:OK)l: 20 T:57 : 26 dc02
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:58 : 26 dc41 (PERSISTENT_UID)
    RESP:2001(RSP:OK)l: 20 T:58 : 26 dc41
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:59 : 25 dc02 (FORMAT)
    RESP:2001(RSP:OK)l: 20 T:59 : 25 dc02
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:5a : 25 dc41 (PERSISTENT_UID)
    RESP:2001(RSP:OK)l: 20 T:5a : 25 dc41
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:5b : 24 dc02 (FORMAT)
    RESP:2001(RSP:OK)l: 20 T:5b : 24 dc02
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:5c : 24 dc41 (PERSISTENT_UID)
    RESP:2001(RSP:OK)l: 20 T:5c : 24 dc41
    CMD: 1007(GET_OBJECT_HANDLES)l: 24 T:5d : 2 0 ffffffff
    RESP:2001(RSP:OK)l: 24 T:5d : 2 0 ffffffff
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:5e : 2e dc02 (FORMAT)
    RESP:2001(RSP:OK)l: 20 T:5e : 2e dc02
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:5f : 2e dc41 (PERSISTENT_UID)
    RESP:2001(RSP:OK)l: 20 T:5f : 2e dc41
    CMD: 1007(GET_OBJECT_HANDLES)l: 24 T:60 : 3 0 ffffffff
    RESP:2001(RSP:OK)l: 24 T:60 : 3 0 ffffffff
    CMD: 1007(GET_OBJECT_HANDLES)l: 24 T:61 : 4 0 ffffffff
    RESP:2001(RSP:OK)l: 24 T:61 : 4 0 ffffffff
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:62 : 2f dc02 (FORMAT)
    RESP:2001(RSP:OK)l: 20 T:62 : 2f dc02
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:63 : 2f dc41 (PERSISTENT_UID)
    RESP:2001(RSP:OK)l: 20 T:63 : 2f dc41
    CMD: 1007(GET_OBJECT_HANDLES)l: 24 T:64 : 5 0 ffffffff
    RESP:2001(RSP:OK)l: 24 T:64 : 5 0 ffffffff
    CMD: 1007(GET_OBJECT_HANDLES)l: 24 T:65 : 6 0 ffffffff
    RESP:2001(RSP:OK)l: 24 T:65 : 6 0 ffffffff
    CMD: 1007(GET_OBJECT_HANDLES)l: 24 T:66 : 7 0 ffffffff
    RESP:2001(RSP:OK)l: 24 T:66 : 7 0 ffffffff
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:67 : 30 dc02 (FORMAT)
    RESP:2001(RSP:OK)l: 20 T:67 : 30 dc02
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:68 : 30 dc41 (PERSISTENT_UID)
    RESP:2001(RSP:OK)l: 20 T:68 : 30 dc41
    CMD: 1007(GET_OBJECT_HANDLES)l: 24 T:69 : 8 0 ffffffff
    RESP:2001(RSP:OK)l: 24 T:69 : 8 0 ffffffff
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:6a : 32 dc02 (FORMAT)
    RESP:2001(RSP:OK)l: 20 T:6a : 32 dc02
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:6b : 32 dc41 (PERSISTENT_UID)
    RESP:2001(RSP:OK)l: 20 T:6b : 32 dc41
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:6c : 31 dc02 (FORMAT)
    RESP:2001(RSP:OK)l: 20 T:6c : 31 dc02
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:6d : 31 dc41 (PERSISTENT_UID)
    RESP:2001(RSP:OK)l: 20 T:6d : 31 dc41
    CMD: 1007(GET_OBJECT_HANDLES)l: 24 T:6e : 9 0 ffffffff
    RESP:2001(RSP:OK)l: 24 T:6e : 9 0 ffffffff
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:6f : 34 dc02 (FORMAT)
    RESP:2001(RSP:OK)l: 20 T:6f : 34 dc02
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:70 : 34 dc41 (PERSISTENT_UID)
    RESP:2001(RSP:OK)l: 20 T:70 : 34 dc41
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:71 : 33 dc02 (FORMAT)
    RESP:2001(RSP:OK)l: 20 T:71 : 33 dc02
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:72 : 33 dc41 (PERSISTENT_UID)
    RESP:2001(RSP:OK)l: 20 T:72 : 33 dc41
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:73 : 33 dc01 (STORAGE_ID)
    RESP:2001(RSP:OK)l: 20 T:73 : 33 dc01
    CMD: 1007(GET_OBJECT_HANDLES)l: 24 T:74 : 9 0 33
    RESP:2001(RSP:OK)l: 24 T:74 : 9 0 33
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:75 : 36 dc02 (FORMAT)
    RESP:2001(RSP:OK)l: 20 T:75 : 36 dc02
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:76 : 36 dc41 (PERSISTENT_UID)
    RESP:2001(RSP:OK)l: 20 T:76 : 36 dc41
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:77 : 35 dc02 (FORMAT)
    RESP:2001(RSP:OK)l: 20 T:77 : 35 dc02
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:78 : 35 dc41 (PERSISTENT_UID)
    RESP:2001(RSP:OK)l: 20 T:78 : 35 dc41
    CMD: 1007(GET_OBJECT_HANDLES)l: 24 T:79 : d 0 ffffffff
    RESP:2001(RSP:OK)l: 24 T:79 : d 0 ffffffff
    CMD: 1002(OPEN_SESSION)l: 16 T:0 : 1
    RESP:2001(RSP:OK)l: 16 T:0 : 1
    CMD: 1001(GET_DEVICE_INFO)l: 12 T:1
    RESP:2001(RSP:OK)l: 12 T:1
    CMD: 1004(GET_STORAGE_IDS)l: 12 T:2
    RESP:2001(RSP:OK)l: 12 T:2
    CMD: 1005(GET_STORAGE_INFO)l: 16 T:3 : 1
    1 0 name:RAM1 vol:
    1 0 name:RAM1 vol:
    RESP:2001(RSP:OK)l: 16 T:3 : 1
    CMD: 1005(GET_STORAGE_INFO)l: 16 T:4 : 2
    2 1 name:RAM2 vol:
    2 1 name:RAM2 vol:
    RESP:2001(RSP:OK)l: 16 T:4 : 2
    CMD: 1005(GET_STORAGE_INFO)l: 16 T:5 : 3
    3 2 name:PROGM vol:
    3 2 name:PROGM vol:
    RESP:2001(RSP:OK)l: 16 T:5 : 3
    CMD: 1005(GET_STORAGE_INFO)l: 16 T:6 : 4
    4 3 name:QSPI vol:
    4 3 name:QSPI vol:
    RESP:2001(RSP:OK)l: 16 T:6 : 4
    CMD: 1005(GET_STORAGE_INFO)l: 16 T:7 : 5
    5 4 name:sflash5 vol:
    5 4 name:sflash5 vol:
    RESP:2001(RSP:OK)l: 16 T:7 : 5
    CMD: 1005(GET_STORAGE_INFO)l: 16 T:8 : 6
    6 5 name:sflash6 vol:
    6 5 name:sflash6 vol:
    RESP:2001(RSP:OK)l: 16 T:8 : 6
    CMD: 1005(GET_STORAGE_INFO)l: 16 T:9 : 7
    7 6 name:WINBOND1G vol:
    7 6 name:WINBOND1G vol:
    RESP:2001(RSP:OK)l: 16 T:9 : 7
    CMD: 1005(GET_STORAGE_INFO)l: 16 T:a : 8
    8 7 name:WINBOND2G vol:
    8 7 name:WINBOND2G vol:
    RESP:2001(RSP:OK)l: 16 T:a : 8
    CMD: 1005(GET_STORAGE_INFO)l: 16 T:b : 9
    9 8 name:MSC0-NEW VOLUME vol:
    9 8 name:MSC0-NEW VOLUME vol:
    RESP:2001(RSP:OK)l: 16 T:b : 9
    CMD: 1005(GET_STORAGE_INFO)l: 16 T:c : d
    13 12 name:sdio vol:
    13 12 name:sdio vol:
    RESP:2001(RSP:OK)l: 16 T:c : d
    CMD: 9801(GET_OBJECT_PROPS_SUPPORTED)l: 16 T:d : 3000
    RESP:2001(RSP:OK)l: 16 T:d : 3000
    CMD: 9801(GET_OBJECT_PROPS_SUPPORTED)l: 16 T:e : 3001
    RESP:2001(RSP:OK)l: 16 T:e : 3001
    CMD: 1007(GET_OBJECT_HANDLES)l: 24 T:f : 1 0 ffffffff
    RESP:2001(RSP:OK)l: 24 T:f : 1 0 ffffffff
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:10 : 18 dc02 (FORMAT)
    RESP:2001(RSP:OK)l: 20 T:10 : 18 dc02
    CMD: 9802(GET_OBJECT_PROP_DESC)l: 20 T:11 : dc41 3000 (PERSISTENT_UID)
    RESP:2001(RSP:OK)l: 20 T:11 : dc41 3000
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:12 : 18 dc41 (PERSISTENT_UID)
    RESP:2001(RSP:OK)l: 20 T:12 : 18 dc41
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:13 : 17 dc02 (FORMAT)
    RESP:2001(RSP:OK)l: 20 T:13 : 17 dc02
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:14 : 17 dc41 (PERSISTENT_UID)
    RESP:2001(RSP:OK)l: 20 T:14 : 17 dc41
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:15 : 16 dc02 (FORMAT)
    RESP:2001(RSP:OK)l: 20 T:15 : 16 dc02
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:16 : 16 dc41 (PERSISTENT_UID)
    RESP:2001(RSP:OK)l: 20 T:16 : 16 dc41
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:17 : 15 dc02 (FORMAT)
    RESP:2001(RSP:OK)l: 20 T:17 : 15 dc02
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:18 : 15 dc41 (PERSISTENT_UID)
    RESP:2001(RSP:OK)l: 20 T:18 : 15 dc41
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:19 : 14 dc02 (FORMAT)
    RESP:2001(RSP:OK)l: 20 T:19 : 14 dc02
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:1a : 14 dc41 (PERSISTENT_UID)
    RESP:2001(RSP:OK)l: 20 T:1a : 14 dc41
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:1b : 13 dc02 (FORMAT)
    RESP:2001(RSP:OK)l: 20 T:1b : 13 dc02
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:1c : 13 dc41 (PERSISTENT_UID)
    RESP:2001(RSP:OK)l: 20 T:1c : 13 dc41
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:1d : 12 dc02 (FORMAT)
    RESP:2001(RSP:OK)l: 20 T:1d : 12 dc02
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:1e : 12 dc41 (PERSISTENT_UID)
    RESP:2001(RSP:OK)l: 20 T:1e : 12 dc41
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:1f : 11 dc02 (FORMAT)
    RESP:2001(RSP:OK)l: 20 T:1f : 11 dc02
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:20 : 11 dc41 (PERSISTENT_UID)
    RESP:2001(RSP:OK)l: 20 T:20 : 11 dc41
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:21 : 10 dc02 (FORMAT)
    RESP:2001(RSP:OK)l: 20 T:21 : 10 dc02
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:22 : 10 dc41 (PERSISTENT_UID)
    RESP:2001(RSP:OK)l: 20 T:22 : 10 dc41
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:23 : f dc02 (FORMAT)
    RESP:2001(RSP:OK)l: 20 T:23 : f dc02
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:24 : f dc41 (PERSISTENT_UID)
    RESP:2001(RSP:OK)l: 20 T:24 : f dc41
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:25 : e dc02 (FORMAT)
    RESP:2001(RSP:OK)l: 20 T:25 : e dc02
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:26 : e dc41 (PERSISTENT_UID)
    RESP:2001(RSP:OK)l: 20 T:26 : e dc41
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:27 : d dc02 (FORMAT)
    RESP:2001(RSP:OK)l: 20 T:27 : d dc02
    CMD: 9802(GET_OBJECT_PROP_DESC)l: 20 T:28 : dc41 3001 (PERSISTENT_UID)
    RESP:2001(RSP:OK)l: 20 T:28 : dc41 3001
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:29 : d dc41 (PERSISTENT_UID)
    RESP:2001(RSP:OK)l: 20 T:29 : d dc41
    CMD: 9802(GET_OBJECT_PROP_DESC)l: 20 T:2a : dc01 3001 (STORAGE_ID)
    RESP:2001(RSP:OK)l: 20 T:2a : dc01 3001
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:2b : d dc01 (STORAGE_ID)
    RESP:2001(RSP:OK)l: 20 T:2b : d dc01
    CMD: 1007(GET_OBJECT_HANDLES)l: 24 T:2c : 1 0 d
    RESP:2001(RSP:OK)l: 24 T:2c : 1 0 d
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:2d : 23 dc02 (FORMAT)
    RESP:2001(RSP:OK)l: 20 T:2d : 23 dc02
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:2e : 23 dc41 (PERSISTENT_UID)
    RESP:2001(RSP:OK)l: 20 T:2e : 23 dc41
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:2f : 22 dc02 (FORMAT)
    RESP:2001(RSP:OK)l: 20 T:2f : 22 dc02
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:30 : 22 dc41 (PERSISTENT_UID)
    RESP:2001(RSP:OK)l: 20 T:30 : 22 dc41
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:31 : 21 dc02 (FORMAT)
    RESP:2001(RSP:OK)l: 20 T:31 : 21 dc02
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:32 : 21 dc41 (PERSISTENT_UID)
    RESP:2001(RSP:OK)l: 20 T:32 : 21 dc41
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:33 : 20 dc02 (FORMAT)
    RESP:2001(RSP:OK)l: 20 T:33 : 20 dc02
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:34 : 20 dc41 (PERSISTENT_UID)
    RESP:2001(RSP:OK)l: 20 T:34 : 20 dc41
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:35 : 1f dc02 (FORMAT)
    RESP:2001(RSP:OK)l: 20 T:35 : 1f dc02
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:36 : 1f dc41 (PERSISTENT_UID)
    RESP:2001(RSP:OK)l: 20 T:36 : 1f dc41
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:37 : 1e dc02 (FORMAT)
    RESP:2001(RSP:OK)l: 20 T:37 : 1e dc02
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:38 : 1e dc41 (PERSISTENT_UID)
    RESP:2001(RSP:OK)l: 20 T:38 : 1e dc41
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:39 : 1d dc02 (FORMAT)
    RESP:2001(RSP:OK)l: 20 T:39 : 1d dc02
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:3a : 1d dc41 (PERSISTENT_UID)
    RESP:2001(RSP:OK)l: 20 T:3a : 1d dc41
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:3b : 1c dc02 (FORMAT)
    RESP:2001(RSP:OK)l: 20 T:3b : 1c dc02
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:3c : 1c dc41 (PERSISTENT_UID)
    RESP:2001(RSP:OK)l: 20 T:3c : 1c dc41
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:3d : 1b dc02 (FORMAT)
    RESP:2001(RSP:OK)l: 20 T:3d : 1b dc02
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:3e : 1b dc41 (PERSISTENT_UID)
    RESP:2001(RSP:OK)l: 20 T:3e : 1b dc41
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:3f : 1a dc02 (FORMAT)
    RESP:2001(RSP:OK)l: 20 T:3f : 1a dc02
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:40 : 1a dc41 (PERSISTENT_UID)
    RESP:2001(RSP:OK)l: 20 T:40 : 1a dc41
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:41 : 19 dc02 (FORMAT)
    RESP:2001(RSP:OK)l: 20 T:41 : 19 dc02
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:42 : 19 dc41 (PERSISTENT_UID)
    RESP:2001(RSP:OK)l: 20 T:42 : 19 dc41
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:43 : 19 dc01 (STORAGE_ID)
    RESP:2001(RSP:OK)l: 20 T:43 : 19 dc01
    CMD: 1007(GET_OBJECT_HANDLES)l: 24 T:44 : 1 0 19
    RESP:2001(RSP:OK)l: 24 T:44 : 1 0 19
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:45 : 2d dc02 (FORMAT)
    RESP:2001(RSP:OK)l: 20 T:45 : 2d dc02
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:46 : 2d dc41 (PERSISTENT_UID)
    RESP:2001(RSP:OK)l: 20 T:46 : 2d dc41
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:47 : 2c dc02 (FORMAT)
    RESP:2001(RSP:OK)l: 20 T:47 : 2c dc02
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:48 : 2c dc41 (PERSISTENT_UID)
    RESP:2001(RSP:OK)l: 20 T:48 : 2c dc41
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:49 : 2b dc02 (FORMAT)
    RESP:2001(RSP:OK)l: 20 T:49 : 2b dc02
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:4a : 2b dc41 (PERSISTENT_UID)
    RESP:2001(RSP:OK)l: 20 T:4a : 2b dc41
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:4b : 2a dc02 (FORMAT)
    RESP:2001(RSP:OK)l: 20 T:4b : 2a dc02
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:4c : 2a dc41 (PERSISTENT_UID)
    RESP:2001(RSP:OK)l: 20 T:4c : 2a dc41
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:4d : 29 dc02 (FORMAT)
    RESP:2001(RSP:OK)l: 20 T:4d : 29 dc02
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:4e : 29 dc41 (PERSISTENT_UID)
    RESP:2001(RSP:OK)l: 20 T:4e : 29 dc41
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:4f : 28 dc02 (FORMAT)
    RESP:2001(RSP:OK)l: 20 T:4f : 28 dc02
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:50 : 28 dc41 (PERSISTENT_UID)
    RESP:2001(RSP:OK)l: 20 T:50 : 28 dc41
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:51 : 27 dc02 (FORMAT)
    RESP:2001(RSP:OK)l: 20 T:51 : 27 dc02
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:52 : 27 dc41 (PERSISTENT_UID)
    RESP:2001(RSP:OK)l: 20 T:52 : 27 dc41
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:53 : 26 dc02 (FORMAT)
    RESP:2001(RSP:OK)l: 20 T:53 : 26 dc02
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:54 : 26 dc41 (PERSISTENT_UID)
    RESP:2001(RSP:OK)l: 20 T:54 : 26 dc41
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:55 : 25 dc02 (FORMAT)
    RESP:2001(RSP:OK)l: 20 T:55 : 25 dc02
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:56 : 25 dc41 (PERSISTENT_UID)
    RESP:2001(RSP:OK)l: 20 T:56 : 25 dc41
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:57 : 24 dc02 (FORMAT)
    RESP:2001(RSP:OK)l: 20 T:57 : 24 dc02
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:58 : 24 dc41 (PERSISTENT_UID)
    RESP:2001(RSP:OK)l: 20 T:58 : 24 dc41
    CMD: 1007(GET_OBJECT_HANDLES)l: 24 T:59 : 2 0 ffffffff
    RESP:2001(RSP:OK)l: 24 T:59 : 2 0 ffffffff
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:5a : 2e dc02 (FORMAT)
    RESP:2001(RSP:OK)l: 20 T:5a : 2e dc02
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:5b : 2e dc41 (PERSISTENT_UID)
    RESP:2001(RSP:OK)l: 20 T:5b : 2e dc41
    CMD: 1007(GET_OBJECT_HANDLES)l: 24 T:5c : 3 0 ffffffff
    RESP:2001(RSP:OK)l: 24 T:5c : 3 0 ffffffff
    CMD: 1007(GET_OBJECT_HANDLES)l: 24 T:5d : 4 0 ffffffff
    RESP:2001(RSP:OK)l: 24 T:5d : 4 0 ffffffff
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:5e : 2f dc02 (FORMAT)
    RESP:2001(RSP:OK)l: 20 T:5e : 2f dc02
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:5f : 2f dc41 (PERSISTENT_UID)
    RESP:2001(RSP:OK)l: 20 T:5f : 2f dc41
    CMD: 1007(GET_OBJECT_HANDLES)l: 24 T:60 : 5 0 ffffffff
    RESP:2001(RSP:OK)l: 24 T:60 : 5 0 ffffffff
    CMD: 1007(GET_OBJECT_HANDLES)l: 24 T:61 : 6 0 ffffffff
    RESP:2001(RSP:OK)l: 24 T:61 : 6 0 ffffffff
    CMD: 1007(GET_OBJECT_HANDLES)l: 24 T:62 : 7 0 ffffffff
    RESP:2001(RSP:OK)l: 24 T:62 : 7 0 ffffffff
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:63 : 30 dc02 (FORMAT)
    RESP:2001(RSP:OK)l: 20 T:63 : 30 dc02
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:64 : 30 dc41 (PERSISTENT_UID)
    RESP:2001(RSP:OK)l: 20 T:64 : 30 dc41
    CMD: 1007(GET_OBJECT_HANDLES)l: 24 T:65 : 8 0 ffffffff
    RESP:2001(RSP:OK)l: 24 T:65 : 8 0 ffffffff
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:66 : 32 dc02 (FORMAT)
    RESP:2001(RSP:OK)l: 20 T:66 : 32 dc02
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:67 : 32 dc41 (PERSISTENT_UID)
    RESP:2001(RSP:OK)l: 20 T:67 : 32 dc41
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:68 : 31 dc02 (FORMAT)
    RESP:2001(RSP:OK)l: 20 T:68 : 31 dc02
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:69 : 31 dc41 (PERSISTENT_UID)
    RESP:2001(RSP:OK)l: 20 T:69 : 31 dc41
    CMD: 1007(GET_OBJECT_HANDLES)l: 24 T:6a : 9 0 ffffffff
    RESP:2001(RSP:OK)l: 24 T:6a : 9 0 ffffffff
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:6b : 34 dc02 (FORMAT)
    RESP:2001(RSP:OK)l: 20 T:6b : 34 dc02
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:6c : 34 dc41 (PERSISTENT_UID)
    RESP:2001(RSP:OK)l: 20 T:6c : 34 dc41
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:6d : 33 dc02 (FORMAT)
    RESP:2001(RSP:OK)l: 20 T:6d : 33 dc02
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:6e : 33 dc41 (PERSISTENT_UID)
    RESP:2001(RSP:OK)l: 20 T:6e : 33 dc41
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:6f : 33 dc01 (STORAGE_ID)
    RESP:2001(RSP:OK)l: 20 T:6f : 33 dc01
    CMD: 1007(GET_OBJECT_HANDLES)l: 24 T:70 : 9 0 33
    RESP:2001(RSP:OK)l: 24 T:70 : 9 0 33
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:71 : 36 dc02 (FORMAT)
    RESP:2001(RSP:OK)l: 20 T:71 : 36 dc02
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:72 : 36 dc41 (PERSISTENT_UID)
    RESP:2001(RSP:OK)l: 20 T:72 : 36 dc41
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:73 : 35 dc02 (FORMAT)
    RESP:2001(RSP:OK)l: 20 T:73 : 35 dc02
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:74 : 35 dc41 (PERSISTENT_UID)
    RESP:2001(RSP:OK)l: 20 T:74 : 35 dc41
    CMD: 1007(GET_OBJECT_HANDLES)l: 24 T:75 : d 0 ffffffff
    RESP:2001(RSP:OK)l: 24 T:75 : d 0 ffffffff
    USB Drive Inserted
      Try Partiton:1 on MSC Index:1
    UsbBase::mscBegin called 200076c0 0 1
        After usbDriveBegin
    PFsVolume::begin(2000881c)
        ** SUCCEEDED **
    >> USB partition 1 valume ID: system-boot
    sd_addFilesystem: 13 20008388 MSC1-system-boot
    *MTPD::send_Event(4004) e
      Try Partiton:2 on MSC Index:2
    UsbBase::mscBegin called 200076c0 0 2
        After usbDriveBegin
    PFsVolume::begin(20008ccc)
        ** SUCCEEDED **
    >> USB partition 2 valume ID: NEW VOLUME1
    sd_addFilesystem: 14 20008838 MSC1-NEW VOLUME1
    *MTPD::send_Event(4004) f
      Try Partiton:3 on MSC Index:3
    UsbBase::mscBegin called 200076c0 0 3
        After usbDriveBegin
    PFsVolume::begin(2000917c)
        ** SUCCEEDED **
    >> USB partition 3 valume ID: exFat
    sd_addFilesystem: 15 20008ce8 MSC1-exFat
    *MTPD::send_Event(4004) 10
      Try Partiton:4 on MSC Index:4
    UsbBase::mscBegin called 200076c0 0 4
        After usbDriveBegin
    PFsVolume::begin(2000962c)
    *MTPD::send_Event(400b)
    CMD: 1005(GET_STORAGE_INFO)l: 16 T:76 : e
    14 13 name:MSC1-system-boot vol:
    14 13 name:MSC1-system-boot vol:
    RESP:2001(RSP:OK)l: 16 T:76 : e
    CMD: 1005(GET_STORAGE_INFO)l: 16 T:77 : f
    15 14 name:MSC1-NEW VOLUME1 vol:
    15 14 name:MSC1-NEW VOLUME1 vol:
    RESP:2001(RSP:OK)l: 16 T:77 : f
    CMD: 1002(OPEN_SESSION)l: 16 T:0 : 1
    RESP:2001(RSP:OK)l: 16 T:0 : 1
    CMD: 1001(GET_DEVICE_INFO)l: 12 T:1
    RESP:2001(RSP:OK)l: 12 T:1
    CMD: 1004(GET_STORAGE_IDS)l: 12 T:2
    RESP:2001(RSP:OK)l: 12 T:2
    CMD: 1005(GET_STORAGE_INFO)l: 16 T:3 : 1
    1 0 name:RAM1 vol:
    1 0 name:RAM1 vol:
    RESP:2001(RSP:OK)l: 16 T:3 : 1
    CMD: 1005(GET_STORAGE_INFO)l: 16 T:4 : 2
    2 1 name:RAM2 vol:
    2 1 name:RAM2 vol:
    RESP:2001(RSP:OK)l: 16 T:4 : 2
    CMD: 1005(GET_STORAGE_INFO)l: 16 T:5 : 3
    3 2 name:PROGM vol:
    3 2 name:PROGM vol:
    RESP:2001(RSP:OK)l: 16 T:5 : 3
    CMD: 1005(GET_STORAGE_INFO)l: 16 T:6 : 4
    4 3 name:QSPI vol:
    4 3 name:QSPI vol:
    RESP:2001(RSP:OK)l: 16 T:6 : 4
    CMD: 1005(GET_STORAGE_INFO)l: 16 T:7 : 5
    5 4 name:sflash5 vol:
    5 4 name:sflash5 vol:
    RESP:2001(RSP:OK)l: 16 T:7 : 5
    CMD: 1005(GET_STORAGE_INFO)l: 16 T:8 : 6
    6 5 name:sflash6 vol:
    6 5 name:sflash6 vol:
    RESP:2001(RSP:OK)l: 16 T:8 : 6
    CMD: 1005(GET_STORAGE_INFO)l: 16 T:9 : 7
    7 6 name:WINBOND1G vol:
    7 6 name:WINBOND1G vol:
    RESP:2001(RSP:OK)l: 16 T:9 : 7
    CMD: 1005(GET_STORAGE_INFO)l: 16 T:a : 8
    8 7 name:WINBOND2G vol:
    8 7 name:WINBOND2G vol:
    RESP:2001(RSP:OK)l: 16 T:a : 8
    CMD: 1005(GET_STORAGE_INFO)l: 16 T:b : 9
    9 8 name:MSC0-NEW VOLUME vol:
    9 8 name:MSC0-NEW VOLUME vol:
    RESP:2001(RSP:OK)l: 16 T:b : 9
    CMD: 1005(GET_STORAGE_INFO)l: 16 T:c : d
    13 12 name:sdio vol:
    13 12 name:sdio vol:
    RESP:2001(RSP:OK)l: 16 T:c : d
    CMD: 1005(GET_STORAGE_INFO)l: 16 T:d : e
    14 13 name:MSC1-system-boot vol:
    14 13 name:MSC1-system-boot vol:
    RESP:2001(RSP:OK)l: 16 T:d : e
    CMD: 1005(GET_STORAGE_INFO)l: 16 T:e : f
    15 14 name:MSC1-NEW VOLUME1 vol:
    15 14 name:MSC1-NEW VOLUME1 vol:
    RESP:2001(RSP:OK)l: 16 T:e : f
    CMD: 1005(GET_STORAGE_INFO)l: 16 T:f : 10
    16 15 name:MSC1-exFat vol:
    16 15 name:MSC1-exFat vol:
    RESP:2001(RSP:OK)l: 16 T:f : 10
    CMD: 9801(GET_OBJECT_PROPS_SUPPORTED)l: 16 T:10 : 3000
    RESP:2001(RSP:OK)l: 16 T:10 : 3000
    CMD: 9801(GET_OBJECT_PROPS_SUPPORTED)l: 16 T:11 : 3001
    RESP:2001(RSP:OK)l: 16 T:11 : 3001
    Second case was just restarting Teensy with the thumb drive in and then plugging in the SDCard adapter. Of course it read the thumb drive fine and when I plugged in the SDCard-Adapter it looks like it recognized it but MTP lost the drives/partitions in win explorer:
    Code:
    MTP_test
    SDIO Storage 0 254 sdio failed or missing
    SD Storage 1 10 sd1 failed or missing
    sd_addFilesystem: 0 20007038 RAM1
    RAM Storage 0 RAM1 199936 512
    sd_addFilesystem: 1 20007100 RAM2
    RAM Storage 1 RAM2 3999744 4096
    sd_addFilesystem: 2 200039a0 PROGM
    Program Storage 0 PROGM 983040 8192
    sd_addFilesystem: 3 20003ee0 QSPI
    QSPI Storage 0 QSPI 16777216 8192
    sd_addFilesystem: 4 20003fb4 sflash5
    SPIFlash Storage 0 5 sflash5 67108864 8192
    sd_addFilesystem: 5 2000408c sflash6
    SPIFlash Storage 1 6 sflash6 67108864 8192
    SPIFlash Storage 2 7 prop failed or missing
    sd_addFilesystem: 6 20007ba0 WINBOND1G
    Storage 0 3 WINBOND1G 131596288 9175040
    sd_addFilesystem: 7 20007c90 WINBOND2G
    Storage 1 4 WINBOND2G 265289728 9306112
    
    Initializing USB MSC drives...
    USB Drive Inserted
      Try Partiton:1 on MSC Index:0
    UsbBase::mscBegin called 200071e0 0 1
        After usbDriveBegin
    PFsVolume::begin(2000836c)
        ** SUCCEEDED **
    >> USB partition 1 valume ID: NEW VOLUME
    sd_addFilesystem: 8 20007ed8 MSC0-NEW VOLUME
      Try Partiton:2 on MSC Index:1
    UsbBase::mscBegin called 200071e0 0 2
        After usbDriveBegin
    PFsVolume::begin(2000881c)
      Try Partiton:3 on MSC Index:1
    UsbBase::mscBegin called 200071e0 0 3
        After usbDriveBegin
    PFsVolume::begin(2000881c)
      Try Partiton:4 on MSC Index:1
    UsbBase::mscBegin called 200071e0 0 4
        After usbDriveBegin
    PFsVolume::begin(2000881c)
    sd_addFilesystem: 9 2000423c sdio
    
    **** dir of sd[0] ****
    
    Setup done
    CMD: 1002(OPEN_SESSION)l: 16 T:0 : 1
    RESP:2001(RSP:OK)l: 16 T:0 : 1
    CMD: 1001(GET_DEVICE_INFO)l: 12 T:1
    RESP:2001(RSP:OK)l: 12 T:1
    CMD: 1014(GET_DEVICE_PROP_DESC)l: 16 T:2 : d402
    RESP:2001(RSP:OK)l: 16 T:2 : d402
    CMD: 1004(GET_STORAGE_IDS)l: 12 T:3
    RESP:2001(RSP:OK)l: 12 T:3
    CMD: 1005(GET_STORAGE_INFO)l: 16 T:4 : 1
    1 0 name:RAM1 vol:
    1 0 name:RAM1 vol:
    RESP:2001(RSP:OK)l: 16 T:4 : 1
    CMD: 1005(GET_STORAGE_INFO)l: 16 T:5 : 2
    2 1 name:RAM2 vol:
    2 1 name:RAM2 vol:
    RESP:2001(RSP:OK)l: 16 T:5 : 2
    CMD: 1005(GET_STORAGE_INFO)l: 16 T:6 : 3
    3 2 name:PROGM vol:
    3 2 name:PROGM vol:
    RESP:2001(RSP:OK)l: 16 T:6 : 3
    CMD: 1005(GET_STORAGE_INFO)l: 16 T:7 : 4
    4 3 name:QSPI vol:
    4 3 name:QSPI vol:
    RESP:2001(RSP:OK)l: 16 T:7 : 4
    CMD: 1005(GET_STORAGE_INFO)l: 16 T:8 : 5
    5 4 name:sflash5 vol:
    5 4 name:sflash5 vol:
    RESP:2001(RSP:OK)l: 16 T:8 : 5
    CMD: 1005(GET_STORAGE_INFO)l: 16 T:9 : 6
    6 5 name:sflash6 vol:
    6 5 name:sflash6 vol:
    RESP:2001(RSP:OK)l: 16 T:9 : 6
    CMD: 1005(GET_STORAGE_INFO)l: 16 T:a : 7
    7 6 name:WINBOND1G vol:
    7 6 name:WINBOND1G vol:
    RESP:2001(RSP:OK)l: 16 T:a : 7
    CMD: 1005(GET_STORAGE_INFO)l: 16 T:b : 8
    8 7 name:WINBOND2G vol:
    8 7 name:WINBOND2G vol:
    RESP:2001(RSP:OK)l: 16 T:b : 8
    CMD: 1005(GET_STORAGE_INFO)l: 16 T:c : 9
    ###FatPartition::freeClusterCount: FT:16 start:69 todo:61679
        m_sectorsPerCluster:32
        m_clusterSectorMask:31
        m_sectorsPerClusterShift:5
        m_fatType:16
        m_rootDirEntryCount:512
        m_allocSearchStart:1
        m_sectorsPerFat:241
        m_dataStartSector:583
        m_fatStartSector:69
        m_lastCluster:61678
        m_rootDirStart:551
        m_bytesPerSector:512
    9 8 name:MSC0-NEW VOLUME vol:
    9 8 name:MSC0-NEW VOLUME vol:
    RESP:2001(RSP:OK)l: 16 T:c : 9
    CMD: 1005(GET_STORAGE_INFO)l: 16 T:d : a
    10 9 name:sdio vol:
    10 9 name:sdio vol:
    RESP:2001(RSP:OK)l: 16 T:d : a
    CMD: 9801(GET_OBJECT_PROPS_SUPPORTED)l: 16 T:e : 3000
    RESP:2001(RSP:OK)l: 16 T:e : 3000
    CMD: 9801(GET_OBJECT_PROPS_SUPPORTED)l: 16 T:f : 3001
    RESP:2001(RSP:OK)l: 16 T:f : 3001
    USB Drive Inserted
      Try Partiton:1 on MSC Index:1
    UsbBase::mscBegin called 200076c0 0 1
        After usbDriveBegin
    PFsVolume::begin(2000881c)
        ** SUCCEEDED **
    >> USB partition 1 valume ID: system-boot
    sd_addFilesystem: 10 20008388 MSC1-system-boot
    *MTPD::send_Event(4004) b
      Try Partiton:2 on MSC Index:2
    UsbBase::mscBegin called 200076c0 0 2
        After usbDriveBegin
    PFsVolume::begin(20008ccc)
        ** SUCCEEDED **
    >> USB partition 2 valume ID: NEW VOLUME1
    sd_addFilesystem: 11 20008838 MSC1-NEW VOLUME1
    *MTPD::send_Event(4004) c
      Try Partiton:3 on MSC Index:3
    UsbBase::mscBegin called 200076c0 0 3
        After usbDriveBegin
    PFsVolume::begin(2000917c)
        ** SUCCEEDED **
    >> USB partition 3 valume ID: exFat
    sd_addFilesystem: 12 20008ce8 MSC1-exFat
    *MTPD::send_Event(4004) d
      Try Partiton:4 on MSC Index:4
    UsbBase::mscBegin called 200076c0 0 4
        After usbDriveBegin
    PFsVolume::begin(2000962c)
    *MTPD::send_Event(400b)
    CMD: 1005(GET_STORAGE_INFO)l: 16 T:10 : b
    ###FatPartition::freeClusterCount: FT:32 start:2080 todo:516192
        m_sectorsPerCluster:1
        m_clusterSectorMask:0
        m_sectorsPerClusterShift:0
        m_fatType:32
        m_rootDirEntryCount:0
        m_allocSearchStart:1
        m_sectorsPerFat:4033
        m_dataStartSector:10146
        m_fatStartSector:2080
        m_lastCluster:516191
        m_rootDirStart:2
        m_bytesPerSector:512
    11 10 name:MSC1-system-boot vol:
    11 10 name:MSC1-system-boot vol:
    RESP:2001(RSP:OK)l: 16 T:10 : b
    There is going to be another issue that not sure how it can be resolved - at least I couldn't figure it out. The problem is going to be formatting partitions. Not sure SDFat is set up to do that? When I tried it with just a SD Card in the T4.1 it formatted the whole card and not just the partition but then again I could have done it wrong.

  6. #56
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    8,906
    Quote Originally Posted by mjs513 View Post
    @KurtE
    There is going to be another issue that not sure how it can be resolved - at least I couldn't figure it out. The problem is going to be formatting partitions. Not sure SDFat is set up to do that? When I tried it with just a SD Card in the T4.1 it formatted the whole card and not just the partition but then again I could have done it wrong.
    Yes So far I have only put in code for formatting of LittleFS stuff, have not dealt yet with FAT file systems... So far no API or methods that I know of for it, only the sketches in the SDFat library.

    Maybe sometime we should try adapt one or more versions of it to partition?

    Have not gotten much done today, distracted with other things

  7. #57
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    Location
    New York
    Posts
    6,835
    Quote Originally Posted by KurtE View Post
    Yes So far I have only put in code for formatting of LittleFS stuff, have not dealt yet with FAT file systems... So far no API or methods that I know of for it, only the sketches in the SDFat library.

    Maybe sometime we should try adapt one or more versions of it to partition?

    Have not gotten much done today, distracted with other things
    Can probably be adapted but would have to do something like you did for volume - create locale copy.

  8. #58
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    8,906
    @mjs513, that is sort of what I figured.

    @all - Keep wondering about how SLOW the getting free space is

    I can imagine that it could probably be sped up a lot, but not sure how doable it is without major surgery everywhere.

    That is, the code for fat looks like:
    Code:
    int32_t FatPartition::freeClusterCount() {
    #if MAINTAIN_FREE_CLUSTER_COUNT
      if (m_freeClusterCount >= 0) {
        return m_freeClusterCount;
      }
    #endif  // MAINTAIN_FREE_CLUSTER_COUNT
      uint32_t free = 0;
      uint32_t sector;
      uint32_t todo = m_lastCluster + 1;
      uint16_t n;
    
      if (FAT12_SUPPORT && fatType() == 12) {
        for (unsigned i = 2; i < todo; i++) {
          uint32_t c;
          int8_t fg = fatGet(i, &c);
          if (fg < 0) {
            DBG_FAIL_MACRO;
            goto fail;
          }
          if (fg && c == 0) {
            free++;
          }
        }
      } else if (fatType() == 16 || fatType() == 32) {
    #if 0    
        Serial.printf("###FatPartition::freeClusterCount: FT:%u start:%u todo:%u\n", fatType(), m_fatStartSector, todo);
        Serial.printf("    m_sectorsPerCluster:%u\n", m_sectorsPerCluster);
        Serial.printf("    m_clusterSectorMask:%u\n", m_clusterSectorMask);
        Serial.printf("    m_sectorsPerClusterShift:%u\n", m_sectorsPerClusterShift);
        Serial.printf("    m_fatType:%u\n", m_fatType);
        Serial.printf("    m_rootDirEntryCount:%u\n", m_rootDirEntryCount);
        Serial.printf("    m_allocSearchStart:%u\n", m_allocSearchStart);
        Serial.printf("    m_sectorsPerFat:%u\n", m_sectorsPerFat);
        Serial.printf("    m_dataStartSector:%u\n", m_dataStartSector);
        Serial.printf("    m_fatStartSector:%u\n", m_fatStartSector);
        Serial.printf("    m_lastCluster:%u\n", m_lastCluster);
        Serial.printf("    m_rootDirStart:%u\n", m_rootDirStart);
        Serial.printf("    m_bytesPerSector:%u\n", m_bytesPerSector);
    #endif
        sector = m_fatStartSector;
        digitalWriteFast(0, HIGH);
        while (todo) {
          digitalWriteFast(1, HIGH);
          cache_t* pc = cacheFetchFat(sector++, FsCache::CACHE_FOR_READ);
          digitalWriteFast(1, LOW);
          if (!pc) {
            DBG_FAIL_MACRO;
            goto fail;
          }
          n =  fatType() == 16 ? m_bytesPerSector/2 : m_bytesPerSector/4;
          if (todo < n) {
            n = todo;
          }
          if (fatType() == 16) {
            for (uint16_t i = 0; i < n; i++) {
              if (pc->fat16[i] == 0) {
                free++;
              }
            }
          } else {
            for (uint16_t i = 0; i < n; i++) {
              if (pc->fat32[i] == 0) {
                free++;
              }
            }
          }
          todo -= n;
        }
      } else {
        // invalid FAT type
        DBG_FAIL_MACRO;
        goto fail;
      }
      digitalWriteFast(0, LOW);
      setFreeClusterCount(free);
      return free;
    
     fail:
      return -1;
    }
    Basically it reads one 512 byte sector, and looks through each fat sector and on these larger partitions like 4gb, you have to read thousands of these sectors.
    It then scans the 512/2 or 512/4 cluster markers in that sector and counts the so many that have specific value and then sets up to read the next sector.

    This read of the next sector includes the write a USB command out to do the read request, and then wait for the host to respond and send me back the 512 bytes...

    So it outputs a command and waits for response for each sector... Question is can one rework the cod that it knows that it is going to read a lot of these sectors and have the code instead of read one sector at a time, maybe it has another buffer like 4KB or 8KB, which it can read in multiple sectors in one sitting. Or better yet maybe it can say to read all of the sectors in and use multiple transfer objects, each with it's own buffer and have scan a buffer while the USB system is filling the next one...

    Again I know some of this is doable, from other USB devices. Just not sure how much work it would be to all parts of the system to do this?

    But wondering if it would be faster and by how much.

  9. #59
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    8,906
    @all - I think I will try a hack to see how much if any the freeClusterCount code could be sped up.

    What I am thinking of doing is start off with Fat (so Fat16/32). I am curious of how fast is it already for large exFat partition? Will try one of my 8GB disks to format the whole thing for exFat and see what it does.

    But assume, in the MSC code, that I trap the request for the freeClusterCount.

    Then see in the USBHost_t36 code (MasStorageDriver.cpp)

    Maybe have a call like:
    Code:
    uint8_t msController::msReadBlocks(
    									const uint32_t BlockAddress,
    									const uint16_t Blocks,
    									const uint16_t BlockSize,
    									void * sectorBuffer)
    That calls off to msDoCommand, but this version maybe works differently. Instead of maybe one buffer and/or maybe the buffers are part of the library...
    And then the caller puts in a Callback function to be called when each sector is received...

    So the idea would be, for the freeClusterCount code to compute how many sectors it needs to read, and then setup an ISR to receive each buffer, in the same way we process things like USB Serial or RAWHID...
    So then the version of doCOmmand, would queue up multiple input transfer objects, so when one is received, it will be processing the next one if any data comes in during the processing of the previous one.

    I think it sounds doable. Will be interesting to see if it really does speed it up.

    Thoughts?

  10. #60
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    8,906
    So far I have done a really dirty version of the FatPartition getFreeClusterCount code as part of the VolumeName.ino sketch.

    I think most if not all of the changes are in the two Github Projects:

    USBHost_t36 I added a new method to the class for call backs on reading multiple sectors: https://github.com/KurtE/USBHost_t36...ead_sectors_cb
    And updated the branch/fork; https://github.com/KurtE/UsbMscFat/tree/VolumeName_SD

    I do think it is showing some progress, not sure yet on how to cleanly implement it...

    And note I have not done ExFat here yet...

    Debug output, minus the LS stuff...

    Code:
    msc # Partition Table
    	part,boot,bgnCHS[3],type,endCHS[3],start,length
    FAT32:	1,0,0x4,0x1,0x4,0xB,0xFE,0xC2,0xFF,2048,8192000
    FAT16:	2,0,0xE,0x51,0xFE,0xE,0x98,0x98,0x80,8194048,2097152
    exFAT:	3,0,0x98,0x99,0x80,0x7,0xEE,0xDC,0xD2,10291200,5435392
    pt_#0:	4,0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0,0
    
    Partition 3 valid:0
    0:>> Fat32: Volume name:(VOLFAT32) Partition Total Size:4186095616 Used:65425408 time us: 6096623
        Free Clusters: API: 1006023 by CB:1006023 time us: 499741
    1:>> Fat16: Volume name:(VOLFAT16) Partition Total Size:1073446912 Used:11714560 time us: 192000
        Free Clusters: API: 64803 by CB:64803 time us: 016740
    2:>> ExFat: Volume name:(VolEXFAT) Partition Total Size:2782461952 Used:232030208 time us: 17002
        Free Clusters: API: 77833 by CB:0 time us: 0
    So for example the Fat32 big volume, took over six seconds by the FatPartion call: 6096623
    Actually slightly cheating as that time included the call to get the total number of clusters which very slight:
    And with my call back code it took about .5 seconds.. So about 12 times faster....

    The Fat16 smaller one, api took: about .2 seconds by api and about .017 seconds, again not bad...
    The hacky code looks like:
    Code:
    typedef struct {
      uint32_t free;
      uint32_t todo;
      uint32_t clusters_per_sector;
    } _gfcc_t;
    
    
    void _getfreeclustercountCB(uint32_t token, uint8_t *buffer) 
    {
      digitalWriteFast(1, HIGH);
      _gfcc_t *gfcc = (_gfcc_t *)token;
      uint16_t cnt = gfcc->clusters_per_sector;
      if (cnt > gfcc->todo) cnt = gfcc->todo;
      gfcc->todo -= cnt; // update count here...
    
      if (gfcc->clusters_per_sector == 512/2) {
        // fat16
        uint16_t *fat16 = (uint16_t *)buffer;
        while (cnt-- ) {
          if (*fat16++ == 0) gfcc->free++;
        }
      } else {
        uint32_t *fat32 = (uint32_t *)buffer;
        while (cnt-- ) {
          if (*fat32++ == 0) gfcc->free++;
        }
      }
    
      digitalWriteFast(1, LOW);
    }
    
    uint32_t GetFreeClusterCount(USBmscInterface *usmsci, PFsVolume &partVol)
    {
    
      FatVolume* fatvol =  partVol.getFatVol();
      if (!fatvol) return 0;
    
      _gfcc_t gfcc; 
      gfcc.free = 0;
    
      switch (partVol.fatType()) {
        default: return 0;
        case FAT_TYPE_FAT16: gfcc.clusters_per_sector = 512/2; break;
        case FAT_TYPE_FAT32: gfcc.clusters_per_sector = 512/4; break;
      }
      gfcc.todo = fatvol->clusterCount() + 2;
    
      digitalWriteFast(0, HIGH);
      usmsci->readSectorsWithCB(fatvol->fatStartSector(), gfcc.todo / gfcc.clusters_per_sector + 1, 
          &_getfreeclustercountCB, (uint32_t)&gfcc);
      digitalWriteFast(0, LOW);
    
      return gfcc.free;
    }
    You can also see the differences by the LA. I have line 0 with the whole time in the API... and the second line going around either the time to read each sector by API or callback for each sector read:

    Click image for larger version. 

Name:	screenshot.jpg 
Views:	10 
Size:	34.6 KB 
ID:	23933
    I set timing markers around each time of the sections for get the free cluster count: First was call to FatPartion, the other my hack... Dito for 2nd volume.

  11. #61
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    13,791
    I took my quad partition SD to my old PC and it did not FAULT on plugging it in - then I removed the 4th Part that was ExFat with an odd partition number. I'll get that in a Teensy with updated libs soon.

    : Was very odd each time I added a partition to that SD on this new PC it would FAULT to BSOD ... actually green now and restart ... I swapped single 16GB to twin 16's ... wonder if that could be an issue as it says memory?

  12. #62
    Senior Member wwatson's Avatar
    Join Date
    Aug 2017
    Posts
    424
    @KurtE Can't wait to play with this. I had a branch of (MSC-non-blocking) that I was playing with just to try learn about buffering reads and writes to MSC. I was using CircularBuffer from @tonton81 and @mjs513 and also using attachYield() form @luni. It is working but uncontrollable for anything other than direct sector reads or writes. Hopefully this weekend I can check it out what you you have done

    I remember back when I was using the Teensy 2.0++ and an SD card I had a Fat32 driver I was using. Can't remember which one at this time. Anyway, doing a disk free check could be done two ways. It could do it the slow way and read through the data sectors or there was something kept in the FAT some where that was updated with the free space on the card. I just can't remember what it was. I need to go back and see if I can find it. There was a big difference in speed between scanning the FAT and reading the FAT report.

  13. #63
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    13,791
    Looks Good KurtE! Using: VolumeName.ino
    > HDD on HUB - 1 part
    > 64 Recovery Flash - 2 Parts
    > SD CARD 4 PARTS: 1,2,3: Good -
    -->> except:: 60GB Number four is ExFat on PC marked as Value 15 [ pt_#15: 4,0,0xFE,0xFF,0xFF,0xF,0xFE,0xFF,0xFF,117442560,12 6834688 ]
    Code:
    Waiting up to 5 seconds for USB drive 1
    ^^Waiting up to 5 seconds for USB drive 2
    ^Initialize USB drive...UsbBase::mscBegin called 20002620 1 1
    ^^^^    After usbDriveBegin
    PFsVolume::begin(20002170)
    ^^^^^USB drive 1 is present.
    
    msc # Partition Table
    	part,boot,bgnCHS[3],type,endCHS[3],start,length
    exFAT:	1,0,0x20,0x21,0x0,0x7,0xFE,0xFF,0xFF,2048,234436608
    pt_#0:	2,0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0,0
    pt_#0:	3,0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0,0
    pt_#0:	4,0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0,0
    PFsVolume::begin(20002170)
    Partition 0 valid:1
    PFsVolume::begin(20002170)
    Partition 1 valid:0
    PFsVolume::begin(20002170)
    Partition 2 valid:0
    PFsVolume::begin(20002170)
    Partition 3 valid:0
    0:>> ExFat: Volume name:(120GB_Ext) Partition Total Size:120026300416 Used:197394432 time us: 84126
        Free Clusters: API: 914222 by CB:0 time us: 0
    A_00001.dat
    A_00002.dat
    A_00003.dat
    A_00004.dat
    A_00005.dat
    A_00006.dat
    A_00007.dat
    Initialize USB drive...UsbBase::mscBegin called 20002f20 1 1
    ^^^^    After usbDriveBegin
    PFsVolume::begin(2000260c)
    USB drive 2 is present.
    
    msc # Partition Table
    	part,boot,bgnCHS[3],type,endCHS[3],start,length
    FAT32:	1,80,0x20,0x21,0x0,0xC,0xFE,0xFF,0xFF,2048,67108864
    FAT32:	2,0,0xFE,0xFF,0xFF,0xC,0xFE,0xFF,0xFF,67110912,54128640
    pt_#0:	3,0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0,0
    pt_#0:	4,0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0,0
    PFsVolume::begin(2000260c)
    Partition 0 valid:1
    PFsVolume::begin(2000260c)
    Partition 1 valid:1
    PFsVolume::begin(2000260c)
    Partition 2 valid:0
    PFsVolume::begin(2000260c)
    Partition 3 valid:0
    0:>> Fat32: Volume name:(B )###FatPartition::freeClusterCount: FT:32 start:10244 todo:1048194
        m_sectorsPerCluster:64
        m_clusterSectorMask:63
        m_sectorsPerClusterShift:6
        m_fatType:32
        m_rootDirEntryCount:0
        m_allocSearchStart:1
        m_sectorsPerFat:8190
        m_dataStartSector:26624
        m_fatStartSector:10244
        m_lastCluster:1048193
        m_rootDirStart:2
        m_bytesPerSector:512
     Partition Total Size:34347155456 Used:28836429824 time us: 3071623
        Free Clusters: API: 168174 by CB:168174 time us: 512490
    efi/
    bootmgr
    boot/
    bootmgr.efi
    sources/
    reagent.xml
    MBAMJan_2019.PNG
    MBAM_TWO.PNG
    Mejii_MBAM.txt
    HWMonitor_x64.exe
    hwmonitorw.ini
    MyPhoneExplorer/
    arduino_b1.9_B27/
    TyComm/
    tCode/
    UserBack.bat
    smonteith/
    casa/
    irs2017/
    TUN-320 Win 10 Driver/
    1:>> Fat32: Volume name:(64G_PT#2)###FatPartition::freeClusterCount: FT:32 start:67117264 todo:1690498
        m_sectorsPerCluster:32
        m_clusterSectorMask:31
        m_sectorsPerClusterShift:5
        m_fatType:32
        m_rootDirEntryCount:0
        m_allocSearchStart:1
        m_sectorsPerFat:13208
        m_dataStartSector:67143680
        m_fatStartSector:67117264
        m_lastCluster:1690497
        m_rootDirStart:2
        m_bytesPerSector:512
     Partition Total Size:27697086464 Used:65536 time us: 4953373
        Free Clusters: API: 1690492 by CB:1690492 time us: 826116
    FPartTwo.txt
    
    Initialize SD card...SD card is present.
    
    
    msc # Partition Table
    	part,boot,bgnCHS[3],type,endCHS[3],start,length
    FAT32:	1,0,0x20,0x21,0x0,0xC,0xFE,0xFF,0xFF,2048,16777216
    exFAT:	2,0,0xFE,0xFF,0xFF,0x7,0xFE,0xFF,0xFF,16779264,33554432
    FAT32:	3,0,0xFE,0xFF,0xFF,0xC,0xFE,0xFF,0xFF,50333696,67108864
    pt_#15:	4,0,0xFE,0xFF,0xFF,0xF,0xFE,0xFF,0xFF,117442560,126834688
    PFsVolume::begin(200047f0)
    
    >> Fat32: Volume name:(SD1_8GB_AD)###FatPartition::freeClusterCount: FT:32 start:10262 todo:1047042
        m_sectorsPerCluster:16
        m_clusterSectorMask:15
        m_sectorsPerClusterShift:4
        m_fatType:32
        m_rootDirEntryCount:0
        m_allocSearchStart:1
        m_sectorsPerFat:8181
        m_dataStartSector:26624
        m_fatStartSector:10262
        m_lastCluster:1047041
        m_rootDirStart:2
        m_bytesPerSector:512
     Partition Total Size:8577351680 Used:40960 time us: 187475
    SD1_8GB_AD.txt
    SD1_8GB_AD/
    PFsVolume::begin(200047f0)
    
    >> ExFat: Volume name:(SD2_16GB_AD) Partition Total Size:17175674880 Used:262144 time us: 3686
    SD2_16GB_AD/
    SD2_16GB_AD.txt
    PFsVolume::begin(200047f0)
    
    >> Fat32: Volume name:(SD3_32GB_AD)###FatPartition::freeClusterCount: FT:32 start:50341892 todo:1048194
        m_sectorsPerCluster:64
        m_clusterSectorMask:63
        m_sectorsPerClusterShift:6
        m_fatType:32
        m_rootDirEntryCount:0
        m_allocSearchStart:1
        m_sectorsPerFat:8190
        m_dataStartSector:50358272
        m_fatStartSector:50341892
        m_lastCluster:1048193
        m_rootDirStart:2
        m_bytesPerSector:512
     Partition Total Size:34347155456 Used:163840 time us: 187637
    SD3_32GB_AD/
    SD3_32GB_AD.txt
    PFsVolume::begin(200047f0)
    done...
    Press any key to run again

  14. #64
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    Location
    New York
    Posts
    6,835
    Morning @all

    @KurtE - the delta in read times is an enormous improvement - nice job. Using the updates on 32GB sdcard/adapter:
    Code:
    PFsVolume::begin(20002590)
    USB drive 1 is present.
    
    msc # Partition Table
    	part,boot,bgnCHS[3],type,endCHS[3],start,length
    FAT32:	1,80,0x20,0x21,0x0,0xC,0xC2,0x22,0x20,2048,524288
    FAT32:	2,0,0xC2,0x23,0x20,0xC,0xFE,0xFF,0xFF,526336,16564224
    exFAT:	3,0,0xFE,0xFF,0xFF,0x7,0xFE,0xFF,0xFF,17090560,229376000
    pt_#15:	4,0,0xFE,0xFF,0xFF,0xF,0xFE,0xFF,0xFF,246468545,3268671
    PFsVolume::begin(20002590)
    Partition 0 valid:1
    PFsVolume::begin(20002590)
    Partition 1 valid:1
    PFsVolume::begin(20002590)
    Partition 2 valid:1
    PFsVolume::begin(20002590)
    Partition 3 valid:0
    0:>> Fat32: Volume name:(system-boot)###FatPartition::freeClusterCount: FT:32 start:2080 todo:516192
        m_sectorsPerCluster:1
        m_clusterSectorMask:0
        m_sectorsPerClusterShift:0
        m_fatType:32
        m_rootDirEntryCount:0
        m_allocSearchStart:1
        m_sectorsPerFat:4033
        m_dataStartSector:10146
        m_fatStartSector:2080
        m_lastCluster:516191
        m_rootDirStart:2
        m_bytesPerSector:512
     Partition Total Size:264289280 Used:961024 time us: 2136998
        Free Clusters: API: 514313 by CB:514313 time us: 252491
    bench0.txt
    bench1.txt
    bench2.txt
    bench3.txt
    bench4.txt
    bench5.txt
    1:>> Fat32: Volume name:(NEW VOLUME1)###FatPartition::freeClusterCount: FT:32 start:526814 todo:2066434
        m_sectorsPerCluster:8
        m_clusterSectorMask:7
        m_sectorsPerClusterShift:3
        m_fatType:32
        m_rootDirEntryCount:0
        m_allocSearchStart:1
        m_sectorsPerFat:16145
        m_dataStartSector:559104
        m_fatStartSector:526814
        m_lastCluster:2066433
        m_rootDirStart:2
        m_bytesPerSector:512
     Partition Total Size:8464105472 Used:983040 time us: 8072873
        Free Clusters: API: 2066192 by CB:2066192 time us: 1009491
    bench0.txt
    bench1.txt
    bench2.txt
    bench3.txt
    bench4.txt
    bench5.txt
    2:>> ExFat: Volume name:(exFat) Partition Total Size:117435269120 Used:1966080 time us: 109502
        Free Clusters: API: 895945 by CB:0 time us: 0
    aoyue-8032a.pdf
    It looks like the 4th partition is not reading the MBR correctly. In @defragsters test it was for an extFAT partition - in my case the 4th partition is a FAT16 but not reading FAT-type correctly.

    As a quick test I change the IP look so it reads ip<6 instead of ip<5:
    Code:
    FAT32:	1,80,0x20,0x21,0x0,0xC,0xC2,0x22,0x20,2048,524288
    FAT32:	2,0,0xC2,0x23,0x20,0xC,0xFE,0xFF,0xFF,526336,16564224
    exFAT:	3,0,0xFE,0xFF,0xFF,0x7,0xFE,0xFF,0xFF,17090560,229376000
    pt_#15:	4,0,0xFE,0xFF,0xFF,0xF,0xFE,0xFF,0xFF,246468545,3268671
    FAT16:	5,55,0xAA,0xB8,0xE8,0x6,0x20,0x40,0x2A,73728,319815680
    According to this FAT16 is on partition 5? Have to do some checking.

  15. #65
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    Location
    New York
    Posts
    6,835
    Based on the MBR issue in post #64 looks like there really was a bit of space unallocated between partition 3 and 4 on my drive. I deleted part 3 and 4 and recreated them and now the MBR is correct for what I wanted:
    Code:
    msc # Partition Table
    	part,boot,bgnCHS[3],type,endCHS[3],start,length
    FAT32:	1,80,0x20,0x21,0x0,0xC,0xC2,0x22,0x20,2048,524288
    FAT32:	2,0,0xC2,0x23,0x20,0xC,0xFE,0xFF,0xFF,526336,16564224
    exFAT:	3,0,0xFE,0xFF,0xFF,0x7,0xFE,0xFF,0xFF,17090560,228452352
    FAT16:	4,0,0xFE,0xFF,0xFF,0xE,0xFE,0xFF,0xFF,245542912,4194304
    @defragster - you may be seeing the same thing as I did on your drive - may be a bit of unallocated space between your partitions.

  16. #66
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    8,906
    Morning all,

    It is interesting with the Fat tables. Knowing what type of partition each one is, is done by SDFat code. My PFsFat classes are again just FsFat class with a couple things now:

    it allows me to pass in the partition number to the begin... That was it until yesterdays, hack which I added members to retrieve the Fat or ExFat object.

    What the begin does, is to first cast (that funky new) some internal storage to be an ExFatVolume and then try to call begin on it with the partition number. If that returns success we are done.
    If that fails it casts the storage (again new) to FatVolume and again call begin.

    So if we are failing (and I have not screwed up with to few of the MSC objects), than the underlying fat code did not like the volume. So may have to track down why.

    Also note, this partition code is restricted to only handle the primary partitions (1-4), and it knows nothing about extended partitions. Probably nothing we would want to tackle!

    Sounds like something was screwed up as there is no room in the MBR for a 5th?
    Code:
    const uint16_t MBR_SIGNATURE = 0xAA55;
    const uint16_t PBR_SIGNATURE = 0xAA55;
    
    typedef struct mbrPartition {
      uint8_t boot;
      uint8_t beginCHS[3];
      uint8_t type;
      uint8_t endCHS[3];
      uint8_t relativeSectors[4];
      uint8_t totalSectors[4];
    } MbrPart_t;
    //-----------------------------------------------------------------------------
    typedef struct masterBootRecordSector {
      uint8_t   bootCode[446];
      MbrPart_t part[4];
      uint8_t   signature[2];
    } MbrSector_t;
    If my early morning math is correct, the MbrSector_t adds up to 512 bytes.

    But again maybe not enough coffee yet!

  17. #67
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    Location
    New York
    Posts
    6,835
    Quote Originally Posted by KurtE
    Sounds like something was screwed up as there is no room in the MBR for a 5th?
    To be honest the only reason I even tried 5 partitions was I thought maybe there was something wrong with the indices.

    Was looking at that structure this morning as well since I wasn't sure how the MbrPart_t was set up. Not sure why it worked unless since the partition failed it didn't count it so it allowed an extra partition - sounds strange doesn't it?

  18. #68
    Senior Member
    Join Date
    Apr 2014
    Location
    Cheltenham, UK
    Posts
    168
    Windows only allows a maximum of 4 partitions per drive.

  19. #69
    Senior Member wwatson's Avatar
    Join Date
    Aug 2017
    Posts
    424
    Quote Originally Posted by KurtE View Post
    So far I have done a really dirty version of the FatPartition getFreeClusterCount code as part of the VolumeName.ino sketch.

    I think most if not all of the changes are in the two Github Projects:

    USBHost_t36 I added a new method to the class for call backs on reading multiple sectors: https://github.com/KurtE/USBHost_t36...ead_sectors_cb
    And updated the branch/fork; https://github.com/KurtE/UsbMscFat/tree/VolumeName_SD

    I do think it is showing some progress, not sure yet on how to cleanly implement it...

    And note I have not done ExFat here yet...

    Debug output, minus the LS stuff...

    Code:
    msc # Partition Table
    	part,boot,bgnCHS[3],type,endCHS[3],start,length
    FAT32:	1,0,0x4,0x1,0x4,0xB,0xFE,0xC2,0xFF,2048,8192000
    FAT16:	2,0,0xE,0x51,0xFE,0xE,0x98,0x98,0x80,8194048,2097152
    exFAT:	3,0,0x98,0x99,0x80,0x7,0xEE,0xDC,0xD2,10291200,5435392
    pt_#0:	4,0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0,0
    
    Partition 3 valid:0
    0:>> Fat32: Volume name:(VOLFAT32) Partition Total Size:4186095616 Used:65425408 time us: 6096623
        Free Clusters: API: 1006023 by CB:1006023 time us: 499741
    1:>> Fat16: Volume name:(VOLFAT16) Partition Total Size:1073446912 Used:11714560 time us: 192000
        Free Clusters: API: 64803 by CB:64803 time us: 016740
    2:>> ExFat: Volume name:(VolEXFAT) Partition Total Size:2782461952 Used:232030208 time us: 17002
        Free Clusters: API: 77833 by CB:0 time us: 0
    So for example the Fat32 big volume, took over six seconds by the FatPartion call: 6096623
    Actually slightly cheating as that time included the call to get the total number of clusters which very slight:
    And with my call back code it took about .5 seconds.. So about 12 times faster....

    The Fat16 smaller one, api took: about .2 seconds by api and about .017 seconds, again not bad...
    The hacky code looks like:
    Code:
    typedef struct {
      uint32_t free;
      uint32_t todo;
      uint32_t clusters_per_sector;
    } _gfcc_t;
    
    
    void _getfreeclustercountCB(uint32_t token, uint8_t *buffer) 
    {
      digitalWriteFast(1, HIGH);
      _gfcc_t *gfcc = (_gfcc_t *)token;
      uint16_t cnt = gfcc->clusters_per_sector;
      if (cnt > gfcc->todo) cnt = gfcc->todo;
      gfcc->todo -= cnt; // update count here...
    
      if (gfcc->clusters_per_sector == 512/2) {
        // fat16
        uint16_t *fat16 = (uint16_t *)buffer;
        while (cnt-- ) {
          if (*fat16++ == 0) gfcc->free++;
        }
      } else {
        uint32_t *fat32 = (uint32_t *)buffer;
        while (cnt-- ) {
          if (*fat32++ == 0) gfcc->free++;
        }
      }
    
      digitalWriteFast(1, LOW);
    }
    
    uint32_t GetFreeClusterCount(USBmscInterface *usmsci, PFsVolume &partVol)
    {
    
      FatVolume* fatvol =  partVol.getFatVol();
      if (!fatvol) return 0;
    
      _gfcc_t gfcc; 
      gfcc.free = 0;
    
      switch (partVol.fatType()) {
        default: return 0;
        case FAT_TYPE_FAT16: gfcc.clusters_per_sector = 512/2; break;
        case FAT_TYPE_FAT32: gfcc.clusters_per_sector = 512/4; break;
      }
      gfcc.todo = fatvol->clusterCount() + 2;
    
      digitalWriteFast(0, HIGH);
      usmsci->readSectorsWithCB(fatvol->fatStartSector(), gfcc.todo / gfcc.clusters_per_sector + 1, 
          &_getfreeclustercountCB, (uint32_t)&gfcc);
      digitalWriteFast(0, LOW);
    
      return gfcc.free;
    }
    You can also see the differences by the LA. I have line 0 with the whole time in the API... and the second line going around either the time to read each sector by API or callback for each sector read:

    Click image for larger version. 

Name:	screenshot.jpg 
Views:	10 
Size:	34.6 KB 
ID:	23933
    I set timing markers around each time of the sections for get the free cluster count: First was call to FatPartion, the other my hack... Dito for 2nd volume.
    @kurtE - just downloaded your changes and after running some errands I can't wait to try them out. I noticed that you changed the print and println's back to Serial.printf's again. @Paul had asked me to change these to print and println before the next beta release for debug reasons. I guess I am a little confused.

  20. #70
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    8,906
    Quote Originally Posted by BriComp View Post
    Windows only allows a maximum of 4 partitions per drive.
    Thanks.

    I believe there are two parts here.

    Master Boot Record format of disks (MBR) which is I think the only style of disks that the Partition stuff built into SDFat library supports, The MBR only has room for 4 partitions. But Windows also supports the GPT style of disks with Windows 10 (and 8.?). Not sure how many partitions it supports.

    But even with MBR, one can have more partitions, by using the idea of Extended Partition. That is one (or more) of the partitions in the MBR can be an Extended partition, which in turn this extended partition can then be divided up into more partitions... Used to do this way back when probably when there was only Fat16 or maybe Fat12...

    But the SDFat code I don't believe supports GPT nor extended partitions.

  21. #71
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    8,906
    Quote Originally Posted by wwatson View Post
    @kurtE - just downloaded your changes and after running some errands I can't wait to try them out. I noticed that you changed the print and println's back to Serial.printf's again. @Paul had asked me to change these to print and println before the next beta release for debug reasons. I guess I am a little confused.
    Sorry I maybe merged with the wrong version of the changes... Mainly the only thing I meant to play with with some of the messages was to add in more information, like this pointer or the like as when you have multiple ones to help figure out who is calling.

  22. #72
    Senior Member
    Join Date
    Apr 2014
    Location
    Cheltenham, UK
    Posts
    168
    Quote Originally Posted by KurtE View Post
    Thanks.

    I believe there are two parts here.

    Master Boot Record format of disks (MBR) which is I think the only style of disks that the Partition stuff built into SDFat library supports, The MBR only has room for 4 partitions. But Windows also supports the GPT style of disks with Windows 10 (and 8.?). Not sure how many partitions it supports.

    But even with MBR, one can have more partitions, by using the idea of Extended Partition. That is one (or more) of the partitions in the MBR can be an Extended partition, which in turn this extended partition can then be divided up into more partitions... Used to do this way back when probably when there was only Fat16 or maybe Fat12...

    But the SDFat code I don't believe supports GPT nor extended partitions.
    Even by using an extended partition which can hold other partitions, I still believe that the total number of partitions on an MBR formatted drive is 4.
    A GPT partition can be formatted with up to 128 drives.

  23. #73
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    8,906
    Quote Originally Posted by BriComp View Post
    Even by using an extended partition which can hold other partitions, I still believe that the total number of partitions on an MBR formatted drive is 4.
    A GPT partition can be formatted with up to 128 drives.
    Thanks, The SDFat library code is not setup to handle GPT... So not sure if anyone will look at adding it to the MSC stuff...

    @all Thought about more hack for exFat free clusters, but the main code appears to be fast enough:
    Created a second Thumbstick with 4 partitions.

    Code:
    ^^^^^^^^^~~~~Initialize USB drive...UsbBase::mscBegin called 200024e0 1 1
    ^^^^    After usbDriveBegin
    PFsVolume::begin(20002030)
    ExFatVolume::begin(20002030 1 1
    USB drive 1 is present.
    
    msc # Partition Table
    	part,boot,bgnCHS[3],type,endCHS[3],start,length
    FAT32:	1,0,0x4,0x1,0x4,0xB,0xFE,0xC2,0xFF,2048,4096000
    exFAT:	2,0,0x17,0x19,0xFF,0x7,0xE,0x50,0xFE,4098048,4096000
    FAT32:	3,0,0xE,0x51,0xFE,0xC,0x5,0x88,0xFD,8194048,4096000
    FAT16:	4,0,0xFE,0xC2,0xFF,0x6,0xFE,0xC2,0xFF,12290048,3438592
    Partition 0 valid:1
       After init
       After chdir
    Partition 1 valid:1
    Partition 2 valid:1
    Partition 3 valid:1
    0:>> Fat32: Volume name:(FAT32) Partition Total Size:2093039616 Used:20480 time us: 3992873
        Free Clusters: API: 510991 by CB:510991 time us: 250492
    OnFat32.txt
    Hummingbirds.jpg
    1:>> ExFat: Volume name:(ExFat) Partition Total Size:2096824320 Used:3571712 time us: 16001
        Free Clusters: API: 63881 by CB:0 time us: 1
    OnExFat.txt
    DSC03357.JPG
    2:>> Fat32: Volume name:(FAT32) Partition Total Size:2092957696 Used:3391488 time us: 3992873
        Free Clusters: API: 510148 by CB:510148 time us: 250491
    OnFat32.txt
    DSC03355.JPG
    3:>> Fat16: Volume name:(FAT16-PAR4) Partition Total Size:1760231424 Used:884736 time us: 209999
        Free Clusters: API: 53691 by CB:53691 time us: 13990
    OnFat16_P4.txt
    T4-Cardlike.jpg
    T4.1-Cardlike.jpg
    Will try to cleanup the messages again to be back to the USBHost_t36 format of messages. Note: In some of the different object types we have a mix of either using the
    Setting withing the Header file: //#define USBHOST_PRINT_DEBUG

    and some that I have specific for a class, where we turning all the whole library debug ends up swamping you with too much stuff..

  24. #74
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    13,791
    Quote Originally Posted by mjs513 View Post
    Based on the MBR issue in post #64 looks like there really was a bit of space unallocated between partition 3 and 4 on my drive. I deleted part 3 and 4 and recreated them and now the MBR is correct for what I wanted:
    ...

    @defragster - you may be seeing the same thing as I did on your drive - may be a bit of unallocated space between your partitions.
    No Joy. Went to old machine that doesn't fault on partitioning. Deleted #3 and #4 and recreated them. Same result:
    Code:
    msc # Partition Table
    	part,boot,bgnCHS[3],type,endCHS[3],start,length
    FAT32:	1,0,0x20,0x21,0x0,0xC,0xFE,0xFF,0xFF,2048,16777216
    exFAT:	2,0,0xFE,0xFF,0xFF,0x7,0xFE,0xFF,0xFF,16779264,33554432
    FAT32:	3,0,0xFE,0xFF,0xFF,0xC,0xFE,0xFF,0xFF,50333696,65536000
    pt_#15:	4,0,0xFE,0xFF,0xFF,0xF,0xFE,0xFF,0xFF,115869696,128407552
    PFsVolume::begin(200047f0)
    Of course I made #3 32000 in size so maybe that does leave a void before #4 can start in the same way it did before. Will redo later not using 'marketing megabytes' - but a real multiple of 4KB ... 32768 perhaps

    I tried the ip<6 and it wouldn't compile as there is a fixed array somewhere that broke the build?

  25. #75
    Senior Member wwatson's Avatar
    Join Date
    Aug 2017
    Posts
    424
    @KurtE - Just downloaded and tested your changes. Man that is impressive All this this time I have been trying to do what you just did with minimal success. I wonder if we could do something similar with MSC writes? I will be studying the code.

    Will try to cleanup the messages again to be back to the USBHost_t36 format of messages. Note: In some of the different object types we have a mix of either using the
    Setting withing the Header file: //#define USBHOST_PRINT_DEBUG

    and some that I have specific for a class, where we turning all the whole library debug ends up swamping you with too much stuff..
    Yes, I agree. It produces a heavy spew of info that makes it hard to isolate the info you are looking for. Maybe setup different levels of verbosity. What I added was just to isolate methods where lockups would happen. Maybe not needed.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •