USBHost_t36 USB Mass Storage Driver Experiments

@KurtE
I just formatted my SSD to have 2 partitions: Partition 0: 97GB exFat, Partition 1: 14GB, 14GB. I set FF_MULTI_PARTITION to 1 and ran the DISK_IO test (Other sketched would not compile with FF_MULTI_PARTITION=1). It did recognize the 2 partitions but.....
Code:
Test diskio
uSDFS_VER:15_MAY_19_08_16
USB2 PLL running
 reset waited 6
USBHS_ASYNCLISTADDR = 0
USBHS_PERIODICLISTBASE = 20004000
periodictable = 20004000
port change: 10001803
    connect
  begin reset
port change: 18001205
  port enabled
  end recovery
new_Device: 480 Mbit/sec
new_Pipe
enumeration:
enumeration:
enumeration:
Device Descriptor:
  12 01 10 02 00 00 00 40 2D 15 78 05 09 05 01 02 03 01 
    VendorID = 152D, ProductID = 0578, Version = 0509
    Class/Subclass/Protocol = 0 / 0 / 0
    Number of Configurations = 1
enumeration:
enumeration:
Manufacturer: JMicron
enumeration:
Product: External USB 3.0
enumeration:
Serial Number: 0123456789CB
enumeration:
Config data length = 85
enumeration:
Configuration Descriptor:
  09 02 55 00 01 01 00 80 FA 
    NumInterfaces = 1
    ConfigurationValue = 1
  09 04 00 00 02 08 06 50 00 
    Interface = 0
    Number of endpoints = 2
    Class/Subclass/Protocol = 8(Mass Storage) / 6(SCSI) / 80(Bulk Only)
  07 05 81 02 00 02 00 
    Endpoint = 1 IN
    Type = Bulk
    Max Size = 512
    Polling Interval = 0
  07 05 02 02 00 02 00 
    Endpoint = 2 OUT
    Type = Bulk
    Max Size = 512
    Polling Interval = 0
  09 04 00 01 04 08 06 62 00 
    Interface = 0
    Number of endpoints = 4
    Class/Subclass/Protocol = 8(Mass Storage) / 6(SCSI) / 98(UAS)
  07 05 01 02 00 02 00 
    Endpoint = 1 OUT
    Type = Bulk
    Max Size = 512
    Polling Interval = 0
  04 24 01 00 
  07 05 82 02 00 02 00 
    Endpoint = 2 IN
    Type = Bulk
    Max Size = 512
    Polling Interval = 0
  04 24 02 00 
  07 05 83 02 00 02 00 
    Endpoint = 3 IN
    Type = Bulk
    Max Size = 512
    Polling Interval = 0
  04 24 03 00 
  07 05 04 02 00 02 00 
    Endpoint = 4 OUT
    Type = Bulk
    Max Size = 512
    Polling Interval = 0
  04 24 04 00 
enumeration:
msController claim this=20002B80
msController claim this=20002F00
msController claim this=20003280
Descriptor 4 = INTERFACE
msController claim this=20002B80
09 04 00 00 02 08 06 50 00 07 05 81 02 00 02 00 07 05 02 02 00 02 00 09 04 00 01 04 08 06 62 00 07 05 01 02 00 02 00 04 24 01 00 07 05 82 02 00 02 00 04 24 02 00 07 05 83 02 00 02 00 04 24 03 00 07 05 04 02 00 02 00 04 24 04 00 
numendpoint=2
endpointIn=81
endpointOut=2
packet size in (msController) = 512
packet size out (msController) = 512
polling intervalIn = 0
polling intervalOut = 0
new_Pipe
new_Pipe
Descriptor 5 = ENDPOINT
Descriptor 5 = ENDPOINT
Descriptor 4 = INTERFACE
msController claim this=20002F00
09 04 00 01 04 08 06 62 00 07 05 01 02 00 02 00 04 24 01 00 07 05 82 02 00 02 00 04 24 02 00 07 05 83 02 00 02 00 04 24 03 00 07 05 04 02 00 02 00 04 24 04 00 
msController claim this=20003280
09 04 00 01 04 08 06 62 00 07 05 01 02 00 02 00 04 24 01 00 07 05 82 02 00 02 00 04 24 02 00 07 05 83 02 00 02 00 04 24 03 00 07 05 04 02 00 02 00 04 24 04 00 
Descriptor 5 = ENDPOINT
Descriptor 36 =  ???
Descriptor 5 = ENDPOINT
Descriptor 36 =  ???
Descriptor 5 = ENDPOINT
Descriptor 36 =  ???
Descriptor 5 = ENDPOINT
Descriptor 36 =  ???
control CallbackIn (msController)
00 00 00 00 00 00 00 00 
control CallbackIn (msController)
00 00 00 00 00 00 00 00 
msController CallbackOut (static)
transfer->qtd.token = 0
msController dataOut (static)31
55 53 42 43 01 00 00 00 00 00 00 00 80 00 06 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
msController CallbackIn (static)
transfer->qtd.token = 0
msController dataIn (static): 13
55 53 42 53 01 00 00 00 00 00 00 00 01 
** CSWSIGNATURE
Disk initialize Status: STA_NODISK
msController CallbackOut (static)
transfer->qtd.token = 0
msController dataOut (static)31
55 53 42 43 02 00 00 00 00 00 00 00 80 00 06 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
msController CallbackIn (static)
transfer->qtd.token = 0
msController dataIn (static): 13
55 53 42 53 02 00 00 00 00 00 00 00 00 
** CSWSIGNATURE
msController CallbackOut (static)
transfer->qtd.token = 0
msController dataOut (static)31
55 53 42 43 03 00 00 00 00 02 00 00 80 00 0A 28 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 
msController CallbackIn (static)
transfer->qtd.token = 0
msController dataIn (static): 512
33 C0 8E D0 BC 00 7C 8E C0 8E D8 BE 00 7C BF 00 06 B9 00 02 FC F3 A4 50 68 1C 06 CB FB B9 04 00 
** ????
msController CallbackIn (static)
transfer->qtd.token = 0
msController dataIn (static): 13
55 53 42 53 03 00 00 00 00 00 00 00 00 
** CSWSIGNATURE
Disk read Result: FR_OK
33 c0 8e d0 bc 00 7c 8e c0 8e d8 be 00 7c bf 00
06 b9 00 02 fc f3 a4 50 68 1c 06 cb fb b9 04 00
bd be 07 80 7e 00 00 7c 0b 0f 85 0e 01 83 c5 10
e2 f1 cd 18 88 56 00 55 c6 46 11 05 c6 46 10 00
b4 41 bb aa 55 cd 13 5d 72 0f 81 fb 55 aa 75 09
f7 c1 01 00 74 03 fe 46 10 66 60 80 7e 10 00 74
26 66 68 00 00 00 00 66 ff 76 08 68 00 00 68 00
7c 68 01 00 68 10 00 b4 42 8a 56 00 8b f4 cd 13
9f 83 c4 10 9e eb 14 b8 01 02 bb 00 7c 8a 56 00
8a 76 01 8a 4e 02 8a 6e 03 cd 13 66 61 73 1c fe
4e 11 75 0c 80 7e 00 80 0f 84 8a 00 b2 80 eb 84
55 32 e4 8a 56 00 cd 13 5d eb 9e 81 3e fe 7d 55
aa 75 6e ff 76 00 e8 8d 00 75 17 fa b0 d1 e6 64
e8 83 00 b0 df e6 60 e8 7c 00 b0 ff e6 64 e8 75
00 fb b8 00 bb cd 1a 66 23 c0 75 3b 66 81 fb 54
43 50 41 75 32 81 f9 02 01 72 2c 66 68 07 bb 00
00 66 68 00 02 00 00 66 68 08 00 00 00 66 53 66
53 66 55 66 68 00 00 00 00 66 68 00 7c 00 00 66
61 68 00 00 07 cd 1a 5a 32 f6 ea 00 7c 00 00 cd
18 a0 b7 07 eb 08 a0 b6 07 eb 03 a0 b5 07 32 e4
05 00 07 8b f0 ac 3c 00 74 09 bb 07 00 b4 0e cd
10 eb f2 f4 eb fd 2b c9 e4 64 eb 00 24 02 e0 f8
24 02 c3 49 6e 76 61 6c 69 64 20 70 61 72 74 69
74 69 6f 6e 20 74 61 62 6c 65 00 45 72 72 6f 72
20 6c 6f 61 64 69 6e 67 20 6f 70 65 72 61 74 69
6e 67 20 73 79 73 74 65 6d 00 4d 69 73 73 69 6e
67 20 6f 70 65 72 61 74 69 6e 67 20 73 79 73 74
65 6d 00 00 00 63 7b 9a 09 dc 4f 48 00 00 00 20
21 00 07 fe ff ff 00 08 00 00 00 00 35 0c 00 fe
ff ff 0c fe ff ff 00 08 35 0c 00 30 c4 01 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 55 aa

Master Boot Record
[COLOR="#FF0000"]  Partition: 0 first Sector: 2048 total Sectors: 204800000
  Partition: 1 first Sector: 204802048 total Sectors: 29634560[/COLOR]  ??? not sure this is right
  Partition: 2 first Sector: 0 total Sectors: 0
  Partition: 3 first Sector: 0 total Sectors: 0

First partition Sector
msController CallbackOut (static)
transfer->qtd.token = 0
msController dataOut (static)31
55 53 42 43 04 00 00 00 00 00 00 00 80 00 06 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
msController CallbackIn (static)
transfer->qtd.token = 0
msController dataIn (static): 13
55 53 42 53 04 00 00 00 00 00 00 00 00 
** CSWSIGNATURE
msController CallbackOut (static)
transfer->qtd.token = 0
msController dataOut (static)31
55 53 42 43 05 00 00 00 00 02 00 00 80 00 0A 28 00 00 00 08 00 00 00 01 00 00 00 00 00 00 00 
msController CallbackIn (static)
transfer->qtd.token = 0
msController dataIn (static): 512
EB 76 90 45 58 46 41 54 20 20 20 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
** ????
msController CallbackIn (static)
transfer->qtd.token = 0
msController dataIn (static): 13
55 53 42 53 05 00 00 00 00 00 00 00 00 
** CSWSIGNATURE
Disk read Result: FR_OK
eb 76 90 45 58 46 41 54 20 20 20 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 08 00 00 00 00 00 00 00 00 35 0c 00 00 00 00
00 08 00 00 00 19 00 00 00 28 00 00 d8 34 0c 00
04 00 00 00 e1 88 df 18 00 01 00 00 09 08 01 80
00 00 00 00 00 00 00 00 33 c9 8e d1 8e c1 8e d9
bc d0 7b bd 00 7c 88 16 6f 7c b4 41 bb aa 55 cd
13 72 69 81 fb 55 aa 75 63 f6 c1 01 74 5e fe 06
02 7c 66 50 b0 65 e8 a6 00 66 58 66 b8 01 00 00
00 8a 0e 6d 7c 66 d3 e0 66 89 46 e8 66 b8 01 00
00 00 8a 0e 6c 7c 66 d3 e0 66 89 46 d8 66 a1 40
7c 66 40 bb 00 7e b9 01 00 66 50 e8 41 00 66 58
66 40 bb 00 80 b9 01 00 e8 34 00 66 50 b0 78 e8
5d 00 66 58 e9 09 01 a0 fc 7d eb 05 a0 fb 7d eb
00 b4 7d 8b f0 ac 98 40 74 0c 48 74 0e b4 0e bb
07 00 cd 10 eb ef a0 fd 7d eb e6 cd 16 cd 19 66
60 66 6a 00 66 50 06 53 66 68 10 00 01 00 b4 42
b2 80 8a 16 6f 7c 8b f4 cd 13 66 58 66 58 66 58
66 58 66 61 72 b1 03 5e d8 66 40 49 75 d1 c3 66
60 b4 0e bb 07 00 b9 01 00 cd 10 66 61 c3 42 00
4f 00 4f 00 54 00 4d 00 47 00 52 00 0d 0a 52 65
6d 6f 76 65 20 64 69 73 6b 73 20 6f 72 20 6f 74
68 65 72 20 6d 65 64 69 61 2e ff 0d 0a 44 69 73
6b 20 65 72 72 6f 72 ff 0d 0a 50 72 65 73 73 20
61 6e 79 20 6b 65 79 20 74 6f 20 72 65 73 74 61
72 74 0d 0a 00 00 00 00 00 00 00 00 00 00 ff ff
ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
ff ff ff ff ff ff ff ff ff ff ff 6c 8b 98 55 aa
EXFAT
bytes per sector :512
sectors per cluster :256
 
Got KurtE's updated MSC code.
I ran that and dumped those two sectors - below. Made me wonder what my EASEUS Partition Master software would show. Looks like there is a tiny 'other' part that may be in the way here:
SBarr500_2part.jpg

Code:
[B]Mount: Failed with rc=FR_NO_FILESYSTEM.[/B]
[COLOR="#FF0000"]Test diskio[/COLOR]
uSDFS_VER:15_MAY_19_08_16
Disk initialize Status: STA_OK
Disk read Result: FR_OK
33 c0 8e d0 bc 00 7c 8e c0 8e d8 be 00 7c bf 00
06 b9 00 02 fc f3 a4 50 68 1c 06 cb fb b9 04 00
bd be 07 80 7e 00 00 7c 0b 0f 85 0e 01 83 c5 10
e2 f1 cd 18 88 56 00 55 c6 46 11 05 c6 46 10 00
b4 41 bb aa 55 cd 13 5d 72 0f 81 fb 55 aa 75 09
f7 c1 01 00 74 03 fe 46 10 66 60 80 7e 10 00 74
26 66 68 00 00 00 00 66 ff 76 08 68 00 00 68 00
7c 68 01 00 68 10 00 b4 42 8a 56 00 8b f4 cd 13
9f 83 c4 10 9e eb 14 b8 01 02 bb 00 7c 8a 56 00
8a 76 01 8a 4e 02 8a 6e 03 cd 13 66 61 73 1c fe
4e 11 75 0c 80 7e 00 80 0f 84 8a 00 b2 80 eb 84
55 32 e4 8a 56 00 cd 13 5d eb 9e 81 3e fe 7d 55
aa 75 6e ff 76 00 e8 8d 00 75 17 fa b0 d1 e6 64
e8 83 00 b0 df e6 60 e8 7c 00 b0 ff e6 64 e8 75
00 fb b8 00 bb cd 1a 66 23 c0 75 3b 66 81 fb 54
43 50 41 75 32 81 f9 02 01 72 2c 66 68 07 bb 00
00 66 68 00 02 00 00 66 68 08 00 00 00 66 53 66
53 66 55 66 68 00 00 00 00 66 68 00 7c 00 00 66
61 68 00 00 07 cd 1a 5a 32 f6 ea 00 7c 00 00 cd
18 a0 b7 07 eb 08 a0 b6 07 eb 03 a0 b5 07 32 e4
05 00 07 8b f0 ac 3c 00 74 09 bb 07 00 b4 0e cd
10 eb f2 f4 eb fd 2b c9 e4 64 eb 00 24 02 e0 f8
24 02 c3 49 6e 76 61 6c 69 64 20 70 61 72 74 69
74 69 6f 6e 20 74 61 62 6c 65 00 45 72 72 6f 72
20 6c 6f 61 64 69 6e 67 20 6f 70 65 72 61 74 69
6e 67 20 73 79 73 74 65 6d 00 4d 69 73 73 69 6e
67 20 6f 70 65 72 61 74 69 6e 67 20 73 79 73 74
65 6d 00 00 00 63 7b 9a 00 00 00 00 00 00 00 00
02 00 ee fe 7f 80 01 00 00 00 ff ff ff ff 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 55 aa

Master Boot Record
  Partition: 0 first Sector: 1 total Sectors: 4294967295
  Partition: 1 first Sector: 0 total Sectors: 0
  Partition: 2 first Sector: 0 total Sectors: 0
  Partition: 3 first Sector: 0 total Sectors: 0

First partition Sector
Disk read Result: FR_OK
45 46 49 20 50 41 52 54 00 00 01 00 5c 00 00 00
f0 aa 06 23 00 00 00 00 01 00 00 00 00 00 00 00
2f 60 38 3a 00 00 00 00 22 00 00 00 00 00 00 00
0e 60 38 3a 00 00 00 00 05 64 1c ab 22 3e 6f 4d
85 92 ca 19 2b 02 a6 da 02 00 00 00 00 00 00 00
80 00 00 00 80 00 00 00 75 94 5c 58 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

Used Partition Master to wipe all parts and added back a 12GB Fat32 followed by a 450GB ExFat - sectors below, but logger_RawWrite_FS still returns:
Code:
[B]Test logger_RawWrite[/B]
1970-01-01 00:00:00
BUFFSIZE :8192
Dev Type :2
Using uSDFS
uSDFS_VER:15_MAY_19_08_16
Mount: Failed with rc=FR_NO_FILESYSTEM.

Code:
[COLOR="#FF0000"]Test diskio[/COLOR]
uSDFS_VER:15_MAY_19_08_16
Disk initialize Status: STA_OK
Disk read Result: FR_OK
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 b2 ba 59 05 00 00 00 00
02 00 ee fe 7f 80 01 00 00 00 ff ff ff ff 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 55 aa

Master Boot Record
  Partition: 0 first Sector: 1 total Sectors: 4294967295
  Partition: 1 first Sector: 0 total Sectors: 0
  Partition: 2 first Sector: 0 total Sectors: 0
  Partition: 3 first Sector: 0 total Sectors: 0

First partition Sector
Disk read Result: FR_OK
45 46 49 20 50 41 52 54 00 00 01 00 5c 00 00 00
fa 86 4e 5d 00 00 00 00 01 00 00 00 00 00 00 00
2f 60 38 3a 00 00 00 00 22 00 00 00 00 00 00 00
0e 60 38 3a 00 00 00 00 05 64 1c ab 22 3e 6f 4d
85 92 ca 19 2b 02 a6 da 02 00 00 00 00 00 00 00
80 00 00 00 80 00 00 00 ba b3 2a 44 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 
@defragster - maybe I missed an update somewher.

Did you remember to change FF_MULTIPARTION to 1 in the FF_conf.h file?
 
Just did: #define FF_MULTI_PARTITION 1

Get a not defined fail on this in ...\libraries\uSDFS\src\ff.c
Code:
#if FF_MULTI_PARTITION
#define LD2PD(vol) VolToPart[vol].pd	/* Get physical drive number */
#define LD2PT(vol) VolToPart[vol].pt	/* Get partition index */

Put that #define in a couple othe rplaces - still getting:
Code:
"T:\\TEMP\\arduino_build_logger_RawWrite_FS.ino/core\\core.a" "-LT:\\TEMP\\arduino_build_logger_RawWrite_FS.ino" -larm_cortexM7lfsp_math -lm -lstdc++
T:\TEMP\arduino_build_logger_RawWrite_FS.ino\libraries\uSDFS\ff.c.o: In function `find_volume':
T:\tCode\libraries\uSDFS\src/ff.c:3287: undefined reference to `VolToPart'
 
@defragster - ok you got me on. Mine seemed to work on the SSD drive. You testing on a HDD I presume. I'll have to break mine out again and give it a try.
 
@KurtE - did you try the drive partitioned with 2 exFAT partitions using multipartion? Will have to update and see what happens :)

So far I have not tried turning on the multipartion support and try to see what happens...

I did look at some of the code and at that flag: Things like:

Code:
#if FF_MULTI_PARTITION
#define LD2PD(vol) VolToPart[vol].pd	/* Get physical drive number */
#define LD2PT(vol) VolToPart[vol].pt	/* Get partition index */
#else
#define LD2PD(vol) (BYTE)(vol)	/* Each logical drive is bound to the same physical drive number */
#define LD2PT(vol) 0			/* Find first valid partition or in SFD */
#endif
Where it sounded like the 0->SPI, 1->SD, 2->USB mapping was not going to be the same...

@looks like @WMXZ checked in an update that enabled the flag, which does not build on my machine?
Code:
"D:\\arduino-1.8.9\\hardware\\teensy/../tools/arm/bin/arm-none-eabi-gcc" -O2 -Wl,--gc-sections,--relax "-TD:\\arduino-1.8.9\\hardware\\teensy\\avr\\cores\\teensy4/imxrt1062.ld" -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -o "C:\\Users\\kurte\\AppData\\Local\\Temp\\arduino_build_257576/logger_RawWrite.ino.elf" "C:\\Users\\kurte\\AppData\\Local\\Temp\\arduino_build_257576\\sketch\\logger_RawWrite.ino.cpp.o" "C:\\Users\\kurte\\AppData\\Local\\Temp\\arduino_build_257576\\libraries\\uSDFS\\diskio.c.o" "C:\\Users\\kurte\\AppData\\Local\\Temp\\arduino_build_257576\\libraries\\uSDFS\\ff.c.o" "C:\\Users\\kurte\\AppData\\Local\\Temp\\arduino_build_257576\\libraries\\uSDFS\\ffsystem.c.o" "C:\\Users\\kurte\\AppData\\Local\\Temp\\arduino_build_257576\\libraries\\uSDFS\\ffunicode.c.o" "C:\\Users\\kurte\\AppData\\Local\\Temp\\arduino_build_257576\\libraries\\uSDFS\\utility\\ff_utils.c.o" "C:\\Users\\kurte\\AppData\\Local\\Temp\\arduino_build_257576\\libraries\\uSDFS\\utility\\sd_msc.cpp.o" "C:\\Users\\kurte\\AppData\\Local\\Temp\\arduino_build_257576\\libraries\\uSDFS\\utility\\sd_sdhc.c.o" "C:\\Users\\kurte\\AppData\\Local\\Temp\\arduino_build_257576\\libraries\\uSDFS\\utility\\sd_spi.c.o" "C:\\Users\\kurte\\AppData\\Local\\Temp\\arduino_build_257576\\libraries\\MSC\\MassStorageDriver.cpp.o" "C:\\Users\\kurte\\AppData\\Local\\Temp\\arduino_build_257576\\libraries\\MSC\\MassStorageHost.cpp.o" "C:\\Users\\kurte\\AppData\\Local\\Temp\\arduino_build_257576\\libraries\\USBHost_t36\\antplus.cpp.o" "C:\\Users\\kurte\\AppData\\Local\\Temp\\arduino_build_257576\\libraries\\USBHost_t36\\bluetooth.cpp.o" "C:\\Users\\kurte\\AppData\\Local\\Temp\\arduino_build_257576\\libraries\\USBHost_t36\\digitizer.cpp.o" "C:\\Users\\kurte\\AppData\\Local\\Temp\\arduino_build_257576\\libraries\\USBHost_t36\\ehci.cpp.o" "C:\\Users\\kurte\\AppData\\Local\\Temp\\arduino_build_257576\\libraries\\USBHost_t36\\enumeration.cpp.o" "C:\\Users\\kurte\\AppData\\Local\\Temp\\arduino_build_257576\\libraries\\USBHost_t36\\hid.cpp.o" "C:\\Users\\kurte\\AppData\\Local\\Temp\\arduino_build_257576\\libraries\\USBHost_t36\\hub.cpp.o" "C:\\Users\\kurte\\AppData\\Local\\Temp\\arduino_build_257576\\libraries\\USBHost_t36\\joystick.cpp.o" "C:\\Users\\kurte\\AppData\\Local\\Temp\\arduino_build_257576\\libraries\\USBHost_t36\\keyboard.cpp.o" "C:\\Users\\kurte\\AppData\\Local\\Temp\\arduino_build_257576\\libraries\\USBHost_t36\\keyboardHIDExtras.cpp.o" "C:\\Users\\kurte\\AppData\\Local\\Temp\\arduino_build_257576\\libraries\\USBHost_t36\\memory.cpp.o" "C:\\Users\\kurte\\AppData\\Local\\Temp\\arduino_build_257576\\libraries\\USBHost_t36\\midi.cpp.o" "C:\\Users\\kurte\\AppData\\Local\\Temp\\arduino_build_257576\\libraries\\USBHost_t36\\mouse.cpp.o" "C:\\Users\\kurte\\AppData\\Local\\Temp\\arduino_build_257576\\libraries\\USBHost_t36\\print.cpp.o" "C:\\Users\\kurte\\AppData\\Local\\Temp\\arduino_build_257576\\libraries\\USBHost_t36\\rawhid.cpp.o" "C:\\Users\\kurte\\AppData\\Local\\Temp\\arduino_build_257576\\libraries\\USBHost_t36\\serial.cpp.o" "C:\\Users\\kurte\\AppData\\Local\\Temp\\arduino_build_257576/..\\arduino_cache_250464\\core\\core_teensy_avr_teensy4b2_usb_serial,opt_o2std,keys_en-us_44178ada4dfd24cbd2e3430cabf71fb5.a" "-LC:\\Users\\kurte\\AppData\\Local\\Temp\\arduino_build_257576" -larm_cortexM7lfsp_math -lm -lstdc++
C:\Users\kurte\AppData\Local\Temp\arduino_build_257576\libraries\uSDFS\ff.c.o: In function `find_volume':

C:\Users\kurte\Documents\Arduino\libraries\uSDFS\src/ff.c:3286: undefined reference to `VolToPart'

collect2.exe: error: ld returned 1 exit status
 
Thanks KurtE - I thought I read that you DID NOT need MultiPart …

I get the same error as you can see when I define it …

This 2.5" Seagate is Odd? Same as mjs513's - just half the size if 5400 RPM? And Windows has no problem with it - repartitioned/formatted half a dozen different times and ways now … using external drive holder that works on the 3.5"
 
went back to ZIP'suSDFS and KurtE's MSC to get rid of multiPart edits - and re-formatted to single exFat partition on full drive:
Code:
Test logger_RawWrite
1970-01-01 00:00:00
BUFFSIZE :8192
Dev Type :0
Using uSDFS
uSDFS_VER:15_MAY_19_08_16
[COLOR="#FF0000"]Mount: Failed with rc=FR_DISK_ERR.[/COLOR]

localtime doesn't exist yet? Have to wipe this out
Code:
extern void *__rtc_localtime;
void rtc_sync(void)
{
  rtc_init();
  #if 0
[B]  if((uint32_t)&__rtc_localtime > (rtc_secs()+10))
    rtc_set_time((uint32_t)&__rtc_localtime);   //LPSRTC will start at 0 otherwise
[/B]#endif
}

But diskio MBR shows these sedctors:
Code:
Test diskio
uSDFS_VER:15_MAY_19_08_16
Disk initialize Status: STA_OK
Disk read Result: FR_OK
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 b2 ba 59 05 00 00 00 00
02 00 ee fe 7f 80 01 00 00 00 ff ff ff ff 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 55 aa

Master Boot Record
  Partition: 0 first Sector: 1 total Sectors: 4294967295
  Partition: 1 first Sector: 0 total Sectors: 0
  Partition: 2 first Sector: 0 total Sectors: 0
  Partition: 3 first Sector: 0 total Sectors: 0

First partition Sector
Disk read Result: FR_OK
45 46 49 20 50 41 52 54 00 00 01 00 5c 00 00 00
f8 e1 30 b3 00 00 00 00 01 00 00 00 00 00 00 00
2f 60 38 3a 00 00 00 00 22 00 00 00 00 00 00 00
0e 60 38 3a 00 00 00 00 05 64 1c ab 22 3e 6f 4d
85 92 ca 19 2b 02 a6 da 02 00 00 00 00 00 00 00
80 00 00 00 80 00 00 00 94 28 cf 8a 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 
@KurtE and @defragster
Just reran the disk_io sketch with FF_Multi = 0 and it still read the two partitions with Kurt's changes, thought it had to be on for some reason:
Code:
  Partition: 0 first Sector: 2048 total Sectors: 204800000
  Partition: 1 first Sector: 204802048 total Sectors: 29634560
  Partition: 2 first Sector: 0 total Sectors: 0
  Partition: 3 first Sector: 0 total Sectors: 0

Now, here is something strange - with the Seagate 2.5 in 5400rpm 1Tb drive in my docking station with 2 extFAT partitions: 900Gb and 31Gb:
Code:
  Partition: 0 first Sector: 2048 total Sectors: 1843200000
  Partition: 1 first Sector: 1843202048 total Sectors: 110317568
  Partition: 2 first Sector: 0 total Sectors: 0
  Partition: 3 first Sector: 0 total Sectors: 0
Still sees two partitions.
 
@mjs513 - I assume it reads an sees the partition table - perhaps without the MULTI it can only access ONE partition - that note on compile fail KurtE and I saw above shows an array object that seems to allow it to store and selectively access multiple parts?
 
@defragster
The sketch seems to read the partition table no problem and is set up for only to read the first sector of the 1st partition. I tried to hack the code the read the second partition but it seems to loose the first sector of the second partition so getting a couple of errors. it looses mbr->part[1].firstSector. Example if after it reads the first partition I print them out again I get:
Code:
  Partition: 0 first Sector: 4294967295 total Sectors: 4294967295
  Partition: 1 first Sector: 4294967295 total Sectors: 4294967295
  Partition: 2 first Sector: 4294967295 total Sectors: 4294967295
  Partition: 3 first Sector: 4294967295 total Sectors: 2559274239
instead of this:
Code:
  Partition: 0 first Sector: 2048 total Sectors: 1843200000
  Partition: 1 first Sector: 1843202048 total Sectors: 110317568
  Partition: 2 first Sector: 0 total Sectors: 0
  Partition: 3 first Sector: 0 total Sectors: 0
 
@defragster and @KurtE
Ok Got it working. Hate reuse of buffers sometimes. Any put my SSD back on since it had 1 part of exFat and 1 Part of FAT32. Using the modified sketch for 2 partitions:
Code:
Test diskio
uSDFS_VER:15_MAY_19_08_16
Disk initialize Status: STA_NODISK
Disk read Result: FR_OK
33 c0 8e d0 bc 00 7c 8e c0 8e d8 be 00 7c bf 00
06 b9 00 02 fc f3 a4 50 68 1c 06 cb fb b9 04 00
bd be 07 80 7e 00 00 7c 0b 0f 85 0e 01 83 c5 10
e2 f1 cd 18 88 56 00 55 c6 46 11 05 c6 46 10 00
b4 41 bb aa 55 cd 13 5d 72 0f 81 fb 55 aa 75 09
f7 c1 01 00 74 03 fe 46 10 66 60 80 7e 10 00 74
26 66 68 00 00 00 00 66 ff 76 08 68 00 00 68 00
7c 68 01 00 68 10 00 b4 42 8a 56 00 8b f4 cd 13
9f 83 c4 10 9e eb 14 b8 01 02 bb 00 7c 8a 56 00
8a 76 01 8a 4e 02 8a 6e 03 cd 13 66 61 73 1c fe
4e 11 75 0c 80 7e 00 80 0f 84 8a 00 b2 80 eb 84
55 32 e4 8a 56 00 cd 13 5d eb 9e 81 3e fe 7d 55
aa 75 6e ff 76 00 e8 8d 00 75 17 fa b0 d1 e6 64
e8 83 00 b0 df e6 60 e8 7c 00 b0 ff e6 64 e8 75
00 fb b8 00 bb cd 1a 66 23 c0 75 3b 66 81 fb 54
43 50 41 75 32 81 f9 02 01 72 2c 66 68 07 bb 00
00 66 68 00 02 00 00 66 68 08 00 00 00 66 53 66
53 66 55 66 68 00 00 00 00 66 68 00 7c 00 00 66
61 68 00 00 07 cd 1a 5a 32 f6 ea 00 7c 00 00 cd
18 a0 b7 07 eb 08 a0 b6 07 eb 03 a0 b5 07 32 e4
05 00 07 8b f0 ac 3c 00 74 09 bb 07 00 b4 0e cd
10 eb f2 f4 eb fd 2b c9 e4 64 eb 00 24 02 e0 f8
24 02 c3 49 6e 76 61 6c 69 64 20 70 61 72 74 69
74 69 6f 6e 20 74 61 62 6c 65 00 45 72 72 6f 72
20 6c 6f 61 64 69 6e 67 20 6f 70 65 72 61 74 69
6e 67 20 73 79 73 74 65 6d 00 4d 69 73 73 69 6e
67 20 6f 70 65 72 61 74 69 6e 67 20 73 79 73 74
65 6d 00 00 00 63 7b 9a 09 dc 4f 48 00 00 00 20
21 00 07 fe ff ff 00 08 00 00 00 00 35 0c 00 fe
ff ff 0c fe ff ff 00 08 35 0c 00 30 c4 01 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 55 aa

Master Boot Record
  Partition: 0 first Sector: 2048 total Sectors: 204800000
  Partition: 1 first Sector: 204802048 total Sectors: 29634560
  Partition: 2 first Sector: 0 total Sectors: 0
  Partition: 3 first Sector: 0 total Sectors: 0

First partition Sector
1
Disk read Result: FR_OK
eb 76 90 45 58 46 41 54 20 20 20 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 08 00 00 00 00 00 00 00 00 35 0c 00 00 00 00
00 08 00 00 00 19 00 00 00 28 00 00 d8 34 0c 00
04 00 00 00 e1 88 df 18 00 01 00 00 09 08 01 80
02 00 00 00 00 00 00 00 33 c9 8e d1 8e c1 8e d9
bc d0 7b bd 00 7c 88 16 6f 7c b4 41 bb aa 55 cd
13 72 69 81 fb 55 aa 75 63 f6 c1 01 74 5e fe 06
02 7c 66 50 b0 65 e8 a6 00 66 58 66 b8 01 00 00
00 8a 0e 6d 7c 66 d3 e0 66 89 46 e8 66 b8 01 00
00 00 8a 0e 6c 7c 66 d3 e0 66 89 46 d8 66 a1 40
7c 66 40 bb 00 7e b9 01 00 66 50 e8 41 00 66 58
66 40 bb 00 80 b9 01 00 e8 34 00 66 50 b0 78 e8
5d 00 66 58 e9 09 01 a0 fc 7d eb 05 a0 fb 7d eb
00 b4 7d 8b f0 ac 98 40 74 0c 48 74 0e b4 0e bb
07 00 cd 10 eb ef a0 fd 7d eb e6 cd 16 cd 19 66
60 66 6a 00 66 50 06 53 66 68 10 00 01 00 b4 42
b2 80 8a 16 6f 7c 8b f4 cd 13 66 58 66 58 66 58
66 58 66 61 72 b1 03 5e d8 66 40 49 75 d1 c3 66
60 b4 0e bb 07 00 b9 01 00 cd 10 66 61 c3 42 00
4f 00 4f 00 54 00 4d 00 47 00 52 00 0d 0a 52 65
6d 6f 76 65 20 64 69 73 6b 73 20 6f 72 20 6f 74
68 65 72 20 6d 65 64 69 61 2e ff 0d 0a 44 69 73
6b 20 65 72 72 6f 72 ff 0d 0a 50 72 65 73 73 20
61 6e 79 20 6b 65 79 20 74 6f 20 72 65 73 74 61
72 74 0d 0a 00 00 00 00 00 00 00 00 00 00 ff ff
ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
ff ff ff ff ff ff ff ff ff ff ff 6c 8b 98 55 aa
EXFAT
bytes per sector :512
sectors per cluster :256

Second partition Sector
Disk read Result: FR_OK
eb 58 90 4d 53 44 4f 53 35 2e 30 00 02 10 12 0f
02 00 00 00 00 f8 00 00 3f 00 ff 00 00 08 35 0c
00 30 c4 01 77 38 00 00 00 00 00 00 02 00 00 00
01 00 06 00 00 00 00 00 00 00 00 00 00 00 00 00
80 00 29 ba ea 91 1e 4e 4f 20 4e 41 4d 45 20 20
20 20 46 41 54 33 32 20 20 20 33 c9 8e d1 bc f4
7b 8e c1 8e d9 bd 00 7c 88 56 40 88 4e 02 8a 56
40 b4 41 bb aa 55 cd 13 72 10 81 fb 55 aa 75 0a
f6 c1 01 74 05 fe 46 02 eb 2d 8a 56 40 b4 08 cd
13 73 05 b9 ff ff 8a f1 66 0f b6 c6 40 66 0f b6
d1 80 e2 3f f7 e2 86 cd c0 ed 06 41 66 0f b7 c9
66 f7 e1 66 89 46 f8 83 7e 16 00 75 39 83 7e 2a
00 77 33 66 8b 46 1c 66 83 c0 0c bb 00 80 b9 01
00 e8 2c 00 e9 a8 03 a1 f8 7d 80 c4 7c 8b f0 ac
84 c0 74 17 3c ff 74 09 b4 0e bb 07 00 cd 10 eb
ee a1 fa 7d eb e4 a1 7d 80 eb df 98 cd 16 cd 19
66 60 80 7e 02 00 0f 84 20 00 66 6a 00 66 50 06
53 66 68 10 00 01 00 b4 42 8a 56 40 8b f4 cd 13
66 58 66 58 66 58 66 58 eb 33 66 3b 46 f8 72 03
f9 eb 2a 66 33 d2 66 0f b7 4e 18 66 f7 f1 fe c2
8a ca 66 8b d0 66 c1 ea 10 f7 76 1a 86 d6 8a 56
40 8a e8 c0 e4 06 0a cc b8 01 02 cd 13 66 61 0f
82 74 ff 81 c3 00 02 66 40 49 75 94 c3 42 4f 4f
54 4d 47 52 20 20 20 20 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 0d 0a 44 69
73 6b 20 65 72 72 6f 72 ff 0d 0a 50 72 65 73 73
20 61 6e 79 20 6b 65 79 20 74 6f 20 72 65 73 74
61 72 74 0d 0a 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 ac 01 b9 01 00 00 55 aa
FAT32
bytes per sector :512
sectors per cluster :16
Not sure about the first sector read for the second partition though - what is the count variable? Any way here is the modified sketch:
Code:
#include "uSDFS.h"
#include "diskio.h"

#include <USBHost_t36.h>
extern USBHost myusb;
USBHub hub1(myusb);
USBHub hub2(myusb);

/*
* for APL see http://elm-chan.org/fsw/ff/00index_e.html
*/
#define TEST_DRV 2
//
#if TEST_DRV == 0
  const char *Dev = "0:/";  // SPI
#elif TEST_DRV == 1
  const char *Dev = "1:/";  // SDHC
#elif TEST_DRV == 2
  const char *Dev = "2:/";  // USB
#endif

struct partitionTable {
  uint8_t  boot;
  uint8_t  beginHead;
  unsigned beginSector : 6;
  unsigned beginCylinderHigh : 2;
  uint8_t  beginCylinderLow;
  uint8_t  type;
  uint8_t  endHead;
  unsigned endSector : 6;
  unsigned endCylinderHigh : 2;
  uint8_t  endCylinderLow;
  uint32_t firstSector;
  uint32_t totalSectors;
} __attribute__((packed));
typedef struct partitionTable part_t;

struct masterBootRecord {
  uint8_t  codeArea[440];
  uint32_t diskSignature;
  uint16_t usuallyZero;
  part_t   part[4];
  uint8_t  mbrSig0;
  uint8_t  mbrSig1;
} __attribute__((packed));
typedef struct masterBootRecord mbr_t;


struct fat32_boot {
  uint8_t jump[3];
  char    oemId[8];
  uint16_t bytesPerSector;
  uint8_t  sectorsPerCluster;
  uint16_t reservedSectorCount;
  uint8_t  fatCount;
  uint16_t rootDirEntryCount;
  uint16_t totalSectors16;
  uint8_t  mediaType;
  uint16_t sectorsPerFat16;
  uint16_t sectorsPerTrack;
  uint16_t headCount;
  uint32_t hidddenSectors;
  uint32_t totalSectors32;
  uint32_t sectorsPerFat32;
  uint16_t fat32Flags;
  uint16_t fat32Version;
  uint32_t fat32RootCluster;
  uint16_t fat32FSInfo;
  uint16_t fat32BackBootBlock;
  uint8_t  fat32Reserved[12];
  uint8_t  driveNumber;
  uint8_t  reserved1;
  uint8_t  bootSignature;
  uint32_t volumeSerialNumber;
  char     volumeLabel[11];
  char     fileSystemType[8];
  uint8_t  bootCode[420];
  uint8_t  bootSectorSig0;
  uint8_t  bootSectorSig1;
}__attribute__((packed));
typedef struct fat32_boot fat32_boot_t;

typedef uint16_t  le16_t;
typedef uint32_t  le32_t;
typedef uint64_t  le64_t;

struct exfat_super_block
{
  uint8_t jump[3];        /* 0x00 jmp and nop instructions */
  uint8_t oem_name[8];      /* 0x03 "EXFAT   " */
  uint8_t __unused1[53];      /* 0x0B always 0 */
  le64_t sector_start;      /* 0x40 partition first sector */
  le64_t sector_count;      /* 0x48 partition sectors count */
  le32_t fat_sector_start;    /* 0x50 FAT first sector */
  le32_t fat_sector_count;    /* 0x54 FAT sectors count */
  le32_t cluster_sector_start;  /* 0x58 first cluster sector */
  le32_t cluster_count;     /* 0x5C total clusters count */
  le32_t rootdir_cluster;     /* 0x60 first cluster of the root dir */
  le32_t volume_serial;     /* 0x64 volume serial number */
  struct              /* 0x68 FS version */
  {
    uint8_t minor;
    uint8_t major;
  }
  version;
  le16_t volume_state;      /* 0x6A volume state flags */
  uint8_t sector_bits;      /* 0x6C sector size as (1 << n) */
  uint8_t spc_bits;       /* 0x6D sectors per cluster as (1 << n) */
  uint8_t fat_count;        /* 0x6E always 1 */
  uint8_t drive_no;       /* 0x6F always 0x80 */
  uint8_t allocated_percent;    /* 0x70 percentage of allocated space */
  uint8_t __unused2[397];     /* 0x71 always 0 */
  le16_t boot_signature;      /* the value of 0xAA55 */
} __attribute__((packed));
typedef struct exfat_super_block exfat_boot_t;


uint32_t buffer[128];

void setup() {
  // put your setup code here, to run once:

  while(!Serial);
  Serial.println("Test diskio");
  Serial.print("uSDFS_VER:"); Serial.println(uSDFS_VER);
  
  BYTE pdrv = TEST_DRV;
  
  DSTATUS stat = disk_initialize(TEST_DRV);
  Serial.print("Disk initialize Status: "); Serial.println(STAT_ERROR_STRING[stat]);

  BYTE* buff = (BYTE *) buffer;
  DWORD sector = 0;
  DWORD sector1 = 0;
  UINT count = 1;
  UINT count1 = 1;
  DRESULT res = disk_read (pdrv, buff, sector, count);
  Serial.print("Disk read Result: "); Serial.println(FR_ERROR_STRING[res]);
  for(int ii=0;ii<512; ii++)
  if((ii+1)%16) Serial.printf("%02x ",buff[ii]); else Serial.printf("%02x\n",buff[ii]);

  mbr_t *mbr = (mbr_t *) buffer;
  Serial.println("\nMaster Boot Record");
  for(int ii=0;ii<4;ii++)
  {
    Serial.print("  Partition: "); Serial.print(ii);
    Serial.print(" first Sector: ");
    Serial.print(mbr->part[ii].firstSector);
    Serial.print(" total Sectors: ");
    Serial.println(mbr->part[ii].totalSectors);
  }

  // read now first partition sector
  Serial.println("\nFirst partition Sector");
  sector = mbr->part[0].firstSector;
  sector1 = mbr->part[1].firstSector;
  count = 1;
  res = disk_read (pdrv, buff, sector, count);
  Serial.print("Disk read Result: "); Serial.println(FR_ERROR_STRING[res]);
  for(int ii=0;ii<512; ii++)
  if((ii+1)%16) Serial.printf("%02x ",buff[ii]); else Serial.printf("%02x\n",buff[ii]);

  fat32_boot_t * ptr1=(fat32_boot_t *) buffer;
  exfat_boot_t * ptr2=(exfat_boot_t *) buffer;

  if(strncmp(ptr1->fileSystemType,"FAT32",5)==0)
  {
    Serial.println("FAT32");
    Serial.print("bytes per sector :");Serial.println(ptr1->bytesPerSector);
    Serial.print("sectors per cluster :");Serial.println(ptr1->sectorsPerCluster);
  }
  else if(strncmp(ptr2->oem_name,"EXFAT",5)==0)
  {
    Serial.println("EXFAT");
    Serial.print("bytes per sector :");Serial.println(1<<ptr2->sector_bits);
    Serial.print("sectors per cluster :");Serial.println(1<<ptr2->spc_bits);
  }
  pinMode(13,OUTPUT);

  // read now Second partition sector
  Serial.println("\nSecond partition Sector");
  count = 1;
  res = disk_read (pdrv, buff, sector1, count);
  Serial.print("Disk read Result: "); Serial.println(FR_ERROR_STRING[res]);
  for(int ii=0;ii<512; ii++)
  if((ii+1)%16) Serial.printf("%02x ",buff[ii]); else Serial.printf("%02x\n",buff[ii]);

  if(strncmp(ptr1->fileSystemType,"FAT32",5)==0)
  {
    Serial.println("FAT32");
    Serial.print("bytes per sector :");Serial.println(ptr1->bytesPerSector);
    Serial.print("sectors per cluster :");Serial.println(ptr1->sectorsPerCluster);
  }
  else if(strncmp(ptr2->oem_name,"EXFAT",5)==0)
  {
    Serial.println("EXFAT");
    Serial.print("bytes per sector :");Serial.println(1<<ptr2->sector_bits);
    Serial.print("sectors per cluster :");Serial.println(1<<ptr2->spc_bits);
  }
}

void loop() {
  // put your main code here, to run repeatedly:
  digitalWriteFast(13,!digitalReadFast(13));
  delay(1000);
}
 
Last edited:
I thought I would try a hack (or maybe it is the expected thing...)...

But I started off the uSDFS_test program like:

Code:
#include "uSDFS.h"
/*
* for APL see http://elm-chan.org/fsw/ff/00index_e.html
*/
#define TEST_DRV 3
//
#if TEST_DRV == 0
  const char *Dev = "0:/";  // SPI
#elif TEST_DRV == 1
  const char *Dev = "1:/";  // SDHC
#elif TEST_DRV == 2
  const char *Dev = "2:/";  // USB
#elif TEST_DRV == 3
  const char *Dev = "3:/";  // USB 2nd partition
#endif
PARTITION VolToPart[] = {{0,0}, {1,0}, {2,0}, {2,1}};  /* Volume - Partition resolution table */

It runs like before if pass in 2:/

But with 3:?

The output is:
Code:
Test uSDFS
3:/
Mount: Failed with rc=FR_INVALID_DRIVE.

So again don't know if I am barking down wrong tree, or need to see if there are more places that should be:
using the macros:
#if FF_MULTI_PARTITION
#define LD2PD(vol) VolToPart[vol].pd /* Get physical drive number */
#define LD2PT(vol) VolToPart[vol].pt /* Get partition index */
...
 
@KurtE
Probably better to look at the defines - you might see something else associated with it as well. None of the other sketches will compile for me with FF_Multi turned on - just the Disk_io sketch seems to work. But is funny I haven't run into the same problem even with the Seagate drive which is the same as @defragster's except for the size.
 
Wondering if my external drive box likes 3.5" but not 2.5's?

just accidentally reformatted Bill's drive I had swapped in to test for repair - DOH ! And then put it on Teensy and it doesn't like it either: Mount: Failed with rc=FR_DISK_ERR.

But @mjs513's Part print worked - to show the blank 2nd disk partition it has.

I ordered a 2.5" to try to restore Bill's i7 Toshiba and followed their 'Suggested' link to that 256 MB cache 2TB drive - I got it and of course it is 3.5" … opps - so have to return that. The new 1TB PRO Seagate 7200 RPM 2.5" should be here shortly …

I have other drive adapters around that may work - just have to uncover them.
 
defragster said:
But @mjs513's Part print worked - to show the blank 2nd disk partition it has.
Yeah the sketch was set up to print the partitions but it is only set up to read the first sector of the first partition along with the type of format of sizes of blocks. The code I posted I added the print for a second partition.
 
Actually I think I got it to work with the uSDFS_test to write to 2nd partition...

Code:
#include "uSDFS.h"
/*
* for APL see http://elm-chan.org/fsw/ff/00index_e.html
*/
#define TEST_DRV 3
//
#if TEST_DRV == 0
  const char *Dev = "0:/";  // SPI
#elif TEST_DRV == 1
  const char *Dev = "1:/";  // SDHC
#elif TEST_DRV == 2
  const char *Dev = "2:/";  // USB
#elif TEST_DRV == 3
  const char *Dev = "3:/";  // USB 2nd partition
#endif
PARTITION VolToPart[] = {{0,0}, {1,0}, {2,0}, {2,2}};  /* Volume - Partition resolution table */

const char *FileNameTxt = "/Ascii/HELLO13.TXT";
const char *FileNameBin = "/Binary/test03.bin";

FRESULT rc;       /* Result code */
FATFS fatfs;      /* File system object */
FIL fil;          /* File object */
DIR dir;          /* Directory object */
FILINFO fno;      /* File information object */
UINT bw, br, wr;

TCHAR buff[128];
TCHAR *str;
#define BUFFSIZE (16*128) 
uint8_t buffer[BUFFSIZE];

void die(const char *text, FRESULT rc)
{ Serial.printf("%s: Failed with rc=%s.\r\n", text,FR_ERROR_STRING[rc]);  while(1) asm("wfi"); }

void setup() {
  // put your setup code here, to run once:
  while(!Serial);
  Serial.println("Test uSDFS");
  Serial.println(Dev);
  if((rc = f_mount (&fatfs, Dev, 1))) die("Mount",rc);      /* Mount/Unmount a logical drive */

  //-----------------------------------------------------------
  Serial.printf("\nChange drive\n");
  if((rc = f_chdrive(Dev))) die("chdrive",rc);

  //-----------------------------------------------------------
  Serial.printf("\nCreate a new subdirectories.\n");
  if((rc = f_mkdir("/Ascii"))) if(rc != FR_EXIST) die("mkDir Ascii",rc);
  if((rc = f_mkdir("/Binary"))) if(rc != FR_EXIST) die("mkDir Binary",rc);

  //-----------------------------------------------------------
  Serial.printf("\nCreate a new file %s.\n",FileNameTxt);
  if((rc = f_open(&fil, FileNameTxt, FA_WRITE | FA_CREATE_ALWAYS))) die("Open",rc);

  Serial.println("Write some text lines. (Hello world!)");
  bw = f_puts("Hello world!\n", &fil);
  bw = f_puts("Second Line\n", &fil);
  bw = f_puts("Third Line\n", &fil);
  bw = f_puts("Fourth Line\n", &fil);
  bw = f_puts("Habe keine Phantasie\n", &fil);
  
  Serial.println("Close the file.");
  if((rc = f_close(&fil))) die("Close",rc);

  Serial.printf("\nOpen same file %s.\n",FileNameTxt);
  if((rc = f_open(&fil, FileNameTxt, FA_READ))) die("Open",rc);

  Serial.println("Get the file content.");
  for (;;) 
  {
      if((str=f_gets(buff, sizeof(buff), &fil))) 
        Serial.printf("%s",str);
      else 
      { if(f_eof(&fil)) break; else die("f_gets",FR_DISK_ERR);} 
  }

  Serial.println("Close the file.");
  if((rc = f_close(&fil))) die("Close",rc);
  
  //-----------------------------------------------------------
  Serial.println("\nopen binary file");
      // open new file
      if((rc = f_open(&fil, FileNameBin, FA_WRITE | FA_CREATE_ALWAYS))) die("Open",rc);
  Serial.println("write file");
       
       // fill buffer
       for(int ii=0;ii<BUFFSIZE;ii++) buffer[ii]='0';
       //write data to file 
       if((rc = f_write(&fil, buffer, BUFFSIZE, &wr))) die("Write1",rc);  
       
       // fill buffer
       for(int ii=0;ii<BUFFSIZE;ii++) buffer[ii]='1';
       //write data to file 
       if((rc = f_write(&fil, buffer, BUFFSIZE, &wr))) die("Write2",rc);  
       
      //close file
  Serial.println("close file");
      if((rc = f_close(&fil))) die("Close",rc);
  Serial.println("Binary test done");

  //-----------------------------------------------------------
  Serial.println("\nOpen root directory.");
  if((rc = f_opendir(&dir, Dev))) die("Dir",rc);

  Serial.println("Directory listing...");
  for (;;) 
  {
      if((rc = f_readdir(&dir, &fno))) die("Listing",rc);   /* Read a directory item */
      if (!fno.fname[0]) break; /* Error or end of dir */
      if (fno.fattrib & AM_DIR)
           Serial.printf("   <dir>  %s\r\n", fno.fname);
      else
           Serial.printf("%8d  %s\r\n", (int)fno.fsize, fno.fname);
    delay(10);
  }

  Serial.println("\nTest completed.");

  if((rc = f_mount (&fatfs, Dev, 1))) die("Mount",rc);      /* Mount/Unmount a logical drive */

  pinMode(13,OUTPUT);
}

void loop() {
  // put your main code here, to run repeatedly:
  digitalWriteFast(13,!digitalReadFast(13));
  delay(1000);
}

Key things changed here include:
Code:
PARTITION VolToPart[] = {{0,0}, {1,0}, {2,0}, {2,2}};  /* Volume - Partition resolution table */

Note: The 2,0 should probably be 2,1 ... I think 0 means the current one... which is mostly fine.

Also in this case in the uSDFS project, I changed src\ffconf.h

from: #define FF_VOLUMES 3
to: #define FF_VOLUMES 4

But of course could live within the 3 and change table where maybe 1->2,2...
 
@KurtE
Good timing - stopped with FD for awhile. Ok just loaded it up and tested it on the SSD and verified on the PC and as you said it works. It wrote the two directories and files in the directories. Yes I did open up the txt file on the second volume ASCII directory. Only thing is that its not clear to me how it works, i.e.,
Code:
PARTITION VolToPart[] = {{0,0}, {1,0}, {2,0}, {2,2}};  /* Volume - Partition resolution table */
what are the values in parens?

I saw that you created a new test_drv:
Code:
#elif TEST_DRV == 3
  const char *Dev = "3:/";  // USB 2nd partition
to use the second partition - is this all buried in the uSDFS library?

Kind of dense today.
 
Yeah the sketch was set up to print the partitions but it is only set up to read the first sector of the first partition along with the type of format of sizes of blocks. The code I posted I added the print for a second partition.

Understood as doing that - handy.

Made a quick search - found an empty box for one old USB<>[IDE | SATA] … not sure where that is … and another NIB 'Apricorn EzBus' USB to IDE drive box like the one I have beside me that I said I didn't know the drive in it … must be IDE too. So if I grab a never to be used again IDE drive I can put it in this NEW adapter and use it for Teensy Test

Found another empty IDE box I'm ignoring.

Found a 160GB IDE drive and put it into the Ez box - and it is working for logger test.

DOH !!!!! I restored from library from ZIP … had to set from 0 to :: #define TEST_DRV 2 // 0: SPI; 1: SDIO; 2: USBHost

The other 500 GB new Seagate still not working though …. in the combo 2.5 and 3.5 external box ...
 
@defragster - forgot to changed the settings a few times myself :). As for the Seagate has to be the box that you are using, I have the same drive as you as its working ???

@KurtE - guess what I am saying is that at some point in time maybe it would be better for the user just to specify to mount partition in a command, maybe modify the f_mount?
 
@KurtE - guess what I am saying is that at some point in time maybe it would be better for the user just to specify to mount partition in a command, maybe modify the f_mount?

Yep - Took me awhile to try to figure out what all was going on:
Back in posting I think #207, I mentioned that the structure is used:
Code:
#if FF_MULTI_PARTITION
#define LD2PD(vol) VolToPart[vol].pd	/* Get physical drive number */
#define LD2PT(vol) VolToPart[vol].pt	/* Get partition index */
#else
#define LD2PD(vol) (BYTE)(vol)	/* Each logical drive is bound to the same physical drive number */
#define LD2PT(vol) 0			/* Find first valid partition or in SFD */
#endif

in ff.h you see:
Code:
#if FF_MULTI_PARTITION		/* Multiple partition configuration */
typedef struct {
	BYTE pd;	/* Physical drive number */
	BYTE pt;	/* Partition: 0:Auto detect, 1-4:Forced partition) */
} PARTITION;
extern PARTITION VolToPart[];	/* Volume - Partition resolution table */
#endif
So the number you pass in: "3:/"
3 is the logical drive number

Which is used as an index into the table that you define. The first number in the groups is the actual physical drive number (0-SPI, 1-SD, 2-USB) and the second value is the partition index.

Was not sure if the partition index was 0 based or 1 based... So first attept had the second one as {2,1} and it wrote to the same place as the drive 2... {2,0}, and then worked when I switched to {2,2}

As for best way to allow this??? I will leave that to owners of the libraries.

I believe the code already has at least three different ways to define these strings. That probably has to be configured if desired...
Things like by Strings: SD: or USB: ...

And some linux sort of version?
 
I just found a box of (4) 2.5" drives - three upgrade swapped from prior laptops - and two SSD drives one in another Orico box - an OCZ that finally came up - last used 10/2015 and a bare Plextor ...

I think my computer is getting TIRED from seeing new and the same drives and watching them change … I KNOW I AM :)

Found another empty IDE&SATA 2.5" CardBoard box … so at least two more SATA USB adapters I didn't find yet - and I know there is another IDE adapter and an Apricorn unpowered 2.5" SATA adapter somewhere

That 160GB IDE with 8K*4 buffer transfers at 5.4 MB/sec and bumping to 24K*4 is showing 9.2 MB/sec. - must be 7 yrs or more old - it hits 9.6 MB/s with 30K bufsize.

Unpowered drives - even 2.5" OCZ SSD won't work - the OCZ was flashing red. And even working drives won't work through powered hub … without these lines!

Adding these lines to the logger_x_FS sketch makes the external working drive work through a HUB:
Code:
#include <USBHost_t36.h>
extern USBHost myusb;
USBHub hub1(myusb);
USBHub hub2(myusb);


Then putting the unpowered SSD I get it to fail the mount again after fresh Windows ExFAT formatting { in Orico or w/KingWin } :: Mount: Failed with rc=FR_NO_FILESYSTEM.

These are all exFAT formatted that are failing - the GUI only offer NTFS or exFAT … the one 2.5" HDD 160 I brought up I'm CMDLINE FORMATING " :: format h: /FS:FAT32 /V:eeePC160 /x
… opps I forgot /q …
Restarting with 'format h: /FS:FAT32 /V:eeePC160 /x /q' it then says at 149.0 GB "The volume is too big for FAT32."
So redone with : format h: /FS:exFAT /V:eeePC160 /x /q

That it now likes on the 160GB May_2009 Hitachi HDD from the KingWin {9.5 MB/s at 30K} and Orico {9.7 MB/s at 30K} through HUB.

Those SSD's were EARLY - both the same OCZ 'refurb'- so maybe they 'talk funny' … or get trashed if they try.

The 120GB Plextor SSD is working exFAT at 9.48-9.51 MB/sec now on KingWin through Amazon Hub - formatted through Win 10 GUI. Drive label says "5V @ 1 AMP" - so it needs to be powered from box or HUB.

FINALLY - 2.5" Hitachi also works in my external AZIO 2.5/3.5 drive holder! Coming in at 9.7 MB/sec like the Orico box.

CMDLIME format of the NEW SeagateBarricude 500GB still fails in all three USB adapters with :: Mount: Failed with rc=FR_NO_FILESYSTEM.
CMDLINE:> DISKPART and cmd "LIST DISK" shows it as " Disk 7 Online 465 GB 0 B *" - where '*' is in GPT column
> Used EASEUS to convert GPT to MBR drive.


Seagate 500GB converted to use MBR not GPT and it is now working! Only 9.7 MB/sec with BUFFSIZE 30KB

That answers that question - the disks must currently be MBR type not GPT [ MBR (Master Boot Record) .vs. GPT (GUID Partition Table) ] - and Windows by default on this size drive does GPT it seems.
 
defragster said:
Seagate 500GB converted to use MBR not GPT and it is now working! Only 9.7 MB/sec with BUFFSIZE 30KB

That answers that question - the disks must currently be MBR type not GPT [ MBR (Master Boot Record) .vs. GPT (GUID Partition Table) ] - and Windows by default on this size drive does GPT it seems.
Damn - should have mentioned that one - when I did the formatting for exFAT the warning was to use MBR to make it compatible with everything - basically don't use GPR. So all my partitions are MBR formatted.
 
Back
Top