MTP Responder Contribution

Hey everyone Thanks for all your help so far. This is exactly what I need for a project I'm doing.

I'm running into a problem where I can readthe SD cardinfo but when running the mtp-test example I get
error: SD.begin failed

SdError: 0X1,0XFF

I have done all the steps in the Readme, does anyone know where I may have messed up? Thanks!
 
@nectar
You did not give us the information we need to help you.

can you check if uSD is FAT32, or EXFAT?
No Linux FS or NTFS is supported.
where do you have your uSD Card?
if build-in uSD (Teensy3.6) did you set USE_SDIO = 1 in config.h ?
if you use other sdCard than AudioAdapter, did you adapt SPI (CS,MISO,MOSI,SCK) to your adapter?
 
WMXZ thanks for the reply,
I was using the default mapped SPI configurations.. I wasn't aware that MK20DX256, MK64FX512 and IMXRT1062 were the chips on the different teensy boards. Your post helped me realize that. As soon as I updated them, it worked perfectly! Thank you
 
It's alive!

The problem turned out to be embarrasingly simple - the cable I was using was too long (about 1m). Swapped to a 50cm cable and everything burst into life. I feel pretty stupid. Or perhaps I am pretty stupid.

Anyway, thank you to WMXZ, KurtE and Defragster. :cool:

Ubuntu 18.04 with Nautilus needs gvfs-backends (which includes libmtp). No other mtp software is required. Standard udev rules as available on teensy site.
 
Has anyone had success with MTP on MacOS? I can currently load WMXZs library and boards.txt etc files, compile and run the example code with serial debug output, but I cannot see the SD card in MacOS. I see the teensy MTP connected to the USB bus, but no disk.

Running T3.6 with SDIO, card is formatted as fat32, SDIO set to 1, I've tried both sdfat and sdfat-beta.

The SD library works in another sketch (non MTP) and I can access files on the card.
 
I have no access to a Mac, so I'm not very helpful on this.

I'm now testing this on a Windows 10 laptop, I can see the Teensy but files that I copy over are all 0kb, directories work but files are empty. I have to disconnect and reconnect in order to see any updates. It also seems that long named directories don't want to copy over at all.

On the MacOS side the disk is not recognized at all.
 
I'm now testing this on a Windows 10 laptop, I can see the Teensy but files that I copy over are all 0kb, directories work but files are empty. I have to disconnect and reconnect in order to see any updates. It also seems that long named directories don't want to copy over at all.

On the MacOS side the disk is not recognized at all.

copying files from PC to Teensy worked for me, showing correct size. Have you enabled long names on SdFat?

concerning MacOS, it simply may e a problem with Apple. Not sure if Apple still supports MTP protocol at all.
 
copying files from PC to Teensy worked for me, showing correct size. Have you enabled long names on SdFat?

concerning MacOS, it simply may e a problem with Apple. Not sure if Apple still supports MTP protocol at all.

SDFatConfig.h has #define USE_LONG_FILE_NAMES 1, but on Windows files still transfer at 0kb.

WMXZ - would you be willing to export/share a compiled binary that you know works on a Teensy 3.6 with SDIO?

As for mac os, it looks like MTP is not supported by the OS. There are a number of utilities for using MTP with Android and Windows phones, as well as camera sync utilities. I've tried the following and none recognized the Teensy, listing this here in case anyone else wants to go down this rabbit hole:

SyncMate
CommanderOne
OpenMTP
Android File Transfer
MTP-Helper
 
SDFatConfig.h has #define USE_LONG_FILE_NAMES 1, but on Windows files still transfer at 0kb.

Looked into the T3.6 version of the MTP.
in fact, copy PC to Teensy3.6 is incomplete.
Existing files are deleted, file info is transferred and file is created, but file content is not send and therefore file size remains 0 and PC does not update directory.
Will investigate in the next days.
 
Looked into the T3.6 version of the MTP.
in fact, copy PC to Teensy3.6 is incomplete.
Existing files are deleted, file info is transferred and file is created, but file content is not send and therefore file size remains 0 and PC does not update directory.
Will investigate in the next days.

Thanks, I'll stay tuned.
 
Thanks, I'll stay tuned.

Please give the actual version of MTP_t4 a try (both T3.6 and T4-0)

I reworked the code from a working version, so implementation is somewhat different.
I also removed the T3.6 USB2 component, which will go into own GitHub repository.
 
@WMXZ - just tried it on a T4 and a T4.1 using SDIO. MTP shows up in explorer but doesn't show any files. Confirm good by running a few test cases including TeensySDIODemo sketch. Any ideas?
 
@WMXZ - just tried it on a T4 and a T4.1 using SDIO. MTP shows up in explorer but doesn't show any files. Confirm good by running a few test cases including TeensySDIODemo sketch. Any ideas?

also on T4.0, right?
which OS?
 
@wmz, sorry for the lag, finally ran your updated code and am able to transfer files to/from Teensy3.6 using SDIO on a Windows 10 machine. Thank you!
 
@WMXZ getting this error : Documents\Arduino\libraries\MTP_t4-master\examples\mtp-test\mtp-test.ino:3:19: fatal error: mtp.h: No such file or directory
Not sure why its not finding mtp.h, could it be capitalisation?
 
@WMXZ getting this error : Documents\Arduino\libraries\MTP_t4-master\examples\mtp-test\mtp-test.ino:3:19: fatal error: mtp.h: No such file or directory
Not sure why its not finding mtp.h, could it be capitalisation?

windows or Linux?
 
windows or Linux?


Windows 10.

initially I was using the latest non beta teensyduino installation and manually updated the cores and AVR
This gave the same error.
I then installed the latest beta #6 for the T4.1 which brings MTP into the core definitions and tried again, same problem "unable to find mtp.h"
 
should not be case sensitive.
(I'm using Windows10 only)
may you could check the Arduino verbose to see which include directives are passed to compiler

so i copied the files into the example directory and it find them however i now get:
"

In file included from C:\Users\Jared\AppData\Local\Temp\arduino_build_651674\sketch\mtp.h:36:0,

from C:\Users\Jared\Documents\Arduino\libraries\MTP_t4-master\examples\mtp-test\mtp-test.ino:3:

C:\Users\Jared\AppData\Local\Temp\arduino_build_651674\sketch\Storage.h:53:26: fatal error: SdFat-beta.h: No such file or directory

compilation terminated.

Error compiling for board Teensy 4.1.

"

I have sdfat-beta installed however they no longer use the "beta" tag, so I modified it to remove "beta" from the include at which point I am getting a successful compilation
 
Last edited:
I have sdfat-beta installed however they no longer use the "beta" tag, so I modified it to remove "beta" from the include at which point I am getting a successful compilation

(For the Record) As written in readme / installation "in src directory copy file "SdFat.h" to "SdFat-beta.h"" However, this is only necessary if you do not have original sdfat installed
 
Last edited:
Back
Top