Adding MTP to a Teensy 4.1 project (and 3.2) that is already SERIAL + MIDI

Davidelvig

Well-known member
Is this possible?

I've tried the MTP examples after downloading from each of these :
I'm doing this on a Teensy 4.1 board... and not yet seeing a new USB connected drive on my MacBook, so two questions:
  1. How can I best get started to "see" a USB-connected Teensy's SD card in Mac Finder?
  2. Would this be possible to do while also having the Serial port support Serial and MIDI
It would be sooooo good!
 
MTP pic copy.png
 
Is this possible?

I've tried the MTP examples after downloading from each of these :
I'm doing this on a Teensy 4.1 board... and not yet seeing a new USB connected drive on my MacBook, so two questions:
  1. How can I best get started to "see" a USB-connected Teensy's SD card in Mac Finder?
  2. Would this be possible to do while also having the Serial port support Serial and MIDI
It would be sooooo good!
Sorry not sure on why you're not seeing it. The example for MTP_Teensy worked for me without any issues but that was on a PC. Could you test connecting it to with a windows box just in case it's a MAC related issue? You'll probably find it not working there too but worth checking it's consistent.

Beyond that my first check would be that the Teensy can read/write the SD card. If it can't read and write the card then MTP isn't going to work. If it doesn't work check which filesystem the card is formatted to or try a different card.

On question 2, possible but it involves editing the usb library. You would need to edit usb_desc.h and possibly usb_desc.c to add a new USB operating mode with the options you want. By using the existing options as examples it shouldn't be too tricky to work out what's needed but it'll certainly look intimidating at first.
 
Thanks, @AndyA
On further attempts, I noted that Arduino was not seeing a Serial port for terminal output. A reset of the selected Teensy allowed me to see this output from setup()

Code:
MTP_test
SDIO Storage 0 254 sdio 0 0
SD Storage 1 10 sd1 failed or missing

**** dir of sd[0] ****
LOGS/
midi/
test1.txt

Setup done
1001 12 1 0:
1002 16 1 0:  1

So, "sd1 failed or missing"

I have an off-the-shelf Teensy 4.1 in my enclosure, with a uSD card that had files readable using the SD library in my own app with
code like:

Code:
#include <SD.h>
...
if (SD.begin(SD_CARD_Pin)) {
     SD.open("/");
}

Any ideas?

I'm using the unmodified code in mtp-test.ino
from the MTP_t4 library

(I've not yet tested it on Windows, but I expect I have a lower-level failure based on the error at startup)
 
On further attempts, I noted that Arduino was not seeing a Serial port for terminal output. A reset of the selected Teensy allowed me to see this output from setup()

MTP_test

SDIO Storage 0 254 sdio 0 0
SD Storage 1 10 sd1 failed or missing

**** dir of sd[0] ****
LOGS/
midi/
test1.txt

I think that
SDIO Storage 0 254 sdio 0 0
is indicating that the built in SD card interface is mounting the card correctly, taking a quick look at the example code I think the second error is attempting to mount an SPI connected SD card which you probably don't have.
If the directory listing given matches your card then it's managing to read the card.
 
Got it. It does indeed match the root directory of the Teensy-mounted SD card.
It does work on Windows, but not the Mac.
Hmmm
 
David:
You cannot use MTP with the Mac Finder as this is a MicroSoft protocol that has not been implemented on the Mac. However there are several apps you can download that will read this protocol, google is your friend.

Regards,
Ed
 
Thanks, @AndyA!
I'll ping @KurtE and @WMXZ
(or maybe I've just pinged them by mentioning them)
Sorry, I seldom use a MAC. My 12+ year old one is currently sitting in cabinet.

But if I remember correctly, mostly used something with the name like: Android File Transfer app... I believe done by Android...

I tried a few other things several years ago, There are some that you can purchase that have free trial period...
 
I only used Windows, and know that it works on Ubuntu. I recall that Mac's were always an issue. Old story: Apple-Microsoft
 
For MTP on MacOS, use the Android File Transfer program.


You can drag and drop files between it and Finder. But if you double click a file, you'll get a message it has to be dragged over to your Mac. Not quite seamless, but it's the best I've seen for MTP on MacOS.
 
Android File Transfer worked after a reboot!
This offers some real possibilities!
Thanks, all!
1707166560014.png

and using the Example_3_simple_SD.ino example from the MTP_Teensy library
 
So, my mission now is to explore getting Serial+MIDI+MTP(Very Beta) working for a serial port type.
I'd welcome collaborators on this... particularly those smarter than I.
 
I'm working in VS Code generally.
Where might I find the proper copies of
usb_desc.h and possibly usb_desc.c
to peruse?

(or within Arduino IDE for that matter)
 
On MacOS using Arduino IDE 2.2.x, the Teensyduino files are installed in a hidden "Library" folder in your home directory. On my Macbook Air using the lastest beta, the full pathname is /Users/paul/Library/Arduino15/packages/teensy/hardware/avr/0.59.6/cores/teensy4/usb_desc.h. If you find this file on you Mac and edit it, Arduino IDE should automatically notice the change and recompile as needed. Best to start with a quick sanity check, just add any syntax error and make sure a Verify results in a compile error to confirm you're editing the right file and Arduino IDE really is using it.
 
Back
Top