Fastest way to transfer file from Raspberry PI 4 to Teensy 4.1

I will still need to wire up the port I put in the photo for the production.
Is it possible to know how to wire a micro usb port?
Can I follow the same logic for USB OTGs?
 
Again the solution uses the Teensy plugged into the RPI, with standard USB cable. So should hopefully be easy to try. Does not use the USB Host
 
Again the solution uses the Teensy plugged into the RPI, with standard USB cable. So should hopefully be easy to try. Does not use the USB Host
I'm sorry, I didn't understand since I can't use Teensy's micro usb to connect to the Raspberry.
Sorry me
 
Undoubtedly I don't know anything about Teensy and itslibraries, I mistakenly thought I could use the usb host port similar to the micro usb port.

Just in case this hasn't been explained clearly, no software is published to use the USB host port on Teensy 4.1 in any other mode, like device or OTG. The software only supports host mode.

Only the main USB device port (the one with Micro B connector) is supported for use as device mode.

Theoretically the hardware can operate as either host or device. So device mode should be possible, for some extreme understanding of the word "possible" where you dive deep into the USB code. But that software work is a large and difficult task. Some time ago WXMZ published code with limited support for device mode on the 2nd USB port of Teensy 3.6. So if you wanted to start this long and difficult software project, finding that code would be (maybe) easier than starting with only the Teensy core library files meant for the main USB device port.

Many people have requested to use the USB host port as a 2nd device port. So this feature is on my long list of commonly requested features. At some point in the (likely distant) future software probably will get published to use the host port this way. But today, please be aware the situation is only software support to use the USB host port in host mode.
 
Now that I've said (hopefully clearly) which software does not exist, here are a few ideas for use of software which does exist...

1: Teensy absolutely does work as a USB device on its main USB port. You can plug Teensy into any of the USB host ports on Raspberry Pi 4, using an ordinary USB-A to USB-Micro-B cable. The Arduino IDE and Teensyduino do work on Raspberry Pi 4. Obviously Raspberry Pi is slower than most PCs, so some patience is required, but it definitely does work.

2: Linux has a feature called "USB Gadget" which causes a USB port to run in device mode. Raspberry Pi 4 has limited support for USB Gadget mode, which is a lot more software support than exists today to cause Teensy's USB host port to run in device mode. If you try this path, I would recommend first using USB Gadget mode with the Raspberry Pi connected to one of your PC's host ports. You will have 2 challenges, first just making USB Gadget at all so your PC detects it as a USB device, and then also configuring USB Gadget to act as a USB disk drive (USB mass storage class). How to make USB Gadget work as a disk drive, I do not know. Hopefully Google can lead you to that info, if it exists. Again, get this working so your PC is able to see a USB disk drive appear. Only after you are certain USB Gadget is working and it really is a USB disk, then try connecting to Teensy USB host port and run examples like File > Examples > USBHost_t36 > Storage > ListFiles to access the Raspberry Pi USB Gadget disk drive.
 
Thanks Paul,

Yesterday I was going to mention about Gadget mode, but I know very little about it. I believe it might be better supported on RPI's that have a OTG USB port? Or at least sounded that way at some of the stuff I read.

Without that, I am not sure of any way to plug an RPI4 into the Teensy? That is I believe the USB-C connector on the RPI, is for power only, That is I don't believe the two signal wires are hooked up to anything.

Also the typical wall-warts that I have used to power an RPI4 output something like 2.5 amps at 5v to power the RPI4. So you would needs somehow to supply that current, not going through the Teensy.

So again not sure what to suggest. Now IF the Teensy is connected to the PC with USB and the RPI is connected using wired or wireless network, one option might be to have the RPI transfer the file to the PC over the network and then transfer the file over USB to the Teensy. But my guess is that would not match the usage pattern you want.

Or as mentioned, if you can hook up your Teensy to the network, you should be able to transfer that way.

Good luck!

EDIT: https://www.hardill.me.uk/wordpress/2019/11/02/pi4-usb-c-gadget/
Shows maybe the USB-C does have data lines... and how to configure to be gadget...
 
Last edited:
Now everything is very clear and I thank you very much for the explanation and the possibilities you have given me.
I have misinterpreted the first answers given and from there I went convinced on an impassable road.
Thanks again for your help.
 
Must admit, I also know almost nothing about Linux USB Gadget, other than it exists and probably only works on certain hardware. I tried a couple quick searches and didn't find any conclusive info about using Gadget for mass storage class.
 
Thinking a bit out of the box: You said you can't use the primary USB since you need that for uploading / debugging. So, what about using a simple USB switch like this:

https://www.amazon.de/KCEVE-Umschal...5&hvtargid=pla-1012252468782&psc=1&th=1&psc=1

You could connect one of the two lines to the RPi. and the other one to the PC. The output goes to the Teensy. For uploading FW you could simply switch to the PC, for running the sketch and debugging you would switch to the RPi.
In this scenario you can use a simple serial connection as you originally intended for the data transfer (or use Kurts solution). Additionally you can set up a second serial channel on the same USB connection for debugging (use USB mode 'double serial'). To display the debug messages you can then use a simple terminal on the RPi.
 
Back
Top