USB serial to Teensy flash to I2C EEPROM?

Status
Not open for further replies.

onehorse

Well-known member
I have several applications where I need to load an on-board I2C EEPROM connected to a Teensy 3.1 with data from a laptop. I currently load a file onto an SD card on the laptop, then use an SD card reader on the Teensy 3.1 to read the file then write the file via I2C to the on-board EEPROM atteched to the Teensy. It works but it is a bit clunky.

Would it be possible to let the Teensy 3.1 do the file transfer by writing from the laptop file to the Teensy flash memory, then transferring the Teensy flash memory contents to the on-board EEPROM using the Teensy flash memory as a sort of buffer for file writing?

I am sure this has been discussed to death on the forum and I am also pretty sure the answer is no.

But the issue keeps recurring in my work so I thought I would just ask again!
 
Off hand I would say, you would want a serial transfer protocol program that you run on the host, and you run a stripped down receiver program on the teensy that writes the EEPROM as it collects the data. In the distant past when I was doing serial transfer, kermit was one of the main applications. The original kermit has morphed into the new open-source kermit: http://www.kermitproject.org/, but works seems to have stopped around 2011. There is a C-kermit, which attempts to configure and run on just about any system (at least in the past), and E-kermit which a set of modules to use in an embedded processor.

In 2012, there was this discussion about porting zmodem to teensy (but further work seems to have been halted): https://forum.pjrc.com/threads/26646-Zmodem-transfer-from-Teensy-to-PC
 
Kermit, xmodem, ymodem, zmodem were common protocols in the acoustic-coupler/modem mailbox-era (...that ancient time before the internet..;-) Hey, does anyone remember "FRODO", the FIDO-NET "point" software ? i wrote some shareware -tools for it, in "turbo pascal")

These protocols were pretty good, had crc-checks and so on.

Are there still nowadays tools that understand this protocol ? On linux the chances are higher, i would think.
It would be great if there was a commandline-tool that is able to speak "zmodem".
Great for blutooth and other serial connections too.

On the other hand, there were plans to support usb-storage on the Teensy 3.x

If
- commandline-tools exist for the PC-Side for WINDOWS/LINUX/MAC, and
- Pauls says the USB Storage support is delayed for..lets say several month to a year,

I could write a lib for the teensy. Its not too complicated.
 
Last edited:
Thanks for the replies.

I really have no idea what kermit or zmodem are/do.

Frank, if there is sufficient interest (beside me, I mean) maybe you would be performing a great community service by writing such a library for the Teensy.
 
At the simplest, kermit, {x,y,z}modem are programs that you run on two sides of a serial communication channel, such as serial lines with the ancient 25 pin (DB-25) and more recent 9 pin (DB-9) connections that used to come on personal computers. You would run a program on the sender system and the same program on the receiver system. Or for embedded systems, you might run a stripped down receiver program to save space. The sender system could either just allow you to type normally, or you could have it send a file. The sender would encode the file, add error correction checksums, and send small amounts of the file, and wait for the receiver to acknowledge receiving the information, before it would send the next set of bytes. Because serial communications channel of the day were 7-bit ascii, and special characters did things (like convert tabs into spaes), the sender would typically encode the file so that only printable characters + newline were used.

For sending plain text, I have in the past just sent the text as is, and hoped for the best. Sometimes it would work, sometimes not. It helps if there is hardware flow control on each side of the serial connection. If not, I've had to turn the baud rate down to avoid buffer overflows. I also have a perl script that would put an arbitrary pause at the end of each line.
 
Last edited:
Realterm has functionality to send 'any file' over any serial connection you establish with it, assuming you can stand to use Windows coz I haven't seen a Linux port; should probably admit that I haven't tried to find it for Linux because practically everything I've ever actually done with it isn't anywhere near as difficult (in BASH, command line) as I found github command line stuff last time I tried anything slightly more advanced than cloning with it.

Receiver sketch on Teensy is probably best off to buffer the data to EEPROM, what I mean by this is to set aside a char/byte array as near to the largest set of date you intend to pass in one hit because I am not sure EEPROM can be written fast enough to keep up if you try to byte for byte it into there - maybe I am wrong about that, I haven't really looked at EEPROM write speed that closely.
 
Last edited:
Would it be possible to let the Teensy 3.1 do the file transfer by writing from the laptop file to the Teensy flash memory, then transferring the Teensy flash memory contents to the on-board EEPROM using the Teensy flash memory as a sort of buffer for file writing?

I am sure this has been discussed to death on the forum and I am also pretty sure the answer is no.

I'm pretty certain the answer isn't strictly "no", but rather a matter of the amount of software development required!

A key concern is usability. Certainly it's possible to build a technically working file transfer mechanism that's impractical for casual usage. While I know some people still love Kermit, I'm going to go out on a limb here by suggesting those serial file transfer protocols from the 1970's and 1980's have terrible usability. Even though they work in a technical sense, they're certainly a lot more trouble than the "bit clunky" process of copying a file to a SD card, then physically putting the SD card into your Teensy.

At the moment, this isn't a project I can take on. But I do have MTP on my radar as a USB type I'm going to (eventually) add to Teensyduino. When that exists, it should become fairly easy to build a less clunky way to do this....
 
Hi Frank.

If I wanted to load a file from an SD card into an array in TeensyFlash what would be the best way to do it. I need to save a BMP from th SD Card, but have the option to load a different one when I need it.

Marc
 
Use Pauls teensy USB lib to download the file. It is extremely easy to use and FAST. you could download a file and pass it onto the i2c eeprom in seconds using a simple app on you pc.
 
Status
Not open for further replies.
Back
Top