Serial File Transfer

Status
Not open for further replies.

bvernham

Well-known member
I am looking for a way to transfer files to and from a Teensy4.1 and basic file management. I will do this "offline" when the Teensy is not being bombarded with lots of CAN data X3. I have seen ZModem with File management but it looks abandoned years ago and needs tons of updates for the latest SDFat. I would be all for doing the work but not so many comments so you need to be a crypto expert to figure out what the author was trying to do.

I don't want to lose the ability to use the USB for runtime debug and error output and so on.

Any thoughts on other available libraies?

Eventual the application will be hidden away in a vehicle so only the USB port will be exposed for data/configuration managment.

Thanks

Bruce
 
One method is to use RawHID, which allows you to run a custom program on your PC that can talk to the Teensy:

I've seen threads talk about combining the new file storage stuff in 1.54 beta along with support for making a USB removable disk, so you can just attach the Teensy to the USB and access all of its files.
 
So I still want to use the USB for debug/status via USB when the system is receiving CAN data and be able to monitor basic system activity.

MTP disk precludes serial communications.

Same issue with rawhid has same issue. Also need to create an application.

I looked at
and was willing to pay $$$ for it but again they do not support real file transfer except a "file dump" which does not help with upload.

That is why I thought zmodem was a good option but needs to be dug out of obscurity.

Thanks for your response

Bruce
 
Can you share a sample sketch? When I flashed my serial as MTP I could not connect to the serial monitor. Any guidance on using mtp? I looked online but there is very little mentioned except it is "experimental".

Thanks

Bruce
 
PS I am running Arduino IDE 1.8.15 and Teensyduino 1.5.4 Beta 9 so I am interested to understand what Teensy4,1 core changes are necessary.

I did find the github page but I am not sure what is implement in i1.5.4 beta 9 vs what is necessary to get MTP disk working.

Thanks

Bruce
 
PS I am running Arduino IDE 1.8.15 and Teensyduino 1.5.4 Beta 9 so I am interested to understand what Teensy4,1 core changes are necessary.
-download https://github.com/WMXZ-EU/MTP_t4 and put it into local libraries.
-modify the TD files using the content of the cores3/cores4/avr modification files (copy content to appropriate locations).

Modifications can be skipped if instead of Serial you are using Seremu, which works with Teensy monitor (and Linux).
I only use Serial.

It says (experimental) until Paul finds time to work on MTP and hopefully MTP-Serial in integrated in TD.
 
Seremu, which works with Teensy monitor (and Linux).

Unfortunately I am one of those heathen Windows people so I need to modify the cores as in the GitHub Page?

When I flash the code to I select MTP in the Serial drop down?

Thanks for the help.

Bruce
 
What I did right now was
compiled mtp-test.ino (latest download) with "MTP_DISK (Experimental)" and uploaded it (here for 3.5, should work for other teensies)
The Teensymonitor was showing nothing, as it should, as it waits for any key press (mtp-test was programmed this way)
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)
  #endif
  Serial.println("MTP_test");
After pressing key all worked as expected, and MTP disk showed up in windows

conclusion: MTP works nor only with Serial, but also with SEREMU (but we knew that)
 
This was recently posted on the 1.54 beta 10 thread:

The above post contains the text for updating hardware/teensy/avr/boards.txt to have an option MTP + Serial. Without the option, it uses Serumu to emulate the serial terminal that the IDE can understand. With the option for MTP + Serial, your serial connections would go to a normal USB serial connection that other tools can read/write.
 
Code:
teensy41.menu.usb.mtp=MTP Disk (Experimental)
teensy41.menu.usb.mtpserial.build.usbtype=USB_MTPDISK_SERIAL
teensy41.menu.usb.mtp.fake_serial=teensy_gateway

I added the above based on the below but I is not changing the selections in the menu.

What am I missing? Thanks Bruce

Code:
menu.usb=USB Type
menu.speed=CPU Speed
menu.opt=Optimize
menu.keys=Keyboard Layout


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

teensy41.name=Teensy 4.1
 
Code:
teensy41.menu.usb.mtp=MTP Disk (Experimental)
teensy41.menu.usb.mtpserial.build.usbtype=USB_MTPDISK_SERIAL
teensy41.menu.usb.mtp.fake_serial=teensy_gateway

I added the above based on the below but I is not changing the selections in the menu.

What am I missing? Thanks Bruce
you changed the usb type but not the string that shows up on tools menu
Anyhow, better not to change existing entries but to add the new entries, as explained in readme on github
 
Status
Not open for further replies.
Back
Top