MTP Responder Contribution

@defragster
A little confused on your testing configuration for T4.0. Is this what you are using:
Code:
USE_SD
USE_PROG

T4.0 does not have a builtin SD so probably should fail I would thing.

Have to check on using PROGMEM - maybe I copied something over wrong?

Where is #define ZERO? Don;t see it in the either Kurt's or my sketch?

UPDATE:
I changed to using MTP_SERIAL and changed the setup to:
Code:
  #if defined(USB_MTPDISK_SERIAL) 
    while(!Serial); // comment if you do not want to wait for terminal
  #else
    //while(!Serial.available()); // comment if you do not want to wait for terminal (otherwise press any key to continue)
    while(!Serial.available() && millis() < 5000); // or third option to wait up to 5 seconds and then continue
  #endif

With SD =1 and PROGM = 1 seems to work fine for me. I can see PROGM as a disk in windows explorer.

I get same results with just using MTP_DISK with either of the while's in setup.

Code:
MTP_test
SDIO Storage 0 254 sdio failed or missing
sd_addFilesystem: 0 20002bd4 PROGM 0
Program Storage 0 PROGM 983040 8192

**** dir of sd[0] ****

Setup done
CMD: 1002(OPEN_SESSION)l: 16 T:0 : 1
RESP:2001(RSP:OK)l: 16 T:0 : 1
 
Last edited:
Thanks Mike,

I will integrate it in... As for FRAM don't have any. QSPI NAND I do have that on one of mine...

Right now playing with Yet Another Lyxmotion Servo design for some of the others as an option...

No problem Kurt. I have the FRAMs but really haven't tested with them lately. But I left it in just in case.
 
@defragster
A little confused on your testing configuration for T4.0. Is this what you are using:
Code:
USE_SD
USE_PROG

T4.0 does not have a builtin SD so probably should fail I would thing.

Have to check on using PROGMEM - maybe I copied something over wrong?

Where is #define ZERO? Don;t see it in the either Kurt's or my sketch?

UPDATE:
I changed to using MTP_SERIAL and changed the setup to:
Code:
  #if defined(USB_MTPDISK_SERIAL) 
    while(!Serial); // comment if you do not want to wait for terminal
  #else
    //while(!Serial.available()); // comment if you do not want to wait for terminal (otherwise press any key to continue)
    while(!Serial.available() && millis() < 5000); // or third option to wait up to 5 seconds and then continue
  #endif

With SD =1 and PROGM = 1 seems to work fine for me. I can see PROGM as a disk in windows explorer.

I get same results with just using MTP_DISK with either of the while's in setup.

Code:
MTP_test
SDIO Storage 0 254 sdio failed or missing
sd_addFilesystem: 0 20002bd4 PROGM 0
Program Storage 0 PROGM 983040 8192

**** dir of sd[0] ****

Setup done
CMD: 1002(OPEN_SESSION)l: 16 T:0 : 1
RESP:2001(RSP:OK)l: 16 T:0 : 1

For QSPI I ADDED the #define ZERO in my updated sketch p#675 - it was noted as needed in prior post #666 - as it hangs T_4.0 on setup().

This T_4.0 as noted is on a working LOGLOW board - doesn't that map to the same SD_BUILTIN SDIO pins and setup? It does for other code.
Code:
sd_addFilesystem: 0 2000308c sdio 0
SDIO Storage 0 254 sdio 31092375552 163840
That seems to suggest it was found to work ... But there is something tripping on the two variants of 1062's

Just checked the SD card ( 32GB new yesterday ) - somebody wrote "This is a test line" test file.
It was factory formatted Fat32 - just reformatted ExFat and still fails the same.
 
Note: - I put the #include <T4_PowerButton.h> in the edited sketch { turning that off makes no DIFF }
> But FrankB edited that to wait longer on startup after a Fault since once MTP Serial is in use - the startup takes longer than 3 sec - and as noted 10 sec seems to work.

Prior T_4.0 on LOGLOW breakout was without PJRC Audio card.

Put Audio card back on : NOTE All entries are 'Storage 0' ??? ... Thus the "No storage"
Code:
T:\tCode\libraries\MTP_t4-MEM_send_object_large\examples\mtp-test\mtp-test.ino Feb  8 2021 11:34:23
MTP_test
sd_addFilesystem: 0 2000308c sdio 0
SDIO Storage 0 254 sdio 15923150848 65536
sd_addFilesystem: 1 20003660 PROGM 0
Program Storage 0 PROGM 983040 8192
sd_addFilesystem: 2 20003980 WINBOND 0
Storage 0 6 WINBOND 16777216 8388608
Flash ID: 00 00 00
No storage

Back to poking around.
 
DOH! - Reading more of the mjs513 sketch update ...

Needs this "USE_LFS_QSPI_NAND" disabled as it activates the same as QSPI:
Code:
#ifdef ARDUINO_TEENSY41
  #define USE_LFS_QSPI 1
  #define USE_LFS_QSPI_NAND 0
#else
  #define USE_LFS_QSPI 0  // T_4.0 fails start without QSPI feature
  #define USE_LFS_QSPI_NAND 0
#endif

Question: Should the LFS QSPI code be made #ifdef ARDUINO_TEENSY41 ???
Any inclusion otherwise causes mysterious FAIL.
 
Strange on the Loglow board - don't think I have a fully operational one - my soldering was too bad!
 
Strange on the Loglow board - don't think I have a fully operational one - my soldering was too bad!

LOGLOW T_4.0 working now ... with no QSPI devices:
Code:
T:\tCode\libraries\MTP_t4-MEM_send_object_large\examples\mtp-test\mtp-test.ino Feb  8 2021 13:28:05
MTP_test
sd_addFilesystem: 0 20002cd8 sdio 0
SDIO Storage 0 254 sdio 15923150848 65536
sd_addFilesystem: 1 200032ac PROGM 0
Program Storage 0 PROGM 983040 8192
sd_addFilesystem: 2 200035c0 WINBOND 0
Storage 0 6 WINBOND 16777216 8388608

**** dir of sd[0] ****
mtpindex.dat
test1.txt

Setup done

The SDIO SD_BUILTIN is 16GB and I copied usably the 'ADUIO...PDF' to that 16 GB device.
The above 'dir of sd[0]' is misleading as that is the SDIO device.

The Audio board is showing the 16MB SPI Winbond chip I soldered on there and has a readable '0_bigfile.txt' from earlier LFS_integrity.

Deleted that TXT file and copy of 'AUDIO...PDF' Failed? And now 'Teensy' shows only { PROGM, sdio } - the WINBOND is gone.
BUT: reading the PDF from the SDIO now fails : "1 Interrupted Action : An unexpected error is keeping you from copying the file..."
>> AND : there is no Added SerMon Spew from that event - nothing after the text below - Seems the Teensy is 'offline'. Navigating to the PROGM media I cannot 'Create New Folder' - and no new SerMon.
Below is the full 'session' before restarting. On restart there is a zero size 'AUDIO...PDF' file on WINBOND.
Code:
T:\tCode\libraries\MTP_t4-MEM_send_object_large\examples\mtp-test\mtp-test.ino Feb  8 2021 13:28:05
MTP_test
sd_addFilesystem: 0 20002cd8 sdio 0
SDIO Storage 0 254 sdio 15923150848 65536
sd_addFilesystem: 1 200032ac PROGM 0
Program Storage 0 PROGM 983040 8192
sd_addFilesystem: 2 200035c0 WINBOND 0
Storage 0 6 WINBOND 16777216 8388608

**** dir of sd[0] ****
mtpindex.dat
test1.txt

Setup done
CMD: 1002(OPEN_SESSION)l: 16 T:0 : 1
RESP:2001(RSP:OK)l: 16 T:0 : 1
CMD: 1001(GET_DEVICE_INFO)l: 12 T:1
RESP:2001(RSP:OK)l: 12 T:1
CMD: 1014(GET_DEVICE_PROP_DESC)l: 16 T:2 : d402
RESP:2001(RSP:OK)l: 16 T:2 : d402
CMD: 1004(GET_STORAGE_IDS)l: 12 T:3
RESP:2001(RSP:OK)l: 12 T:3
CMD: 1005(GET_STORAGE_INFO)l: 16 T:4 : 1
RESP:2001(RSP:OK)l: 16 T:4 : 1
CMD: 1005(GET_STORAGE_INFO)l: 16 T:5 : 2
RESP:2001(RSP:OK)l: 16 T:5 : 2
CMD: 1005(GET_STORAGE_INFO)l: 16 T:6 : 3
RESP:2001(RSP:OK)l: 16 T:6 : 3
CMD: 9801(GET_OBJECT_PROPS_SUPPORTED)l: 16 T:7 : 3000
RESP:2001(RSP:OK)l: 16 T:7 : 3000
CMD: 9801(GET_OBJECT_PROPS_SUPPORTED)l: 16 T:8 : 3001
RESP:2001(RSP:OK)l: 16 T:8 : 3001
CMD: 1007(GET_OBJECT_HANDLES)l: 24 T:9 : 1 0 ffffffff
RESP:2001(RSP:OK)l: 24 T:9 : 1 0 ffffffff
CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:a : 4 dc02 (FORMAT)
RESP:2001(RSP:OK)l: 20 T:a : 4 dc02
CMD: 9802(GET_OBJECT_PROP_DESC)l: 20 T:b : dc03 3000 (PROTECTION)
RESP:2001(RSP:OK)l: 20 T:b : dc03 3000
CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:c : 4 dc03 (PROTECTION)
RESP:2001(RSP:OK)l: 20 T:c : 4 dc03
CMD: 9802(GET_OBJECT_PROP_DESC)l: 20 T:d : dc04 3000 (SIZE)
RESP:2001(RSP:OK)l: 20 T:d : dc04 3000
CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:e : 4 dc04 (SIZE)
RESP:2001(RSP:OK)l: 20 T:e : 4 dc04
CMD: 1008(GET_OBJECT_INFO)l: 16 T:f : 4
RESP:2001(RSP:OK)l: 16 T:f : 4
CMD: 9802(GET_OBJECT_PROP_DESC)l: 20 T:10 : dc01 3000 (STORAGE_ID)
RESP:2001(RSP:OK)l: 20 T:10 : dc01 3000
CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:11 : 4 dc01 (STORAGE_ID)
RESP:2001(RSP:OK)l: 20 T:11 : 4 dc01
CMD: 9802(GET_OBJECT_PROP_DESC)l: 20 T:12 : dc07 3000 (OBJECT NAME)
RESP:2001(RSP:OK)l: 20 T:12 : dc07 3000
CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:13 : 4 dc07 (OBJECT NAME)
RESP:2001(RSP:OK)l: 20 T:13 : 4 dc07
CMD: 9802(GET_OBJECT_PROP_DESC)l: 20 T:14 : dc41 3000 (PERSISTENT_UID)
RESP:2001(RSP:OK)l: 20 T:14 : dc41 3000
CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:15 : 4 dc41 (PERSISTENT_UID)
RESP:2001(RSP:OK)l: 20 T:15 : 4 dc41
CMD: 9802(GET_OBJECT_PROP_DESC)l: 20 T:16 : dc44 3000 (NAME)
RESP:2001(RSP:OK)l: 20 T:16 : dc44 3000
CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:17 : 4 dc44 (NAME)
RESP:2001(RSP:OK)l: 20 T:17 : 4 dc44
CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:18 : 3 dc02 (FORMAT)
RESP:2001(RSP:OK)l: 20 T:18 : 3 dc02
CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:19 : 3 dc03 (PROTECTION)
RESP:2001(RSP:OK)l: 20 T:19 : 3 dc03
CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:1a : 3 dc04 (SIZE)
RESP:2001(RSP:OK)l: 20 T:1a : 3 dc04
CMD: 1008(GET_OBJECT_INFO)l: 16 T:1b : 3
RESP:2001(RSP:OK)l: 16 T:1b : 3
CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:1c : 3 dc01 (STORAGE_ID)
RESP:2001(RSP:OK)l: 20 T:1c : 3 dc01
CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:1d : 3 dc07 (OBJECT NAME)
RESP:2001(RSP:OK)l: 20 T:1d : 3 dc07
CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:1e : 3 dc41 (PERSISTENT_UID)
RESP:2001(RSP:OK)l: 20 T:1e : 3 dc41
CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:1f : 3 dc44 (NAME)
RESP:2001(RSP:OK)l: 20 T:1f : 3 dc44
CMD: 1007(GET_OBJECT_HANDLES)l: 24 T:20 : 3 0 ffffffff
RESP:2001(RSP:OK)l: 24 T:20 : 3 0 ffffffff
CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:21 : 5 dc02 (FORMAT)
RESP:2001(RSP:OK)l: 20 T:21 : 5 dc02
CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:22 : 5 dc03 (PROTECTION)
RESP:2001(RSP:OK)l: 20 T:22 : 5 dc03
CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:23 : 5 dc04 (SIZE)
RESP:2001(RSP:OK)l: 20 T:23 : 5 dc04
CMD: 1008(GET_OBJECT_INFO)l: 16 T:24 : 5
RESP:2001(RSP:OK)l: 16 T:24 : 5
CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:25 : 5 dc01 (STORAGE_ID)
RESP:2001(RSP:OK)l: 20 T:25 : 5 dc01
CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:26 : 5 dc07 (OBJECT NAME)
RESP:2001(RSP:OK)l: 20 T:26 : 5 dc07
CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:27 : 5 dc41 (PERSISTENT_UID)
RESP:2001(RSP:OK)l: 20 T:27 : 5 dc41
CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:28 : 5 dc44 (NAME)
RESP:2001(RSP:OK)l: 20 T:28 : 5 dc44
CMD: 1009(GET_OBJECT)l: 16 T:29 : 5
RESP:2001(RSP:OK)l: 16 T:29 : 5
CMD: 100c(SEND_OBJECT_INFO)l: 20 T:2a : 1 ffffffff
DATA:100c(SEND_OBJECT_INFO)l: 178 T:2a : 0 3000 87b2ad 3000 0
[B]SendObjectInfo: 1 4294967295 20202040: 0 3000 0 87b2ad 3000 0 0 0 0 0 0 0 0 0 0 : Audio_workshop.pdf
sd_getReadOnYieldWrites store:0 count:3 0
[/B]RESP:2001(RSP:OK)l: 24 T:2a : 1 ffffffff 6
CMD: 100d(SEND_OBJECT)l: 12 T:2b
MTPD::SendObject: len:0 Use Yield:0
>>>Total Time: 761904
RESP:2001(RSP:OK)l: 12 T:2b
CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:2c : 6 dc02 (FORMAT)
RESP:2001(RSP:OK)l: 20 T:2c : 6 dc02
CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:2d : 6 dc01 (STORAGE_ID)
RESP:2001(RSP:OK)l: 20 T:2d : 6 dc01
CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:2e : 6 dc07 (OBJECT NAME)
RESP:2001(RSP:OK)l: 20 T:2e : 6 dc07
CMD: 9802(GET_OBJECT_PROP_DESC)l: 20 T:2f : dc0b 3000 (PARENT)
RESP:2001(RSP:OK)l: 20 T:2f : dc0b 3000
CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:30 : 6 dc0b (PARENT)
RESP:2001(RSP:OK)l: 20 T:30 : 6 dc0b
CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:31 : 6 dc41 (PERSISTENT_UID)
RESP:2001(RSP:OK)l: 20 T:31 : 6 dc41
CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:32 : 6 dc44 (NAME)
RESP:2001(RSP:OK)l: 20 T:32 : 6 dc44
CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:33 : 6 dc03 (PROTECTION)
RESP:2001(RSP:OK)l: 20 T:33 : 6 dc03
CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:34 : 6 dc04 (SIZE)
RESP:2001(RSP:OK)l: 20 T:34 : 6 dc04
CMD: 1008(GET_OBJECT_INFO)l: 16 T:35 : 6
RESP:2001(RSP:OK)l: 16 T:35 : 6
CMD: 1005(GET_STORAGE_INFO)l: 16 T:36 : 1
RESP:2001(RSP:OK)l: 16 T:36 : 1
CMD: 1009(GET_OBJECT)l: 16 T:37 : 6
RESP:2001(RSP:OK)l: 16 T:37 : 6
CMD: 100b(DELETE_OBJECT)l: 20 T:38 : 5 0
RESP:2001(RSP:OK)l: 20 T:38 : 5 0
CMD: 1005(GET_STORAGE_INFO)l: 16 T:39 : 3
RESP:2001(RSP:OK)l: 16 T:39 : 3
CMD: 100c(SEND_OBJECT_INFO)l: 20 T:3a : 3 ffffffff
DATA:100c(SEND_OBJECT_INFO)l: 178 T:3a : 0 3000 87b2ad 3000 0
SendObjectInfo: 3 4294967295 20202040: 0 3000 0 87b2ad 3000 0 0 0 0 0 0 0 0 0 0 : Audio_workshop.pdf
sd_getReadOnYieldWrites store:2 count:3 0
RESP:2001(RSP:OK)l: 24 T:3a : 3 ffffffff 7
CMD: 100d(SEND_OBJECT)l: 12 T:3b
MTPD::SendObject: len:0 Use Yield:0

Trying a COPY with overwrite results in the same 'copy start' on Windows - then Failure and the WINBOND dissapears again - other two again visible but not usable:
Code:
...
CMD: 9802(GET_OBJECT_PROP_DESC)l: 20 T:16 : dc44 3000 (NAME)
RESP:2001(RSP:OK)l: 20 T:16 : dc44 3000
CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:17 : 3 dc44 (NAME)
RESP:2001(RSP:OK)l: 20 T:17 : 3 dc44
CMD: 100b(DELETE_OBJECT)l: 20 T:18 : 3 0
RESP:2001(RSP:OK)l: 20 T:18 : 3 0
CMD: 100c(SEND_OBJECT_INFO)l: 20 T:19 : 3 ffffffff
DATA:100c(SEND_OBJECT_INFO)l: 178 T:19 : 0 3000 87b2ad 3000 0
SendObjectInfo: 3 4294967295 20202040: 0 3000 0 87b2ad 3000 0 0 0 0 0 0 0 0 0 0 : Audio_workshop.pdf
sd_getReadOnYieldWrites store:2 count:3 0
RESP:2001(RSP:OK)l: 24 T:19 : 3 ffffffff 4
CMD: 100d(SEND_OBJECT)l: 12 T:1a
MTPD::SendObject: len:0 Use Yield:0
 
@defragster
With the 16MB FLASH that is what I am seeing as well. Once it fails it disappears from Windows Explorer and the other devices are no longer useable until you do a restart. Doing a "r" for reset does not help.

EDIT: you are making me pull out my loglow board and give it a test.
 
On TyComm 'Reset' I could read from the T_4.0 SDIO.

Building LFSIntegrity for T_4.0 and LL_formatting the 16MB SPI Flash to make sure it is good to go, will leave an "S" 2MB file on it and return to mtp-test just to be sure.

That allowed it to work!

T_4.0 with Audio card SPI 16MB Winbond:
Run LFSint (#define TEST_SPI CS#6): 'F', 'm', 'S', '1' (short wait to make some files) '0' to interrupt.

Return to mtp-test.ino - and all looks good:
> COPY 'AUDIO...PDF' and it works usably!

Will dirty the drive in LFSint and then see about finding the myfs for that device and add a command to formatUnused?
 
@defragster and all

Are you using the USB Type of MTP or MTP with Serial? And are you using Serial monitor or TyCommander?

Reason I ask, is with SEREMU, I believe Paul put stuff in it after the previous Beta but before this one or... That waited for something like an IOCTL that is NOT the reboot, to signal that it was ready and only after this is the Serial object true...

There are hacks in sketch to if SEREMU it did not look for !Serial but instead if Serial.available()... and still a timeout.

I know Paul mentioned a new version of the Serial monitor was going to have this stuff in it... Not sure if it went in? The only thing I noticed on the release is:
Code:
Improve serial emulation for non-serial USB types

Now back to polaying
 
Using TyComm here and TSET with this line in the build :: set usb=mtp { comes from TSET setup usb option :: " g :: mtp " }
In boards.txt it looks like that would be mapping to:
Code:
teensy41.menu.usb.mtp=MTP Disk (Experimental)
teensy41.menu.usb.mtp.build.usbtype=USB_MTPDISK
teensy41.menu.usb.mtp.fake_serial=teensy_gateway

Build shows this:
Code:
Generating function prototypes...
"T:\\arduino-1.8.13_t54\\hardware\\teensy/../tools/arm/bin/arm-none-eabi-g++" -E -CC -x c++ -w -g -Wall -ffunction-sections -fdata-sections -nostdlib -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=154 -DARDUINO=10600 -DARDUINO_TEENSY40 -DF_CPU=600000000 -D[B]USB_MTPDISK [/B]-DLAYOUT_US_ENGLISH "-IT:\\arduino-1.8.13_t54\\hardware\\teensy\\avr\\cores\\teensy4" "-IT:\\tCode\\libraries\\T4_PowerButton" "-IT:\\arduino-1.8.13_t54\\hardware\\teensy\\avr\\libraries\\SD\\src" "-IT:\\arduino-1.8.13_t54\\hardware\\teensy\\avr\\libraries\\SdFat\\src" "-IT:\\arduino-1.8.13_t54\\hardware\\teensy\\avr\\libraries\\SPI" "-IT:\\tCode\\libraries\\MTP_t4-MEM_send_object_large\\src" "-IT:\\arduino-1.8.13_t54\\hardware\\teensy\\avr\\libraries\\LittleFS\\src" "-IT:\\arduino-1.8.13_t54\\hardware\\teensy\\avr\\libraries\\Time" "T:\\TEMP\\arduino_build_mtp-test.ino\\sketch\\mtp-test.ino.cpp" -o "T:\\TEMP\\arduino_build_mtp-test.ino\\preproc\\ctags_target_for_gcc_minus_e.cpp" -DARDUINO_LIB_DISCOVERY_PHASE
"T:\\arduino-1.8.13_t54\\tools-builder\\ctags\\5.8-arduino11/ctags" -u --language-force=c++ -f - --c++-kinds=svpf --fields=KSTtzns --line-directives "T:\\TEMP\\arduino_build_mtp-test.ino\\preproc\\ctags_target_for_gcc_minus_e.cpp"
Compiling sketch...
"T:\\arduino-1.8.13_t54\\hardware\\teensy/../tools/precompile_helper" "T:\\arduino-1.8.13_t54\\hardware\\teensy\\avr/cores/teensy4" "T:\\TEMP\\arduino_build_mtp-test.ino" "T:\\arduino-1.8.13_t54\\hardware\\teensy/../tools/arm/bin/arm-none-eabi-g++" -x c++-header -O2 -g -Wall -ffunction-sections -fdata-sections -nostdlib -MMD -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=154 -DARDUINO=10600 -DARDUINO_TEENSY40 -DF_CPU=600000000 -D[B]USB_MTPDISK[/B] -DLAYOUT_US_ENGLISH

Is that right for MTP? Should I be using another not yet added to the TSET options?
 
Actually I am curious onto what message is sent out by the Serial monitor program and then if we can get it added to TyCommander...

But first back to playing!
 
Actually I am curious onto what message is sent out by the Serial monitor program and then if we can get it added to TyCommander...

But first back to playing!

So there is something newer than the change weeks back that wholly broke TyComm when the USB paths got renamed?

Missed that and not sure how to trigger or test or implement a change.

Other than being slow to start - it seems TyComm is working as Sermon with g==mtp as selected above?

If I could see/show that I could get an issue up for @koromix ... where the prior issue is resolved in latest release and an intermediate build even pushes over T_4.x time on upload.
 
@defragster and all

Are you using the USB Type of MTP or MTP with Serial? And are you using Serial monitor or TyCommander?

Reason I ask, is with SEREMU, I believe Paul put stuff in it after the previous Beta but before this one or... That waited for something like an IOCTL that is NOT the reboot, to signal that it was ready and only after this is the Serial object true...

There are hacks in sketch to if SEREMU it did not look for !Serial but instead if Serial.available()... and still a timeout.

I know Paul mentioned a new version of the Serial monitor was going to have this stuff in it... Not sure if it went in? The only thing I noticed on the release is:
Code:
Improve serial emulation for non-serial USB types

Now back to polaying

For me I am using MTP with SERIAL along with Serial Monitor.
 
For me I am using MTP with SERIAL along with Serial Monitor.

Boards.txt only shows a single MTP option as indicated in p#686.

Is there an alternative to add? ... getting deja vu to a question posted months back ...

Also back then I did something that resolved Serial better or faster ... or at least it did perhaps before some change ... off to search ... :( Search Fail :(
 
Last edited:
Boards.txt only shows a single MTP option as indicated in p#686.

Is there an alternative to add? ... getting deja vu to a question posted months back ...

Also back then I did something that resolved Serial better or faster ... or at least it did perhaps before some change ... off to search ... :( Search Fail :(

If you git clone or svn checkout: https://github.com/WMXZ-EU/MTP_t4.git there are 3 directories with the modifications to add MTPDISK with serial.

In modifications_for_cores_teensy4 is the following addition to hardware/teensy/avr/cores/teensy4/usb-desc.h (add just before the #elif defined(USB_AUDIO line):
Code:
#elif defined(USB_MTPDISK_SERIAL)
  #define VENDOR_ID             0x16C0
  #define PRODUCT_ID		        0x0476 //fake an include everything device
  #define RAWHID_USAGE_PAGE	0xFFAB  // recommended: 0xFF00 to 0xFFFF
  #define RAWHID_USAGE		0x0200  // recommended: 0x0100 to 0xFFFF
  #define DEVICE_CLASS		0xEF
  #define DEVICE_SUBCLASS	0x02
  #define DEVICE_PROTOCOL	0x01

  #define MANUFACTURER_NAME     {'T','e','e','n','s','y','d','u','i','n','o'}
  #define MANUFACTURER_NAME_LEN 11
  #define PRODUCT_NAME          {'T','e','e','n','s','y',' ','M','T','P',' ','D','i','s','k','/','S','e','r','i','a','l'}
  #define PRODUCT_NAME_LEN      22
  #define EP0_SIZE              64

  #define NUM_INTERFACE		      3
  #define NUM_ENDPOINTS         5

  #define CDC_IAD_DESCRIPTOR	  1
  #define CDC_STATUS_INTERFACE	1

  #define CDC_DATA_INTERFACE	  2	// Serial
  #define CDC_ACM_ENDPOINT	    2
  #define CDC_RX_ENDPOINT       3
  #define CDC_TX_ENDPOINT       3
  #define CDC_ACM_SIZE          16
  #define CDC_RX_SIZE_480       512
  #define CDC_TX_SIZE_480       512
  #define CDC_RX_SIZE_12        64
  #define CDC_TX_SIZE_12        64
  #define ENDPOINT2_CONFIG	ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_INTERRUPT
  #define ENDPOINT3_CONFIG	ENDPOINT_RECEIVE_BULK + ENDPOINT_TRANSMIT_BULK

  #define MTP_INTERFACE         3 // MTP Disk
  #define MTP_TX_ENDPOINT       4
  #define MTP_RX_ENDPOINT       4
  #define MTP_EVENT_ENDPOINT    5
  #define MTP_TX_SIZE_480       512
  #define MTP_RX_SIZE_480       512
  #define MTP_TX_SIZE_12        64
  #define MTP_RX_SIZE_12        64
  #define MTP_EVENT_SIZE        32

  #define MTP_EVENT_INTERVAL_12	10	// 10 = 10 ms
  #define MTP_EVENT_INTERVAL_480 7	// 7 = 8 ms

  #define ENDPOINT4_CONFIG	ENDPOINT_RECEIVE_BULK + ENDPOINT_TRANSMIT_BULK
  #define ENDPOINT5_CONFIG	ENDPOINT_RECEIVE_INTERRUPT + ENDPOINT_TRANSMIT_INTERRUPT  // ????

In modifications_for_cores_teensy3 is the following addition to hardware/teensy/avr/cores/teensy3/usb-desc.h (add just before the #elif defined(USB_AUDIO line):
Code:
#elif defined(USB_MTPDISK_SERIAL)
  #define VENDOR_ID             0x16C0
  #define PRODUCT_ID		0x0476
  #define RAWHID_USAGE_PAGE	0xFFAB  // recommended: 0xFF00 to 0xFFFF
  #define RAWHID_USAGE		0x0200  // recommended: 0x0100 to 0xFFFF
  #define DEVICE_CLASS		0xEF
  #define DEVICE_SUBCLASS	0x02
  #define DEVICE_PROTOCOL	0x01

  #define MANUFACTURER_NAME     {'T','e','e','n','s','y','d','u','i','n','o'}
  #define MANUFACTURER_NAME_LEN 11
  #define PRODUCT_NAME          {'T','e','e','n','s','y',' ','M','T','P',' ','D','i','s','k','/','S','e','r','i','a','l'}
  #define PRODUCT_NAME_LEN      22
  #define EP0_SIZE              64

  #define NUM_ENDPOINTS         6
  #define NUM_USB_BUFFERS       20
  #define NUM_INTERFACE         3

  #define CDC_IAD_DESCRIPTOR    1
  #define CDC_STATUS_INTERFACE  0
  #define CDC_DATA_INTERFACE    1 // Serial
  #define CDC_ACM_ENDPOINT      1
  #define CDC_RX_ENDPOINT       2
  #define CDC_TX_ENDPOINT       3
  #define CDC_ACM_SIZE          16
  #define CDC_RX_SIZE           64
  #define CDC_TX_SIZE           64
  
  #define MTP_INTERFACE         2 // MTP Disk
  #define MTP_TX_ENDPOINT       4
  #define MTP_TX_SIZE           64
  #define MTP_RX_ENDPOINT       5
  #define MTP_RX_SIZE           64
  #define MTP_EVENT_ENDPOINT    6
  #define MTP_EVENT_SIZE        32
  #define MTP_EVENT_INTERVAL    10
  #define ENDPOINT1_CONFIG      ENDPOINT_TRANSMIT_ONLY
  #define ENDPOINT2_CONFIG      ENDPOINT_RECEIVE_ONLY
  #define ENDPOINT3_CONFIG      ENDPOINT_TRANSMIT_ONLY
  #define ENDPOINT4_CONFIG      ENDPOINT_TRANSMIT_ONLY
  #define ENDPOINT5_CONFIG      ENDPOINT_RECEIVE_ONLY
  #define ENDPOINT6_CONFIG      ENDPOINT_TRANSMIT_ONLY

In the directory modifications_for_teensy_avr is the addition for hardware/teensy/avr/boards.txt (you can add this to the end of the file):
Code:
teensy41.menu.usb.mtpserial=MTP Disk Serial (Experimental)
teensy41.menu.usb.mtpserial.build.usbtype=USB_MTPDISK_SERIAL

teensy40.menu.usb.mtpserial=MTP Disk Serial (Experimental)
teensy40.menu.usb.mtpserial.build.usbtype=USB_MTPDISK_SERIAL

teensy36.menu.usb.mtpserial=MTP Disk SERIAL (Experimental)
teensy36.menu.usb.mtpserial.build.usbtype=USB_MTPDISK_SERIAL

teensy35.menu.usb.mtpserial=MTP Disk SERIAL (Experimental)
teensy35.menu.usb.mtpserial.build.usbtype=USB_MTPDISK_SERIAL

I was able to start the mtp-test sketch and I saw output on the serial monitor. But I'm still kind of fuzzy of how to use it under Linux.
 
For the mods, it is not important where you insert the text
For example, I insert all "insert to boards.txt " in the beginning,
and all "insert to usb_desc.h" just before the closing "#endif"
 
Thanks @MichaelM and WMXZ. I'll give that a go - Suppose it gets Serial online faster. I bumped up the Serial wait in setup() to 9 secs and that is a bit ridiculous ...

Sounds like I can add the boards.txt items to the boards.local.txt file and they will then STICK across updates.

<edit> I had hoped ( not alone perhaps ) that Beta 6 would have these things in place to avoid manual updates for best use and testing ....
 
I tried MTP, too.

I have the example sketch configured for inbuilt SD only. After pressing "s" I get:
Code:
Hardfault.
Return Address: 0x869C
Faulted from exception.
	(INVSTATE) Instruction makes illegal use of EPSR)
MTP logger
Storage 0 254 sdio 15923150848 70287360
Setup done
 Enter s to start acquisition and q to stop acquisition
 
@WMXZ - working with those edits: usb_desc.h and adds to current boards.local.txt. THen edited local TSET to add 'o' for usb=mtpserial

Not sure it is any faster as it still shows millis() at this before seeing Serial : MTP_test @ms=6540

Doesn't change the failure to write on SPI flash needing format during file write.

Looking for a way to identify the LFS media at hand and how to selectively 'myfs.formatUnused' where there are various groupings of sets of possible mounted media ...
 
Ah, sry, I have updated the MTP library now (from KURTE - is this right?)
Now I get:
Code:
MTP logger
Storage 0 254 sdio 15923150848 70287360
Setup done
 Enter s to start acquisition and q to stop acquisition


Start
loop: 11436286    0    0    0    0 0
/18667/09_07_26.raw
But Windows does not show a MTP Device
 
I tried MTP, too.

I have the example sketch configured for inbuilt SD only. After pressing "s" I get:
Code:
Hardfault.
Return Address: 0x869C
Faulted from exception.
	(INVSTATE) Instruction makes illegal use of EPSR)
MTP logger
Storage 0 254 sdio 15923150848 70287360
Setup done
 Enter s to start acquisition and q to stop acquisition

Yikes - didn't run that sketch - and so far ( after testing ) not seen any HardFaults - but the slow to write with format SPI just hangs/goes OFFLINE.
 
Is there a "howto"? I think I am doing something wrong. But I have no idea where to look.

I get a warning:
Code:
C:\Users\Frank\Documents\Arduino\libraries\MTP_t4-master\src\MTP.cpp:295:76: warning: array subscript is above array bounds [-Warray-bounds]
     for (size_t i=0; i<10; i++) buf[i] = usb_string_serial_number.wString[i];

So, i'm using a wrong version?
 
Ah, sry, I have updated the MTP library now (from KURTE - is this right?)
Now I get:
Code:
MTP logger
Storage 0 254 sdio 15923150848 70287360
Setup done
 Enter s to start acquisition and q to stop acquisition


Start
loop: 11436286    0    0    0    0 0
/18667/09_07_26.raw
But Windows does not show a MTP Device

Awesome cross post timing :)

If you see that it is hanging in setup() - AFAIK - as some lines should come after that for mounted media.

What Teensy? That is what I saw with 4.0 when QSPI was requested and it doesn't have it

... just saw another cross post arrive :(
 
Back
Top