MTP Responder Contribution

@WMXZ
Just downloaded and installed the MTP and USB2 directories. I changed the made sure I changed to use SDIO = 1. SDFAT-beta was already set up but no luck. I see teensy as a device but no SDCard? I am using a 32Gb sd card with a win10x64 pc on a T4.1
 
what would be required to provide MTP and a file system on T4.1 (optional) external flash? and someday maybe "reserved" area of internal flash (bootloader mods required?) circuitpython on T3 and T4 constructs a file system in the unused upper internal flash and pops up a USB drive. it survives power cycles but not program upload.
 
Last edited:
@WMXZ
Just downloaded and installed the MTP and USB2 directories. I changed the made sure I changed to use SDIO = 1. SDFAT-beta was already set up but no luck. I see teensy as a device but no SDCard? I am using a 32Gb sd card with a win10x64 pc on a T4.1

do you happen to have a separate SdFat V1 installation in addition to SdFat-beta?
 
what would be required to provide MTP and a file system on T4.1 (optional) external flash? and someday maybe "reserved" area of internal flash (bootloader mods required?)

IIRC, the original MTP was set-up to allow different storage implementations
MTPStorageInterface class is virtual.
Never tried to implement something based on virtual classes (C++ experts step forward)
 
do you happen to have a separate SdFat V1 installation in addition to SdFat-beta?

Nope - first thing I checked. I also did a search for SDFat.h and only version I have in the libraries folder is in the SDFat-beta library.

Doublecheck: forgot to check what SD lib used so there is a SDFat.h when SD lib is installed with Teensyduino. Nope that wasn't it. Just checked.

I changed SDFat-beta.h to SDFat.h, changed FileType to 3 and made sure USE_SDIO =1. Not sure what else to check?
 
@mjs513, I will get my T4.1 (not beta) in an hour or so, I will test this evening (EU time). maybe there are some missing 4.1 symbols
 
@mjs513, I will get my T4.1 (not beta) in an hour or so, I will test this evening (EU time). maybe there are some missing 4.1 symbols

I just copied and pasted the files that @JaredReabow sent me: from Arduino libraries used his SDFat-beta, MTP4, usb2 directories and at least now I can see and open the SD Card and see the directory contents but - all file sizes are 0 and can not copy and paste. Going to reformat …. check back for edit.

Quick question are the links the same to libraries?

UPDATE1: ok I reformatted as FAT32 and now its reading the file sizes. Cant copy or from to the SDCard though. Excuse once in a while if I reboot I can always copy from. On reboot it will give me a copy and replace on the SDCard but doesn't copy just times out. I can still copy from. But it seems intermittent on operations.

Also in Jared directory I see a MTP4 folder????
 
Last edited:
try my t4.1MTP sketch and see if it does anything different as this is what I am actually using. t41.png
this is the result of that.

I suggest you zip up your arduino installation folder and copy in mine, see if things change.
 
Can you copy and paste to and from the SDCard?

Yes, that is the link,
I copied to and from SDCard (but used T4.0 + AudioCard)

There may be issues with symbols on Arduino. As I develop with makefile (VisualCode) there may be some oversights
 
Yes, that is the link,
I copied to and from SDCard (but used T4.0 + AudioCard)

There may be issues with symbols on Arduino. As I develop with makefile (VisualCode) there may be some oversights

Not a problem - getting closer - trying to rule out what I am doing differently.
 
i cannot copy too, only delete and copy from the teensy, it simply locks up when I try to send to it, however this was a problem with the origional 3.6 MTP library as well, I was never able to copy too the device.
 
Update
just got my T4.1s
plugged in uSD card I was using before
compiled mtp_test for T4.1 (using Makefile): it worked
can copy from PC to T4.1 and from T4.1 to PC
Now I will try with Arduino IDE (but need to upgrade TD as I still used TD1.51, but cores is from 14-may-2020)

EDIT: After installing TD1.52 and updating the usb_desc.h (USB_MTP_SERIAL) program does NOT work anymore
will investigate
 
Last edited:
EDIT: After installing TD1.52 and updating the usb_desc.h (USB_MTP_SERIAL) program does NOT work anymore
will investigate

After setting speed from 600 MHz to 396 MHz, it worked also compiled with Arduino settings
Indicating there are some residual issues with T4.1 too fast for the way USB_MTP is implemented
Lot of things to do
 
After setting speed from 600 MHz to 396 MHz, it worked also compiled with Arduino settings
Indicating there are some residual issues with T4.1 too fast for the way USB_MTP is implemented
Lot of things to do

I redownloaded all the libraries and reinstalled and made no changes to usb_desc.h or .cpp. By the way prints loop to serial at the slower speeds. Works up to 450Mhz. At 528 and 600Mhz I tend to loose USB connection. Just as another data point.
 
@mjs513: the mods are only needed for using USB_DISK_SERIAL and not the default SEREMU
For my application where I access Teensy via headless Linux SBC SEREMU is somewhat demanding.
will change Readme and GitHub accordingly
 
SEREEMU works fine even at high speeds for me. (600mhz)
WMXZ, for the configuration where copying too and from is working, could you upload your installation directory and relevant library configs?
 
Works up to 450Mhz. At 528 and 600Mhz I tend to loose USB connection.
Confirm that for "MTP_DISK_SERIAL"
All my attempts to clean-up code, delays etc. failed to get it working with higher speeds.
Probably it needs a USB analyser, which I do not have. That is something for Paul.
Anyhow, as my application is low power, which means lowest CPU speed, I stick with an upper speed of 450 Mhz.
 
Confirm that for "MTP_DISK_SERIAL"
All my attempts to clean-up code, delays etc. failed to get it working with higher speeds.
Probably it needs a USB analyser, which I do not have. That is something for Paul.
Anyhow, as my application is low power, which means lowest CPU speed, I stick with an upper speed of 450 Mhz.

Thanks for all the effort to try and get it working at high speed. For now, until Paul has time to work this (he has a long list) I can deal with 450Mhz for MTP. An easy work around is to programmatically change the clock when I want to use MTP and then change it back to 600Mhz when done.
 
Surprise:
compiled with option smallest code and got it working with speed of 600 MHz.
makes little sense to me, except optimization is removing some weird coding (side effects).

Good is that having it working, one could investigate code differences and nail down bug.
 
Back
Top