Teensyduino File System Integration, including MTP and MSC

Deeper test case: beware intense USB spew

Here's an updated MakeFiles.ino with latest "Mine" folder, for use after the simple case is working.

Code:
[ATTACH]26940._xfImport[/ATTACH]

It holds 3 the three '1,2,3' folders each with 1024 files named as sized with 1 byte increment from 400 bytes to 1423 bytes.
Code:
...
 Directory of G:\mine\333
[.]        [..]       400.txt    401.txt    402.txt    403.txt    404.txt    405.txt    406.txt    407.txt
...
1418.txt   1419.txt   1420.txt   1421.txt   1422.txt   1423.txt
            1024 File(s)        933,376 bytes

     Total Files Listed:
            3072 File(s)      2,800,128 bytes

Those created with : MakeDataFiles( szStart[1], 1024, 400, 1 ); // folder name, # files, start size, inc in bytes to next file
Code:
  char szStart[][8] = { "", "Mine" };
  MakeData( szStart[0] );
  MakeDataFiles( szStart[1], 1024, 400, 1 );
  //MakeMore( );

MakeData() does the original three files ( now 244,500,756 in size )
Commented MakeMore() re-uses those first three '1,2,3' dirs and goes a level deeper repeating in each with alternate files as set in MakeMore();

Next edit if desired/needed would be deeper dirs ( with fewer files ) ???
 
KurtE said:
Note: I updated the code to send the last actual packet as actual size instead of bytes left...
When I tried sending with full size, all 9 files went through but were corrupted. Not sure why other times downloading works with the extra padding, but not this one...

Still investigating... Almost like when it is doing the bulk receive and it gets an packet < full size it does not reset it...
Sorry got distracted. But yes. They are corrupted in an interesting way though as I found out last night when I was initially testing the issue. Since we are sending a full size packet but only a partial packet is need its using what in the buffer from the previous transfer so the tx buffer as explained in this post: https://forum.pjrc.com/threads/6813...ng-MTP-and-MSC?p=295726&viewfull=1#post295726

Note when you send a file of 512 bytes, the actual stream is 524 bytes long as the file data is preceded by a 12 byte header.

That is why my Bogus test code was setup that the first record was reduced by 12 bytes, such that each received 512 byte buffer would start off with a sequence number.

Now back to investigating..

Again wondering if anything interesting shows up in USB data... Can try wireshark or would be interesting to see if USB scope shows something like some packets or information we are not processing.
Actually I did look at wireshark data but hard to tell exactly what is going on. There was a couple of things that I did see associated with actual transfer of file data:
1. Seeing blocks of 295bytes and 539 bytes being transferred with actual file data - odd number of bytes seem to command or header or both?
Capture.PNGCapture1.PNG

2. Then after it gets stuck this seems to be repeating, looks like it keeps checking for the device:
Capture2.PNG
3. and then this goes on for awhile and finally I see the stall condition
Capture4.PNG

Remember you asked.

EDIT: Just transferred 1 file from Tims SD_SRC direct 333 - bbb.txt. lost MTP in explorer but sketch still running
 
Last edited:
Follow on from Simple failures...

I updated the code that completely hangs to only iterate 5 times and then return failure...

Code:
LP:68187 CMD: 1009(GET_OBJECT)l: 16 T:10b : 21

GetObject(33) size: 256

GetObject(33) size: 256
  >>r p:0 l:256
    >>>>w len:268
    >><< Done
68189 RESP:2001(RSP:OK)l: 16 T:10b : 21
LP:68206 CMD: 1009(GET_OBJECT)l: 16 T:10c : 22

GetObject(34) size: 512

GetObject(34) size: 512
  >>r p:0 l:512
    >>w dp:500 p:500 len:512
    >>>>w len:12
    >><< Done
68206 RESP:2001(RSP:OK)l: 16 T:10c : 22
LP:68210 CMD: 1009(GET_OBJECT)l: 16 T:10d : 22

GetObject(34) size: 512

GetObject(34) size: 512
  >>r p:0 l:512
    >>w dp:500 p:500 len:512
    >>>>w len:12
    >><< Done
68217 RESP:2001(RSP:OK)l: 16 T:10d : 22
LP:68227 CMD: 1009(GET_OBJECT)l: 16 T:10e : 23

GetObject(35) size: 768

GetObject(35) size: 768
  >>r p:0 l:768
    >>w dp:500 p:500 len:512
    >>>>w len:268
    >><< Done
68238 RESP:2001(RSP:OK)l: 16 T:10e : 23

$$$usb_mtp_send timeout head:1 status:00100080
push_packet: l:16 ret:0 loop:0
LP:68329 CMD: 1009(GET_OBJECT)l: 16 T:10f : 23

GetObject(35) size: 768

GetObject(35) size: 768
  >>r p:0 l:768
    >>w dp:500 p:500 len:512
    >>>>w len:268
    >><< Done
68338 RESP:2001(RSP:OK)l: 16 T:10f : 23
LP:68345 CMD: 1009(GET_OBJECT)l: 16 T:110 : 24

GetObject(36) size: 256

GetObject(36) size: 256
  >>r p:0 l:256
    >>>>w len:268
    >><< Done
68348 RESP:2001(RSP:OK)l: 16 T:110 : 24
LP:68355 CMD: 1009(GET_OBJECT)l: 16 T:111 : 24

GetObject(36) size: 256

GetObject(36) size: 256
  >>r p:0 l:256
    >>>>w len:268
    >><< Done
68367 RESP:2001(RSP:OK)l: 16 T:111 : 24
LP:68373 CMD: 1009(GET_OBJECT)l: 16 T:112 : 25

GetObject(37) size: 512

GetObject(37) size: 512
  >>r p:0 l:512
    >>w dp:500 p:500 len:512
    >>>>w len:12

$$$usb_mtp_send timeout head:1 status:010C0080
push_packet: l:12 ret:0 loop:0

$$$usb_mtp_send timeout head:1 status:010C0080
push_packet: l:12 ret:0 loop:1

$$$usb_mtp_send timeout head:1 status:010C0080
push_packet: l:12 ret:0 loop:2

$$$usb_mtp_send timeout head:1 status:010C0080
push_packet: l:12 ret:0 loop:3

$$$usb_mtp_send timeout head:1 status:010C0080
push_packet: l:12 ret:0 loop:4
    >><< Done

$$$usb_mtp_send timeout head:1 status:010C0080
push_packet: l:12 ret:0 loop:0

$$$usb_mtp_send timeout head:1 status:010C0080
push_packet: l:12 ret:0 loop:1

$$$usb_mtp_send timeout head:1 status:010C0080
push_packet: l:12 ret:0 loop:2

$$$usb_mtp_send timeout head:1 status:010C0080
push_packet: l:12 ret:0 loop:3

$$$usb_mtp_send timeout head:1 status:010C0080
push_packet: l:12 ret:0 loop:4
69042 RESP:2001(RSP:OK)l: 16 T:112 : 25

$$$usb_mtp_send timeout head:1 status:010C0080
push_packet: l:16 ret:0 loop:0

$$$usb_mtp_send timeout head:1 status:010C0080
push_packet: l:16 ret:0 loop:1

$$$usb_mtp_send timeout head:1 status:010C0080
push_packet: l:16 ret:0 loop:2

$$$usb_mtp_send timeout head:1 status:010C0080
push_packet: l:16 ret:0 loop:3

$$$usb_mtp_send timeout head:1 status:010C0080
push_packet: l:16 ret:0 loop:4
LP:69347 CMD: 1009(GET_OBJECT)l: 16 T:113 : 25

GetObject(37) size: 512

GetObject(37) size: 512
  >>r p:0 l:512
    >>w dp:500 p:500 len:512
    >>>>w len:12
    >><< Done

$$$usb_mtp_send timeout head:3 status:00100080
push_packet: l:12 ret:0 loop:0

$$$usb_mtp_send timeout head:3 status:00100080
push_packet: l:12 ret:0 loop:1

$$$usb_mtp_send timeout head:3 status:00100080
push_packet: l:12 ret:0 loop:2

$$$usb_mtp_send timeout head:3 status:00100080
push_packet: l:12 ret:0 loop:3

$$$usb_mtp_send timeout head:3 status:00100080
push_packet: l:12 ret:0 loop:4
69664 RESP:2001(RSP:OK)l: 16 T:113 : 25

$$$usb_mtp_send timeout head:3 status:00100080
push_packet: l:16 ret:0 loop:0

$$$usb_mtp_send timeout head:3 status:00100080
push_packet: l:16 ret:0 loop:1

$$$usb_mtp_send timeout head:3 status:00100080
push_packet: l:16 ret:0 loop:2

$$$usb_mtp_send timeout head:3 status:00100080
push_packet: l:16 ret:0 loop:3

$$$usb_mtp_send timeout head:3 status:00100080
push_packet: l:16 ret:0 loop:4
LP:69969 CMD: 1009(GET_OBJECT)l: 16 T:114 : 26

GetObject(38) size: 768

GetObject(38) size: 768
  >>r p:0 l:768
    >>w dp:500 p:500 len:512
    >>>>w len:268

$$$usb_mtp_send timeout head:0 status:02000080
push_packet: l:268 ret:0 loop:0

$$$usb_mtp_send timeout head:0 status:02000080
push_packet: l:268 ret:0 loop:1

$$$usb_mtp_send timeout head:0 status:02000080
push_packet: l:268 ret:0 loop:2

$$$usb_mtp_send timeout head:0 status:02000080
push_packet: l:268 ret:0 loop:3

$$$usb_mtp_send timeout head:0 status:02000080
push_packet: l:268 ret:0 loop:4
    >><< Done

$$$usb_mtp_send timeout head:0 status:02000080
push_packet: l:268 ret:0 loop:0

$$$usb_mtp_send timeout head:0 status:02000080
push_packet: l:268 ret:0 loop:1

$$$usb_mtp_send timeout head:0 status:02000080
push_packet: l:268 ret:0 loop:2

$$$usb_mtp_send timeout head:0 status:02000080
push_packet: l:268 ret:0 loop:3

$$$usb_mtp_send timeout head:0 status:02000080
push_packet: l:268 ret:0 loop:4
70579 RESP:2001(RSP:OK)l: 16 T:114 : 26

$$$usb_mtp_send timeout head:0 status:02000080
push_packet: l:16 ret:0 loop:0

$$$usb_mtp_send timeout head:0 status:02000080
push_packet: l:16 ret:0 loop:1

$$$usb_mtp_send timeout head:0 status:02000080
push_packet: l:16 ret:0 loop:2

$$$usb_mtp_send timeout head:0 status:02000080
push_packet: l:16 ret:0 loop:3

$$$usb_mtp_send timeout head:0 status:02000080
push_packet: l:16 ret:0 loop:4
LP:70884 CMD: 1009(GET_OBJECT)l: 16 T:115 : 26

GetObject(38) size: 768

GetObject(38) size: 768
  >>r p:0 l:768
    >>w dp:500 p:500 len:512
    >>>>w len:268
    >><< Done
70892 RESP:2001(RSP:OK)l: 16 T:115 : 26
LP:70902 CMD: 1009(GET_OBJECT)l: 16 T:116 : 27

GetObject(39) size: 256

GetObject(39) size: 256
  >>r p:0 l:256
    >>>>w len:268
    >><< Done
70918 RESP:2001(RSP:OK)l: 16 T:116 : 27
LP:70919 CMD: 1009(GET_OBJECT)l: 16 T:117 : 27

GetObject(39) size: 256

GetObject(39) size: 256
  >>r p:0 l:256
    >>>>w len:268

$$$usb_mtp_send timeout head:3 status:00100080
push_packet: l:268 ret:0 loop:0

$$$usb_mtp_send timeout head:3 status:00100080
push_packet: l:268 ret:0 loop:1

$$$usb_mtp_send timeout head:3 status:00100080
push_packet: l:268 ret:0 loop:2

$$$usb_mtp_send timeout head:3 status:00100080
push_packet: l:268 ret:0 loop:3

$$$usb_mtp_send timeout head:3 status:00100080
push_packet: l:268 ret:0 loop:4
    >><< Done

$$$usb_mtp_send timeout head:3 status:00100080
push_packet: l:268 ret:0 loop:0

$$$usb_mtp_send timeout head:3 status:00100080
push_packet: l:268 ret:0 loop:1

$$$usb_mtp_send timeout head:3 status:00100080
push_packet: l:268 ret:0 loop:2

$$$usb_mtp_send timeout head:3 status:00100080
push_packet: l:268 ret:0 loop:3

$$$usb_mtp_send timeout head:3 status:00100080
push_packet: l:268 ret:0 loop:4
71529 RESP:2001(RSP:OK)l: 16 T:117 : 27

$$$usb_mtp_send timeout head:3 status:00100080
push_packet: l:16 ret:0 loop:0

$$$usb_mtp_send timeout head:3 status:00100080
push_packet: l:16 ret:0 loop:1

$$$usb_mtp_send timeout head:3 status:00100080
push_packet: l:16 ret:0 loop:2

$$$usb_mtp_send timeout head:3 status:00100080
push_packet: l:16 ret:0 loop:3

$$$usb_mtp_send timeout head:3 status:00100080
push_packet: l:16 ret:0 loop:4
LP:71834 CMD: 1009(GET_OBJECT)l: 16 T:118 : 28

GetObject(40) size: 512

GetObject(40) size: 512
  >>r p:0 l:512

$$$usb_mtp_send timeout head:3 status:00100080
push_packet: l:512 ret:0 loop:0

$$$usb_mtp_send timeout head:3 status:00100080
push_packet: l:512 ret:0 loop:1

$$$usb_mtp_send timeout head:3 status:00100080
push_packet: l:512 ret:0 loop:2

$$$usb_mtp_send timeout head:3 status:00100080
push_packet: l:512 ret:0 loop:3

$$$usb_mtp_send timeout head:3 status:00100080
push_packet: l:512 ret:0 loop:4
    >>w dp:500 p:500 len:512
    >>>>w len:12

$$$usb_mtp_send timeout head:3 status:00100080
push_packet: l:12 ret:0 loop:0

$$$usb_mtp_send timeout head:3 status:00100080
push_packet: l:12 ret:0 loop:1

$$$usb_mtp_send timeout head:3 status:00100080
push_packet: l:12 ret:0 loop:2

$$$usb_mtp_send timeout head:3 status:00100080
push_packet: l:12 ret:0 loop:3

$$$usb_mtp_send timeout head:3 status:00100080
push_packet: l:12 ret:0 loop:4
    >><< Done

$$$usb_mtp_send timeout head:3 status:00100080
push_packet: l:12 ret:0 loop:0

$$$usb_mtp_send timeout head:3 status:00100080
push_packet: l:12 ret:0 loop:1

$$$usb_mtp_send timeout head:3 status:00100080
push_packet: l:12 ret:0 loop:2

$$$usb_mtp_send timeout head:3 status:00100080
push_packet: l:12 ret:0 loop:3

$$$usb_mtp_send timeout head:3 status:00100080
push_packet: l:12 ret:0 loop:4
72749 RESP:2001(RSP:OK)l: 16 T:118 : 28

$$$usb_mtp_send timeout head:3 status:00100080
push_packet: l:16 ret:0 loop:0

$$$usb_mtp_send timeout head:3 status:00100080
push_packet: l:16 ret:0 loop:1

$$$usb_mtp_send timeout head:3 status:00100080
push_packet: l:16 ret:0 loop:2

$$$usb_mtp_send timeout head:3 status:00100080
push_packet: l:16 ret:0 loop:3

$$$usb_mtp_send timeout head:3 status:00100080
push_packet: l:16 ret:0 loop:4
LP:73054 CMD: 1009(GET_OBJECT)l: 16 T:119 : 28

GetObject(40) size: 512

GetObject(40) size: 512
  >>r p:0 l:512

$$$usb_mtp_send timeout head:3 status:00100080
push_packet: l:512 ret:0 loop:0

$$$usb_mtp_send timeout head:3 status:00100080
push_packet: l:512 ret:0 loop:1

$$$usb_mtp_send timeout head:3 status:00100080
push_packet: l:512 ret:0 loop:2

$$$usb_mtp_send timeout head:3 status:00100080
push_packet: l:512 ret:0 loop:3

$$$usb_mtp_send timeout head:3 status:00100080
push_packet: l:512 ret:0 loop:4
    >>w dp:500 p:500 len:512
    >>>>w len:12

$$$usb_mtp_send timeout head:3 status:00100080
push_packet: l:12 ret:0 loop:0

$$$usb_mtp_send timeout head:3 status:00100080
push_packet: l:12 ret:0 loop:1

$$$usb_mtp_send timeout head:3 status:00100080
push_packet: l:12 ret:0 loop:2

$$$usb_mtp_send timeout head:3 status:00100080
push_packet: l:12 ret:0 loop:3

$$$usb_mtp_send timeout head:3 status:00100080
push_packet: l:12 ret:0 loop:4
    >><< Done

$$$usb_mtp_send timeout head:3 status:00100080
push_packet: l:12 ret:0 loop:0

$$$usb_mtp_send timeout head:3 status:00100080
push_packet: l:12 ret:0 loop:1

$$$usb_mtp_send timeout head:3 status:00100080
push_packet: l:12 ret:0 loop:2

$$$usb_mtp_send timeout head:3 status:00100080
push_packet: l:12 ret:0 loop:3

$$$usb_mtp_send timeout head:3 status:00100080
push_packet: l:12 ret:0 loop:4
73969 RESP:2001(RSP:OK)l: 16 T:119 : 28

$$$usb_mtp_send timeout head:3 status:00100080
push_packet: l:16 ret:0 loop:0

$$$usb_mtp_send timeout head:3 status:00100080
push_packet: l:16 ret:0 loop:1

$$$usb_mtp_send timeout head:3 status:00100080
push_packet: l:16 ret:0 loop:2

$$$usb_mtp_send timeout head:3 status:00100080
push_packet: l:16 ret:0 loop:3

$$$usb_mtp_send timeout head:3 status:00100080
push_packet: l:16 ret:0 loop:4
LP:74274 CMD: 1009(GET_OBJECT)l: 16 T:11a : 29

GetObject(41) size: 768

GetObject(41) size: 768
  >>r p:0 l:768

$$$usb_mtp_send timeout head:3 status:00100080
push_packet: l:512 ret:0 loop:0

$$$usb_mtp_send timeout head:3 status:00100080
push_packet: l:512 ret:0 loop:1

$$$usb_mtp_send timeout head:3 status:00100080
push_packet: l:512 ret:0 loop:2

$$$usb_mtp_send timeout head:3 status:00100080
push_packet: l:512 ret:0 loop:3

$$$usb_mtp_send timeout head:3 status:00100080
push_packet: l:512 ret:0 loop:4
    >>w dp:500 p:500 len:512
    >>>>w len:268

$$$usb_mtp_send timeout head:3 status:00100080
push_packet: l:268 ret:0 loop:0

$$$usb_mtp_send timeout head:3 status:00100080
push_packet: l:268 ret:0 loop:1

$$$usb_mtp_send timeout head:3 status:00100080
push_packet: l:268 ret:0 loop:2

$$$usb_mtp_send timeout head:3 status:00100080
push_packet: l:268 ret:0 loop:3

$$$usb_mtp_send timeout head:3 status:00100080
push_packet: l:268 ret:0 loop:4
    >><< Done

$$$usb_mtp_send timeout head:3 status:00100080
push_packet: l:268 ret:0 loop:0

$$$usb_mtp_send timeout head:3 status:00100080
push_packet: l:268 ret:0 loop:1

$$$usb_mtp_send timeout head:3 status:00100080
push_packet: l:268 ret:0 loop:2

$$$usb_mtp_send timeout head:3 status:00100080
push_packet: l:268 ret:0 loop:3

$$$usb_mtp_send timeout head:3 status:00100080
push_packet: l:268 ret:0 loop:4
75189 RESP:2001(RSP:OK)l: 16 T:11a : 29

$$$usb_mtp_send timeout head:3 status:00100080
push_packet: l:16 ret:0 loop:0

$$$usb_mtp_send timeout head:3 status:00100080
push_packet: l:16 ret:0 loop:1

$$$usb_mtp_send timeout head:3 status:00100080
push_packet: l:16 ret:0 loop:2

$$$usb_mtp_send timeout head:3 status:00100080
push_packet: l:16 ret:0 loop:3

$$$usb_mtp_send timeout head:3 status:00100080
push_packet: l:16 ret:0 loop:4
 
KurtE said:
Follow on from Simple failures...

I updated the code that completely hangs to only iterate 5 times and then return failure...
Great- keeps from restarting and you can test other things
 
Note: I have not pushed any of these changes up yet.

I also tried memset remaining part of partial buffer to 0, no change
Memset 0, but write full size buffer, shows Null characters in list.

So again hard to know exactly what is going on here.

In particular why that tx buffer won't become unbusy...

Wondering if during this there are some RX available...
 
Note: I have not pushed any of these changes up yet.

I also tried memset remaining part of partial buffer to 0, no change
Memset 0, but write full size buffer, shows Null characters in list.

So again hard to know exactly what is going on here.

In particular why that tx buffer won't become unbusy...

Wondering if during this there are some RX available...

One thing I was looking at is if we need to disable the IRQ's during transfer but it might just as well be issues with RX available as well.
 
Will watch for updated WIP libs - so far just extending the "can it be broken" file creator.

In addition to the large # of files per DIR, I now have a creator of arbitrarily deep dirs with a few files in each.

Though not published yet as making 8 or 10 folders deep works to populate with files - but some oddity the first such subfolder "D0" not getting the files? Though it 'should be' - though that isn't critical - just seems like a bug ...
Code:
  char szStart[][8] = { "", "ManyF", "ManyD10", "ManyD8" };
  MakeDeepDirs( szStart[2], 10, 500, 512 );
  MakeDeepDirs( szStart[3], 8, 100, 500 );
Gives this for ManyD10:
Code:
 Directory of G:\ManyD10
[.]  [..] [D0]
   [B][COLOR="#FF0000"]            0 File(s)              0 bytes[/COLOR][/B]
 Directory of G:\ManyD10\D0
[.]        [..]       500.txt    1012.txt   1524.txt   2036.txt   [D1]
               4 File(s)          5,072 bytes
...
 Directory of G:\ManyD10\D0\D1\D2\D3\D4\D5\D6\D7\D8\D9
[.]        [..]       500.txt    1012.txt   1524.txt   2036.txt
               4 File(s)             16 bytes

But when the simple case gets fixed - there will be more controlled test cases to verify :) - not that you asked :cool:
 
Quick update with the download folders issue. So far it appears to be Windows specific... That is when I take the teensy over to Ubuntu machine it downloaded all three folders with three files each and I did not get any of the error messages about the transfer is busy... Also Meld program said that the folders compare to the source version of them...
 
Quick update with the download folders issue. So far it appears to be Windows specific...
...

Arrgh - well the same on Win 10 and Win 11 it seems, so not something new ... or fixed.

USB presents so much SPEW to debug - luckily Mike found the simpler fail in p#827
EDIT: Just transferred 1 file from Tims SD_SRC direct 333 - bbb.txt. lost MTP in explorer but sketch still running
... and that's just the sketch response - then there is wireshark data and Paul's external USB monitor ...

<edit>: Mike and I have been using CodeCompare ... I see meldmerge.org/ UI looks similar from the web image
 
Last edited:
Arrgh - well the same on Win 10 and Win 11 it seems, so not something new ... or fixed.

USB presents so much SPEW to debug - luckily Mike found the simpler fail in p#827

... and that's just the sketch response - then there is wireshark data and Paul's external USB monitor ...

<edit>: Mike and I have been using CodeCompare ... I see meldmerge.org/ UI looks similar from the web image

Note: I normally on PC use WinMerge or at times Sublime Merge... But on Ubuntu I used Meld (very occasionally)

As for Wireshark and listings... Some of the stuff is Greek to me...

@Paul (and others) - I can check in my debug output changes if that would help. Also not sure if you use Wireshark and can deduce anything...

But at least you can sort of wonder through the USB data by doing a search and get close to where the stuff is failing.

Code:
    >>>>w len:268
    >><< Done
127247 RESP:2001(RSP:OK)l: 16 T:ab : 1a
LP:127253 CMD: 1009(GET_OBJECT)l: 16 T:ac : 1b

GetObject(27) size: 512

GetObject(27) size: 512
  >>r p:0 l:512
    >>w dp:500 p:500 len:512
    >>>>w len:12

$$$usb_mtp_send timeout head:1 status:010C0080
push_packet: l:12 ret:0 loop:0

$$$usb_mtp_send timeout head:1 status:010C0080
push_packet: l:12 ret:0 loop:1

$$$usb_mtp_send timeout head:1 status:010C0080
push_packet: l:12 ret:0 loop:2

$$$usb_mtp_send timeout head:1 status:010C0080
push_packet: l:12 ret:0 loop:3

So I can search the text $$$ for the failure. And then see the messages to/from the MTP endpoint...
screenshot.jpg
The image shows where it found at least one of the $$$ messages where it timed out waiting for a transfer and the one with hand drawn arrow is where the last previous message to that end point (3)
(2) is the seremu...
 

Attachments

  • usb_download_multi_files.zip
    50.5 KB · Views: 27
Question: Any chance the Serial SPEW over USB has any impact on MTP operations?
- that wouldn't explain linux function - per se - but linux is unique host code that handles USB Serial 10-50% faster.

and alternates:
> seems maybe UART Serial has been used at times? But only partially?
> Could the SPEW route over USB_HOST Serial? ... to another USB_HOST doing Device Serial echo to PC
> Can MTP support DUAL_USB and use that separate code path/buffers?

Seems there were times in some case something USB failed until DEBUG was enabled?
Can All USB output be turned off for a test.

Not that the corrupted files are showing signs of debug spew content - just wondering if the messages are interfering with Windows handling.
 
Question: Any chance the Serial SPEW over USB has any impact on MTP operations?
- that wouldn't explain linux function - per se - but linux is unique host code that handles USB Serial 10-50% faster.
Anything is possible, however all of this debug spew in this case was added after we discovered we had this issue. So I doubt it...
 
Still trying to understand what is going on with getObject - uploading files to teensy...

Added another debug output... Wondering if chance maybe Host tries to cancel... So wonder if we get any data from host... So added:
Code:
void MTPD::GetObject(uint32_t object_id) {
  uint32_t size = storage_->GetSize(object_id);
  printf("\nGetObject(%u) size: %u\n", object_id, size);

  if (write_get_length_) {
    write_length_ += size;
  } else {
    uint32_t pos = 0; // into data
    uint32_t len = sizeof(MTPHeader);

    disk_pos = DISK_BUFFER_SIZE;
    while (pos < size) {
      // experiment to see if any data pending from host...
      if (usb_mtp_available()) {
        printf("  << usb_mtp_available >>\n");
      }
...
Test and print if we there is data ready to receive...
Code:
LP:43608 CMD: 1009(GET_OBJECT)l: 16 T:a5 : 17

GetObject(23) size: 256

GetObject(23) size: 256
  >>r p:0 l:256
    >>>>w len:268
    >><< Done
43609 RESP:2001(RSP:OK)l: 16 T:a5 : 17
LP:43630 CMD: 1009(GET_OBJECT)l: 16 T:a6 : 18

GetObject(24) size: 512

GetObject(24) size: 512
  >>r p:0 l:512
    >>w dp:500 p:500 len:512
    >>>>w len:12
    >><< Done
43631 RESP:2001(RSP:OK)l: 16 T:a6 : 18
LP:43632 CMD: 1009(GET_OBJECT)l: 16 T:a7 : 18

GetObject(24) size: 512

GetObject(24) size: 512
  >>r p:0 l:512
    >>w dp:500 p:500 len:512
    >>>>w len:12
    >><< Done
43639 RESP:2001(RSP:OK)l: 16 T:a7 : 18
LP:43647 CMD: 1009(GET_OBJECT)l: 16 T:a8 : 19

GetObject(25) size: 768

GetObject(25) size: 768
  >>r p:0 l:768
    >>w dp:500 p:500 len:512
  << usb_mtp_available >>
    >>>>w len:268
    >><< Done
43655 RESP:2001(RSP:OK)l: 16 T:a8 : 19

$$$usb_mtp_send timeout head:1 status:00100080
push_packet: l:16 ret:0 loop:0

$$$usb_mtp_send timeout head:1 status:00100080
push_packet: l:16 ret:0 loop:1
LP:43788 CMD: 1009(GET_OBJECT)l: 16 T:a9 : 19

GetObject(25) size: 768

GetObject(25) size: 768
  << usb_mtp_available >>
  >>r p:0 l:768
    >>w dp:500 p:500 len:512
  << usb_mtp_available >>
    >>>>w len:268
    >><< Done
43797 RESP:2001(RSP:OK)l: 16 T:a9 : 19
LP:43808 CMD: 1009(GET_OBJECT)l: 16 T:aa : 1a

GetObject(26) size: 256

GetObject(26) size: 256
  << usb_mtp_available >>
  >>r p:0 l:256
    >>>>w len:268
    >><< Done
43810 RESP:2001(RSP:OK)l: 16 T:aa : 1a
LP:43817 CMD: 1009(GET_OBJECT)l: 16 T:ab : 1a

GetObject(26) size: 256

GetObject(26) size: 256
  << usb_mtp_available >>
  >>r p:0 l:256
    >>>>w len:268
    >><< Done
43828 RESP:2001(RSP:OK)l: 16 T:ab : 1a
LP:43834 CMD: 1009(GET_OBJECT)l: 16 T:ac : 1b

GetObject(27) size: 512

GetObject(27) size: 512
  << usb_mtp_available >>
  >>r p:0 l:512
    >>w dp:500 p:500 len:512
  << usb_mtp_available >>
    >>>>w len:12

$$$usb_mtp_send timeout head:1 status:010C0080
push_packet: l:12 ret:0 loop:0

$$$usb_mtp_send timeout head:1 status:010C0080
push_packet: l:12 ret:0 loop:1

$$$usb_mtp_send timeout head:1 status:010C0080
push_packet: l:12 ret:0 loop:2

$$$usb_mtp_send timeout head:1 status:010C0080
push_packet: l:12 ret:0 loop:3

$$$usb_mtp_send timeout head:1 status:010C0080
push_packet: l:12 ret:0 loop:4
    >><< Done

$$$usb_mtp_send timeout head:1 status:010C0080
push_packet: l:12 ret:0 loop:0

$$$usb_mtp_send timeout head:1 status:010C0080
push_packet: l:12 ret:0 loop:1

$$$usb_mtp_send timeout head:1 status:010C0080
push_packet: l:12 ret:0 loop:2

$$$usb_mtp_send timeout head:1 status:010C0080
push_packet: l:12 ret:0 loop:3

$$$usb_mtp_send timeout head:1 status:010C0080
push_packet: l:12 ret:0 loop:4
44501 RESP:2001(RSP:OK)l: 16 T:ac : 1b

$$$usb_mtp_send timeout head:1 status:010C0080
push_packet: l:16 ret:0 loop:0

$$$usb_mtp_send timeout head:1 status:010C0080
push_packet: l:16 ret:0 loop:1

$$$usb_mtp_send timeout head:1 status:010C0080
push_packet: l:16 ret:0 loop:2

$$$usb_mtp_send timeout head:1 status:010C0080
push_packet: l:16 ret:0 loop:3

$$$usb_mtp_send timeout head:1 status:010C0080
push_packet: l:16 ret:0 loop:4
LP:44806 CMD: 1009(GET_OBJECT)l: 16 T:ad : 1b

GetObject(27) size: 512

GetObject(27) size: 512
  << usb_mtp_available >>
  >>r p:0 l:512
    >>w dp:500 p:500 len:512
  << usb_mtp_available >>
    >>>>w len:12
    >><< Done

$$$usb_mtp_send timeout head:3 status:00100080
push_packet: l:12 ret:0 loop:0

$$$usb_mtp_send timeout head:3 status:00100080
push_packet: l:12 ret:0 loop:1

$$$usb_mtp_send timeout head:3 status:00100080
push_packet: l:12 ret:0 loop:2

$$$usb_mtp_send timeout head:3 status:00100080
push_packet: l:12 ret:0 loop:3

$$$usb_mtp_send timeout head:3 status:00100080
push_packet: l:12 ret:0 loop:4
45120 RESP:2001(RSP:OK)l: 16 T:ad : 1b

$$$usb_mtp_send timeout head:3 status:00100080
push_packet: l:16 ret:0 loop:0

$$$usb_mtp_send timeout head:3 status:00100080
push_packet: l:16 ret:0 loop:1

$$$usb_mtp_send timeout head:3 status:00100080
push_packet: l:16 ret:0 loop:2

$$$usb_mtp_send timeout head:3 status:00100080
push_packet: l:16 ret:0 loop:3

$$$usb_mtp_send timeout head:3 status:00100080
push_packet: l:16 ret:0 loop:4
LP:45425 CMD: 1009(GET_OBJECT)l: 16 T:ae : 1c

GetObject(28) size: 768

GetObject(28) size: 768
  << usb_mtp_available >>
  >>r p:0 l:768
    >>w dp:500 p:500 len:512
  << usb_mtp_available >>
    >>>>w len:268

$$$usb_mtp_send timeout head:0 status:02000080
push_packet: l:268 ret:0 loop:0

$$$usb_mtp_send timeout head:0 status:02000080
push_packet: l:268 ret:0 loop:1

$$$usb_mtp_send timeout head:0 status:02000080
push_packet: l:268 ret:0 loop:2

$$$usb_mtp_send timeout head:0 status:02000080
push_packet: l:268 ret:0 loop:3

$$$usb_mtp_send timeout head:0 status:02000080
push_packet: l:268 ret:0 loop:4
    >><< Done

$$$usb_mtp_send timeout head:0 status:02000080
push_packet: l:268 ret:0 loop:0

$$$usb_mtp_send timeout head:0 status:02000080
push_packet: l:268 ret:0 loop:1

$$$usb_mtp_send timeout head:0 status:02000080
push_packet: l:268 ret:0 loop:2

$$$usb_mtp_send timeout head:0 status:02000080
push_packet: l:268 ret:0 loop:3

$$$usb_mtp_send timeout head:0 status:02000080
push_packet: l:268 ret:0 loop:4
46036 RESP:2001(RSP:OK)l: 16 T:ae : 1c

$$$usb_mtp_send timeout head:0 status:02000080
push_packet: l:16 ret:0 loop:0

$$$usb_mtp_send timeout head:0 status:02000080
push_packet: l:16 ret:0 loop:1

$$$usb_mtp_send timeout head:0 status:02000080
push_packet: l:16 ret:0 loop:2

$$$usb_mtp_send timeout head:0 status:02000080
push_packet: l:16 ret:0 loop:3

$$$usb_mtp_send timeout head:0 status:02000080
push_packet: l:16 ret:0 loop:4
LP:46341 CMD: 1009(GET_OBJECT)l: 16 T:af : 1c

GetObject(28) size: 768

GetObject(28) size: 768
  << usb_mtp_available >>
  >>r p:0 l:768
    >>w dp:500 p:500 len:512
  << usb_mtp_available >>
    >>>>w len:268
    >><< Done
46341 RESP:2001(RSP:OK)l: 16 T:af : 1c
LP:46347 CMD: 1009(GET_OBJECT)l: 16 T:b0 : 1d

GetObject(29) size: 256

GetObject(29) size: 256
  << usb_mtp_available >>
  >>r p:0 l:256
    >>>>w len:268
    >><< Done
46366 RESP:2001(RSP:OK)l: 16 T:b0 : 1d
LP:46367 CMD: 1009(GET_OBJECT)l: 16 T:b1 : 1d

GetObject(29) size: 256

GetObject(29) size: 256
  << usb_mtp_available >>
  >>r p:0 l:256
    >>>>w len:268

$$$usb_mtp_send timeout head:3 status:00100080
push_packet: l:268 ret:0 loop:0

$$$usb_mtp_send timeout head:3 status:00100080
push_packet: l:268 ret:0 loop:1
And sure enough some of the time there is... but it does not always cause us to fail?
 
One of things I tried with usb_mtp_send was to wrap usb_transmit(MTP_TX_ENDPOINT, xfer); with NVIC_DISABLE_IRQ(IRQ_USB1); and enable it again after transmit but didn;t seem to help.
 
Again not sure if this will help localize issue down with the GetObjects, but was curious what the pending packet was... So added a peek message and then I had when I detected there was a packet I peeked and printed...
Code:
LP:70307 CMD: 1009(GET_OBJECT)l: 16 T:a8 : 19

GetObject(25) size: 768

GetObject(25) size: 768
  >>r p:0 l:768
    >>w dp:500 p:500 len:512
  << usb_mtp_available cb: 16>>
Peek:70309 CMD: 1009(GET_OBJECT)l: 16 T:a9 : 19
    >>>>w len:268
    >><< Done
70315 RESP:2001(RSP:OK)l: 16 T:a8 : 19
push_packet: l:16 ret:0 loop:0
LP:70404 CMD: 1009(GET_OBJECT)l: 16 T:a9 : 19

GetObject(25) size: 768

GetObject(25) size: 768
  << usb_mtp_available cb: 16>>
Peek:70404 CMD: 1009(GET_OBJECT)l: 16 T:aa : 1a
  >>r p:0 l:768
    >>w dp:500 p:500 len:512
  << usb_mtp_available cb: 16>>
Peek:70406 CMD: 1009(GET_OBJECT)l: 16 T:aa : 1a
    >>>>w len:268
    >><< Done
70410 RESP:2001(RSP:OK)l: 16 T:a9 : 19
LP:70419 CMD: 1009(GET_OBJECT)l: 16 T:aa : 1a

GetObject(26) size: 256

GetObject(26) size: 256
  << usb_mtp_available cb: 16>>
Peek:70419 CMD: 1009(GET_OBJECT)l: 16 T:ab : 1a
  >>r p:0 l:256
    >>>>w len:268
    >><< Done
70421 RESP:2001(RSP:OK)l: 16 T:aa : 1a
LP:70428 CMD: 1009(GET_OBJECT)l: 16 T:ab : 1a

GetObject(26) size: 256

GetObject(26) size: 256
  << usb_mtp_available cb: 16>>
Peek:70428 CMD: 1009(GET_OBJECT)l: 16 T:ac : 1b
  >>r p:0 l:256
    >>>>w len:268
    >><< Done
70437 RESP:2001(RSP:OK)l: 16 T:ab : 1a
LP:70444 CMD: 1009(GET_OBJECT)l: 16 T:ac : 1b

GetObject(27) size: 512

GetObject(27) size: 512
What is sort of interesting is the next message is another GetObject - even before we finished sending the current object. Also interesting is sometimes it is the next object
sometimes it is the same object ID but different transaction ID...

Again not sure what it means, but...
 
Glad something inspired the copy of the MemoryHexDump_GIT to SD ... :mad: that it is such a warped issue.

Kurt - how does the new PEEK/debug info compare to linux? Wonder if that might give a clue where the same does or does not happen?
 
Kurt - how does the new PEEK/debug info compare to linux? Wonder if that might give a clue where the same does or does not happen?

Funny you should ask. Looks like the Ubuntu implementation is completely different than Windows version... I won't put the whole debug output here,
but:
Code:
105501 RESP:2001(RSP:OK)l: 24 T:77 : 60001 0 16
LP:105501 CMD: 9801(GET_OBJECT_PROPS_SUPPORTED)l: 16 T:78 : 3000
105501 RESP:2001(RSP:OK)l: 16 T:78 : 3000
LP:105501 CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:79 : 19 dc04 (SIZE)
105501 RESP:2001(RSP:OK)l: 20 T:79 : 19 dc04
LP:105502 CMD: 9801(GET_OBJECT_PROPS_SUPPORTED)l: 16 T:7a : 3000
105502 RESP:2001(RSP:OK)l: 16 T:7a : 3000
LP:105502 CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:7b : 18 dc04 (SIZE)
105502 RESP:2001(RSP:OK)l: 20 T:7b : 18 dc04
LP:105502 CMD: 9801(GET_OBJECT_PROPS_SUPPORTED)l: 16 T:7c : 3000
105502 RESP:2001(RSP:OK)l: 16 T:7c : 3000
LP:105503 CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:7d : 17 dc04 (SIZE)
105503 RESP:2001(RSP:OK)l: 20 T:7d : 17 dc04
LP:105504 CMD: 9801(GET_OBJECT_PROPS_SUPPORTED)l: 16 T:7e : 3000
105504 RESP:2001(RSP:OK)l: 16 T:7e : 3000
LP:105505 CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:7f : 19 dc04 (SIZE)
105505 RESP:2001(RSP:OK)l: 20 T:7f : 19 dc04
LP:105506 CMD: 9801(GET_OBJECT_PROPS_SUPPORTED)l: 16 T:80 : 3000
105506 RESP:2001(RSP:OK)l: 16 T:80 : 3000
LP:105507 CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:81 : 19 dc04 (SIZE)
105507 RESP:2001(RSP:OK)l: 20 T:81 : 19 dc04
LP:105507 CMD: 9801(GET_OBJECT_PROPS_SUPPORTED)l: 16 T:82 : 3000
105507 RESP:2001(RSP:OK)l: 16 T:82 : 3000
LP:105508 CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:83 : 19 dc04 (SIZE)
105508 RESP:2001(RSP:OK)l: 20 T:83 : 19 dc04
LP:105508 CMD: 1009(GET_OBJECT)l: 16 T:84 : 19

GetObject(25) size: 768

GetObject(25) size: 768
  >>r p:0 l:768
    >>w dp:500 p:500 len:512
    >>>>w len:268
    >><< Done
105509 RESP:2001(RSP:OK)l: 16 T:84 : 19
LP:105512 CMD: 9801(GET_OBJECT_PROPS_SUPPORTED)l: 16 T:85 : 3000
105512 RESP:2001(RSP:OK)l: 16 T:85 : 3000
LP:105512 CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:86 : 18 dc04 (SIZE)
105512 RESP:2001(RSP:OK)l: 20 T:86 : 18 dc04
LP:105513 CMD: 9801(GET_OBJECT_PROPS_SUPPORTED)l: 16 T:87 : 3000
105513 RESP:2001(RSP:OK)l: 16 T:87 : 3000
LP:105513 CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:88 : 18 dc04 (SIZE)
105513 RESP:2001(RSP:OK)l: 20 T:88 : 18 dc04
LP:105514 CMD: 9801(GET_OBJECT_PROPS_SUPPORTED)l: 16 T:89 : 3000
105514 RESP:2001(RSP:OK)l: 16 T:89 : 3000
LP:105514 CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:8a : 18 dc04 (SIZE)
105514 RESP:2001(RSP:OK)l: 20 T:8a : 18 dc04
LP:105514 CMD: 1009(GET_OBJECT)l: 16 T:8b : 18

GetObject(24) size: 512

GetObject(24) size: 512
  >>r p:0 l:512
    >>w dp:500 p:500 len:512
    >>>>w len:12
    >><< Done
105515 RESP:2001(RSP:OK)l: 16 T:8b : 18
LP:105517 CMD: 9801(GET_OBJECT_PROPS_SUPPORTED)l: 16 T:8c : 3000
105517 RESP:2001(RSP:OK)l: 16 T:8c : 3000

With Windows, it does all of the GetObject() calls one after another need to look again to see where Windows asks for the information on each object (like name, size, attributes, dates...)

With the above you will see messages/packets for each file that will first ask for the parameters for a file (supported and value for each one), then it asks for the actual data... So completely different data flow
 
Quick update: it looks like Windows did the enumeration of the objects including grabbing properties when it enumerated the files...

This is when I opened up the folder...
Code:
LP:25384 CMD: 1007(GET_OBJECT_HANDLES)l: 24 T:36 : 60001 0 16
** ScanDir called 5 22
  >> 23: 5 0 0 22 0 256 aaa.txt
  >> 24: 5 0 0 22 23 512 bbb.txt
  >> 25: 5 0 0 22 24 768 ccc.txt
** ScanDir called 5 22
** ScanDir called 5 22
25393 RESP:2001(RSP:OK)l: 24 T:36 : 60001 0 16
LP:25395 CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:37 : 19 dc02 (FORMAT)
25395 RESP:2001(RSP:OK)l: 20 T:37 : 19 dc02
LP:25396 CMD: 9802(GET_OBJECT_PROP_DESC)l: 20 T:38 : dc03 3000 (PROTECTION)
25396 RESP:2001(RSP:OK)l: 20 T:38 : dc03 3000
LP:25396 CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:39 : 19 dc03 (PROTECTION)
25396 RESP:2001(RSP:OK)l: 20 T:39 : 19 dc03
LP:25397 CMD: 9802(GET_OBJECT_PROP_DESC)l: 20 T:3a : dc04 3000 (SIZE)
25397 RESP:2001(RSP:OK)l: 20 T:3a : dc04 3000
LP:25397 CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:3b : 19 dc04 (SIZE)
25397 RESP:2001(RSP:OK)l: 20 T:3b : 19 dc04
LP:25398 CMD: 1008(GET_OBJECT_INFO)l: 16 T:3c : 19
25398 RESP:2001(RSP:OK)l: 16 T:3c : 19
LP:25399 CMD: 9802(GET_OBJECT_PROP_DESC)l: 20 T:3d : dc01 3000 (STORAGE_ID)
25399 RESP:2001(RSP:OK)l: 20 T:3d : dc01 3000
LP:25400 CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:3e : 19 dc01 (STORAGE_ID)
25400 RESP:2001(RSP:OK)l: 20 T:3e : 19 dc01
LP:25400 CMD: 9802(GET_OBJECT_PROP_DESC)l: 20 T:3f : dc07 3000 (OBJECT NAME)
25400 RESP:2001(RSP:OK)l: 20 T:3f : dc07 3000
LP:25401 CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:40 : 19 dc07 (OBJECT NAME)
25401 RESP:2001(RSP:OK)l: 20 T:40 : 19 dc07
LP:25401 CMD: 9802(GET_OBJECT_PROP_DESC)l: 20 T:41 : dc08 3000 (CREATED)
25401 RESP:2001(RSP:OK)l: 20 T:41 : dc08 3000
LP:25401 CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:42 : 19 dc08 (CREATED)
Create (61bec5ac)Date/time:20211219T053956
Create (61bec5ac)Date/time:20211219T053956
25401 RESP:2001(RSP:OK)l: 20 T:42 : 19 dc08
LP:25402 CMD: 9802(GET_OBJECT_PROP_DESC)l: 20 T:43 : dc09 3000 (MODIFIED)
25402 RESP:2001(RSP:OK)l: 20 T:43 : dc09 3000
LP:25402 CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:44 : 19 dc09 (MODIFIED)
Modify (61bcc65a)Date/time:20211217T171818
Modify (61bcc65a)Date/time:20211217T171818
25402 RESP:2001(RSP:OK)l: 20 T:44 : 19 dc09
LP:25403 CMD: 9802(GET_OBJECT_PROP_DESC)l: 20 T:45 : dc0b 3000 (PARENT)
25403 RESP:2001(RSP:OK)l: 20 T:45 : dc0b 3000
LP:25403 CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:46 : 19 dc0b (PARENT)
25403 RESP:2001(RSP:OK)l: 20 T:46 : 19 dc0b
LP:25403 CMD: 9802(GET_OBJECT_PROP_DESC)l: 20 T:47 : dc41 3000 (PERSISTENT_UID)
25403 RESP:2001(RSP:OK)l: 20 T:47 : dc41 3000
LP:25403 CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:48 : 19 dc41 (PERSISTENT_UID)
25404 RESP:2001(RSP:OK)l: 20 T:48 : 19 dc41
LP:25404 CMD: 9802(GET_OBJECT_PROP_DESC)l: 20 T:49 : dc44 3000 (NAME)
25404 RESP:2001(RSP:OK)l: 20 T:49 : dc44 3000
LP:25404 CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:4a : 19 dc44 (NAME)
25404 RESP:2001(RSP:OK)l: 20 T:4a : 19 dc44
LP:25406 CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:4b : 18 dc02 (FORMAT)
25406 RESP:2001(RSP:OK)l: 20 T:4b : 18 dc02
LP:25406 CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:4c : 18 dc03 (PROTECTION)
25406 RESP:2001(RSP:OK)l: 20 T:4c : 18 dc03
LP:25406 CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:4d : 18 dc04 (SIZE)
25406 RESP:2001(RSP:OK)l: 20 T:4d : 18 dc04
LP:25407 CMD: 1008(GET_OBJECT_INFO)l: 16 T:4e : 18
25407 RESP:2001(RSP:OK)l: 16 T:4e : 18
LP:25407 CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:4f : 18 dc01 (STORAGE_ID)
25407 RESP:2001(RSP:OK)l: 20 T:4f : 18 dc01
LP:25407 CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:50 : 18 dc07 (OBJECT NAME)
25407 RESP:2001(RSP:OK)l: 20 T:50 : 18 dc07
LP:25408 CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:51 : 18 dc08 (CREATED)
Create (61bec5aa)Date/time:20211219T053954
Create (61bec5aa)Date/time:20211219T053954
25408 RESP:2001(RSP:OK)l: 20 T:51 : 18 dc08
LP:25408 CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:52 : 18 dc09 (MODIFIED)
Modify (61bcc65a)Date/time:20211217T171818
Modify (61bcc65a)Date/time:20211217T171818
25408 RESP:2001(RSP:OK)l: 20 T:52 : 18 dc09
LP:25408 CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:53 : 18 dc0b (PARENT)
25408 RESP:2001(RSP:OK)l: 20 T:53 : 18 dc0b
LP:25408 CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:54 : 18 dc41 (PERSISTENT_UID)
25408 RESP:2001(RSP:OK)l: 20 T:54 : 18 dc41
LP:25409 CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:55 : 18 dc44 (NAME)
25409 RESP:2001(RSP:OK)l: 20 T:55 : 18 dc44
LP:25410 CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:56 : 17 dc02 (FORMAT)
25410 RESP:2001(RSP:OK)l: 20 T:56 : 17 dc02
LP:25410 CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:57 : 17 dc03 (PROTECTION)
25410 RESP:2001(RSP:OK)l: 20 T:57 : 17 dc03
LP:25410 CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:58 : 17 dc04 (SIZE)
25410 RESP:2001(RSP:OK)l: 20 T:58 : 17 dc04
LP:25411 CMD: 1008(GET_OBJECT_INFO)l: 16 T:59 : 17
25411 RESP:2001(RSP:OK)l: 16 T:59 : 17
LP:25411 CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:5a : 17 dc01 (STORAGE_ID)
25411 RESP:2001(RSP:OK)l: 20 T:5a : 17 dc01
LP:25411 CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:5b : 17 dc07 (OBJECT NAME)
25411 RESP:2001(RSP:OK)l: 20 T:5b : 17 dc07
LP:25411 CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:5c : 17 dc08 (CREATED)
Create (61bec5aa)Date/time:20211219T053954
Create (61bec5aa)Date/time:20211219T053954
25412 RESP:2001(RSP:OK)l: 20 T:5c : 17 dc08
LP:25412 CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:5d : 17 dc09 (MODIFIED)
Modify (61bcc65a)Date/time:20211217T171818
Modify (61bcc65a)Date/time:20211217T171818
25412 RESP:2001(RSP:OK)l: 20 T:5d : 17 dc09
LP:25412 CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:5e : 17 dc0b (PARENT)
25412 RESP:2001(RSP:OK)l: 20 T:5e : 17 dc0b
LP:25412 CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:5f : 17 dc41 (PERSISTENT_UID)
25412 RESP:2001(RSP:OK)l: 20 T:5f : 17 dc41
LP:25412 CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:60 : 17 dc44 (NAME)
25412 RESP:2001(RSP:OK)l: 20 T:60 : 17 dc44

Then upload just one file:
Code:
LP:43351 CMD: 1009(GET_OBJECT)l: 16 T:61 : 17

GetObject(23) size: 256

GetObject(23) size: 256
  >>r p:0 l:256
    >>>>w len:268
    >><< Done
43352 RESP:2001(RSP:OK)l: 16 T:61 : 17

Then I tried the two remaining files in that folder:
Code:
LP:187986 CMD: 1009(GET_OBJECT)l: 16 T:62 : 18

GetObject(24) size: 512

GetObject(24) size: 512
  >>r p:0 l:512
    >>w dp:500 p:500 len:512
    >>>>w len:12
    >><< Done
187987 RESP:2001(RSP:OK)l: 16 T:62 : 18
LP:187988 CMD: 1009(GET_OBJECT)l: 16 T:63 : 18

GetObject(24) size: 512

GetObject(24) size: 512
  >>r p:0 l:512
    >>w dp:500 p:500 len:512
    >>>>w len:12
    >><< Done
187993 RESP:2001(RSP:OK)l: 16 T:63 : 18
LP:188014 CMD: 1009(GET_OBJECT)l: 16 T:64 : 19

GetObject(25) size: 768

GetObject(25) size: 768
  >>r p:0 l:768
    >>w dp:500 p:500 len:512
  << usb_mtp_available cb: 16>>
Peek:188016 CMD: 1009(GET_OBJECT)l: 16 T:65 : 19
    >>>>w len:268
    >><< Done
188023 RESP:2001(RSP:OK)l: 16 T:64 : 19
push_packet: l:16 ret:0 loop:0
push_packet: l:16 ret:0 loop:1
push_packet: l:16 ret:0 loop:2
push_packet: l:16 ret:0 loop:3
push_packet: l:16 ret:0 loop:4
LP:188328 CMD: 1009(GET_OBJECT)l: 16 T:65 : 19

GetObject(25) size: 768

GetObject(25) size: 768
  >>r p:0 l:768
push_packet: l:512 ret:0 loop:0
push_packet: l:512 ret:0 loop:1
push_packet: l:512 ret:0 loop:2
push_packet: l:512 ret:0 loop:3
push_packet: l:512 ret:0 loop:4
    >>w dp:500 p:500 len:512
    >>>>w len:268
push_packet: l:268 ret:0 loop:0
push_packet: l:268 ret:0 loop:1
Note: I don't have the core debug turned on, or you would see the timeout message along with the ret: 0...
 
The more expansive set of files and dirs is done - the other day it seemed the code was skipping some ... code was right and good - just interpretation error on looking at the files I saw when getting back to it.

Will post sketch and a zipped folder for test use. But a new feature krept in moments ago to make the file content have a unique signature not just repeated text to detect and ID 'cross linking'.

Question: What isn't in 1.56b5 release for most current WIP libs to use here for: FS, MTP, MSC
 
Code:
Question: What isn't in 1.56b5 release for most current WIP libs to use here for: FS, MTP, MSC
. Will need MTP_Teensy and USBHost_t36 from Kurt's repository and if you want to play with SD Card detect will need is version of SD as well.
 
Now updated to new TD release...

I rebased my SD branch with CS pin to be up to current sources.

I found I screwed up on LittleFS wrappers where I missed the Format methods in wrappers so they just fail (return false).. Pushed up fix:
https://github.com/PaulStoffregen/LittleFS/pull/46

Found new fault to fix: I tried to copy the directories (111 222 333 ) off of SD to a littlefs flash and program faulted (MMOD)...
Code:
CrashReport:
  A problem occurred at (system time) 7:27:15
  Code was executing from address 0xA3E8
  CFSR: 1000000
	(UNALIGNED) Unaligned access UsageFault
  Temperature inside the chip was 51.32 °C
  Startup CPU clock speed is 600MHz
  Reboot was caused by auto reboot after fault or bad interrupt detected
Code:
C:\Users\kurte\AppData\Local\Temp\arduino_build_SD_Program_SPI_QSPI_MTP-logger.ino>addr2line -e SD_Program_SPI_QSPI_MTP-logger.ino.elf 0xA3E8
C:\Users\kurte\Documents\Arduino\libraries\MTP_Teensy\src/MTP_Storage.h:96

Investigating
Code:
	File open(uint32_t store, const char *filename, uint32_t mode) {
		return fs[store]->open(filename, mode);
	}
 
Found new fault to fix: I tried to copy the directories (111 222 333 ) off of SD to a littlefs flash and program faulted (MMOD)...
Is this a new problem or an existing one related to coping files to PC? Wonder if its direct to flash or goes through PC. When copying from SD to USB drive directories are created but no files are copied - found same thing with flash.

EDIT: Just tried coping the files from SD to program as well on the TMM and same thing - directories created but no files. Guess its not related to USB.
 
I have copied one file at a time before. I know issue of files that take a long time to write (LFS), that host may get bored and timeout...

But maybe first time I tried to copy a directory....
 
I have copied one file at a time before. I know issue of files that take a long time to write (LFS), that host may get bored and timeout...

But maybe first time I tried to copy a directory....

Just went back to the original mtp_t4 library to see if we missed anything and noted the following:
within-MTP copy not yet implemented (i.e no within-disk and cross-disk copy)
 
Back
Top