Forum Rule: Always post complete source code & details to reproduce any issue!
Page 1 of 5 1 2 3 ... LastLast
Results 1 to 25 of 108

Thread: TeensyTransfer

  1. #1
    Moderator Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany NRW
    Posts
    4,347

    TeensyTransfer

    Hi,

    TeensyTransfer grows, and i open this thread for further discussion and as a reference or "howto". I'll edit this inital post when changes or updates are made.

    TeensyTransfer is a utility which runs on Linux, Windows, and MAC. There is no graphical user interface, and it works on the commandline.
    Currently, it is able to access the Teensy-internal EEPROM, a serial connected SPI-FLASH, or a parallel connected SPI-Flash.

    https://github.com/FrankBoesing/TeensyTransfer

    Please switch to "Raw Hid" usb Mode (Arduino Menu) and run the example-code on the Teensy.

    The "extras" folder contains executables for Windows, Linux and MAC.

    - Version for Windows is inside *.zip
    - Version for Linux is inside *.gz
    - Version for MAC is inside *.mac.zip

    1. Teensy

    Print some info:
    Code:
    teensytransfer -i teensy
    Example:

    Model : Teensy 3.1/3.2 (MK20DX256)
    Serial: 156351
    MAC : 04:E9:E5:02:62:BF
    EEPROM: 2048 Bytes
    F_CPU : 96000000 Hz
    F_PLL : 96000000 Hz
    F_BUS : 48000000 Hz
    F_MEM : 24000000 Hz


    2. Teensy internal EEPROM
    There are two available commands:

    Write file to internal eeprom:
    Code:
    teensytransfer -w eeprom filename
    The contents of the file with the name "filename" are stored to the Teensy eeprom

    Read file from internal eeprom :
    Code:
    teensytransfer -r eeprom > file
    The contents of the eeprom are stroed to the file "file"


    3. SPI Flash (Prop Shield, Audio Shield,....)
    List files of serial flash:
    Code:
    teensytransfer -l
    Write file to serial flash :
    Code:
    teensytransfer -w filename
    Read file from serial flash :
    Code:
    teensytransfer -r filename > file
    Delete file from serial flash :
    Code:
    teensytransfer -d filename
    Erase chip :
    Code:
    teensytransfer -e
    Info:
    Code:
    teensytransfer -i
    Example:
    ID : EF 40 17
    Serial: D1 65 38 25 47 2C 19 2F
    Size : 8388608 Bytes


    4. Parallel connected SPI-Flash (Winbond only)

    This requires a special connection to the Teensy.

    Furthermore, you need the additional ParallelFlash library:
    https://github.com/FrankBoesing/ParallelFlash
    The connections are shown in the readme.

    Then, enable this line in TeensyTransfer.h:
    //#define _HAVE_PARFLASH //Parallel Flash

    List files:
    Code:
    teensytransfer -l parflash
    Write file to parallel connected spi-flash :
    Code:
    teensytransfer -w parflash filename
    Read file from parallel connected spi-flash :
    Code:
    teensytransfer -r parflash filename > file
    Delete file from parallel connected spi-flash :
    Code:
    teensytransfer -d parflash filename
    Erase chip :
    Code:
    teensytransfer -e parflash
    Info:
    Code:
    teensytransfer -i parflash

    5. ... ? SD? (not implemented, todo)

    Last edited by Frank B; 04-02-2016 at 10:27 PM.

  2. #2
    Moderator Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany NRW
    Posts
    4,347
    FAQ:

    Question:
    - I don't know if i have all needed updates of teensyduino (1.28b), and TeensyTransfer shows "Communication Error"s
    Answer:
    Here are compiled Hex-Files for the different teensy-models:
    https://github.com/FrankBoesing/Teen.../master/extras


    The files marked with "AUDIO" are special variants with :

    SPI.setSCK(14);
    SPI.setMOSI(7);

    (They work with the Audio-Shield or my FlexiBoard)


    Question:
    - How can i sort the output of -l ?
    Answer:
    Windows: To sort filesize: teensytransfer -l | sort . To sort filenames: teensytransfer -l | sort /+10



    Last edited by Frank B; 10-09-2016 at 06:26 PM.

  3. #3
    Moderator MichaelMeissner's Avatar
    Join Date
    Nov 2012
    Location
    Ayer Massachussetts
    Posts
    2,506
    As I use it, I think that teensytransfer should allow "-e" without a file name to erase the whole flash/EEPROM/etc.

    Perhaps moving "-e file" to "-d file" for delete, and allow "-e" just to erase all of the memory.

    It would be handy if teensytransfer could report the amount of space used and the amount of space available on the Teensy.

    In case of hangs, etc. it would be useful if teensytransfer could indicate packets being transfered (perhaps by emitting a '.' for each packet).

    I could imagine wanting to link the library with my application, so that I wouldn't have to reflash the Teensy to load new sounds, but instead I could have a pin that if held HIGH would put me into teensytransfer mode during program startup, otherwise continuing with my program.

  4. #4
    i wrote a bat script to auto upload all files in a folder, might be handy for doing alot of files in once.
    teensytransfer.zip

    note: this is my first bat script i ever made, so it might a little messy :P
    note2: windows only
    Last edited by pix-os; 04-01-2016 at 10:24 AM.

  5. #5
    Moderator Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany NRW
    Posts
    4,347
    Quote Originally Posted by MichaelMeissner View Post
    Perhaps moving "-e file" to "-d file" for delete, and allow "-e" just to erase all of the memory.
    Good point. It'll be in the next release

    Quote Originally Posted by MichaelMeissner View Post
    It would be handy if teensytransfer could report the amount of space used and the amount of space available on the Teensy.
    Yes, you're right. Unfortunately te SerialFlash library does not provied such functions (or i hav'nt seen them?)

    Quote Originally Posted by MichaelMeissner View Post
    In case of hangs, etc. it would be useful if teensytransfer could indicate packets being transfered (perhaps by emitting a '.' for each packet).
    In theory, it should'nt ever hang. It uses timeouts (max 500ms) in all functions. But you're right, the "." are a good idea anyway. But it is not possible for reading files.

    Quote Originally Posted by MichaelMeissner View Post
    I could imagine wanting to link the library with my application, so that I wouldn't have to reflash the Teensy to load new sounds, but instead I could have a pin that if held HIGH would put me into teensytransfer mode during program startup, otherwise continuing with my program.
    You can do that. Just call transfer() when the pin is held HIGH only.
    The PC utility will print a "Communication error" on STDERR if transfer() doesnt answer after ~100ms.

  6. #6
    Posted by MichaelMeissner:
    It would be handy if teensytransfer could report the amount of space used and the amount of space available on the Teensy.
    Yes, you're right. Unfortunately te SerialFlash library does not provied such functions (or i hav'nt seen them?)
    it would be usefull to have a check if the file is too large for the free space on the flash ic.

  7. #7
    Moderator Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany NRW
    Posts
    4,347
    Quote Originally Posted by pix-os View Post
    i wrote a bat script to auto upload all files in a folder, might be handy for doing alot of files in once.
    Thanks But the .exe in your attached zip file will soon be old..

    Quote Originally Posted by pix-os View Post
    it would be usefull to have a check if the file is too large for the free space on the flash ic.
    Yes.
    Now, it returns an error during upload (well, in theory..did'nt test it)
    Last edited by Frank B; 04-01-2016 at 10:51 AM.

  8. #8
    The change to -d makes sense, I would say to erase "-e ERASE" would help prevent parameter confusion from wiping the whole of the flash/eeprom - while you had 19 long seconds to see the typo.
    Also given the EEPROM is fully addressable - erasing or dumping parts - even halves - could increase the utility. Also perhaps a 'copy EEPROM file_xyz' feature could write the 2K contents to a file on the flash? And maybe the reverse as well - this could facilitate Automated testing or a state machine - and perhaps not need Raw_HID with public functions as it is internal.

  9. #9
    @frank removed the exe file from the zip

  10. #10
    Senior Member fms1961's Avatar
    Join Date
    Jul 2015
    Location
    Northern Germany
    Posts
    147
    If you need a Mac developer - here I am ...
    Will we use the tool together with the TCD-Editor?

  11. #11
    Senior Member mortonkopf's Avatar
    Join Date
    Apr 2013
    Location
    London, uk
    Posts
    804
    @fms1961, RE Mac -that would we cool. not sure if I will get to it this weekend...

  12. #12
    Moderator Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany NRW
    Posts
    4,347
    Quote Originally Posted by mortonkopf View Post
    @fms1961, RE Mac -that would we cool. not sure if I will get to it this weekend...
    i think, i have the new features tomorrow evening (German time) done..

    I add an "-i" switch for information about the devices, too... (perhaps not so much for serFlash - depends on a pullrequest... )

    a leak:
    Code:
    C:\teensytransfertool>teensytransfer teensy -i
    Model : Teensy 3.1/3.2 (MK20DX256)
    Serial: 64102
    MAC   : 04:E9:E5:00:FA:66
    EEPROM: 2048 Bytes
    F_CPU : 144000000 Hz
    F_PLL : 144000000 Hz
    F_BUS : 48000000 Hz
    F_MEM : 28800000 Hz
    The only thing to be done is a compile on mac.
    Last time blackketter was so kind to do it - any volunteers ?

    The sourcecode is on github.
    A minor edit to the makefile is needed.

    Can someone explain how i can do this myself on ubuntu ? Is that possible ?
    Last edited by Frank B; 04-01-2016 at 05:51 PM.

  13. #13
    Senior Member fms1961's Avatar
    Join Date
    Jul 2015
    Location
    Northern Germany
    Posts
    147
    Quote Originally Posted by Frank B View Post
    The only thing to be done is a compile on mac.
    Last time blackketter was so kind to do it - any volunteers ?
    I thought I offered my support with my last post ... Xcode is up to date ... so tell me what to do ... (perhaps via e-mail in German, this will be way faster ...)

    Quote Originally Posted by Frank B View Post
    Can someone explain how i can do this myself on ubuntu ? Is that possible ?
    I quote an exerpt from stackoverflow:

    For Linux, there is a prebuilt GCC cross-compiler (from publicly available Apple's modified GCC sources).

    Update for 2015

    ...
    For all these options you still need a real mac/i-device to test the application.
    Last edited by fms1961; 04-01-2016 at 05:58 PM.

  14. #14
    Moderator Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany NRW
    Posts
    4,347
    Ok, thats the compiler. Thanks!. Do i need any additional libraries ?

    You have mail

  15. #15
    Moderator Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany NRW
    Posts
    4,347
    I've merged a new compiled version for MAC, from FMS (THANK YOU!)

    There was a Warning:
    hid_MACOSX.c:197:3: warning: "Send timeout not implemented on MACOSX" [-W#warnings]

    this can lead to problems, if the teensy is not reachable. But normaly, it should work.

    Last edited by Frank B; 04-01-2016 at 08:05 PM.

  16. #16
    Moderator Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany NRW
    Posts
    4,347
    The new update is available

    Important:
    - Please update your version of SerialFlash: https://github.com/PaulStoffregen/SerialFlash
    - Please use the new example code. The lib does not initialize the devices!

    New:
    - -i gives some info (see first post)
    - To delete a file, use -d
    - To erase the whole flash, use -e

    On the Teensy, erasing flash is a not-blocking operation, so your sketch can run while the flash is erasing.
    You can use the SerialFlash.ready() function to check wether the flash is busy or not.

    The PC prints a row of "." during that time.

    For writing files, "." are printed every 4096 written bytes (+one at start). (@Michael, printing for every packet was a bit tooo much )
    Last edited by Frank B; 04-02-2016 at 08:17 PM.

  17. #17
    AFAIK I just pulled the latest properly and got this:
    C:\tCode\libraries\TeensyTransfer\TeensyTransfer.c pp:328:2: error: 'ParallelFlash' was not declared in this scope

    ParallelFlash.readID(id);
    The sample might commnet RAW_HID needed :: To make a USB RawHID device, use the Tools > USB Type menu

  18. #18
    Moderator Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany NRW
    Posts
    4,347
    Quote Originally Posted by defragster View Post
    AFAIK I just pulled the latest properly and got this:


    The sample might commnet RAW_HID needed :: To make a USB RawHID device, use the Tools > USB Type menu
    Thank you Tim, it was a copy&paste error.. Its fixed.

    Tim, it prints a message, if RawHid is not selected.
    Code:
    C:\Users\Frank\Documents\Arduino\libraries\TeensyTransfer/TeensyTransfer.h:46:2: error: #error To make a USB RawHID device, use the Tools > USB Type menu
    
     #error To make a USB RawHID device, use the Tools > USB Type menu
    But you're right, i add the comment.

  19. #19
    Frank: not sure where I can get your fix? Yeah in my post that text is the 'message' from the compiler - thought a comment in the code might save a re-compile.

  20. #20

  21. #21
    Senior Member Wozzy's Avatar
    Join Date
    Jan 2013
    Location
    Philadelphia, Pennsylvania USA
    Posts
    307
    Frank,

    This is a great tool, Thanks
    I was able to try each transfertool option successfully to the Prop Shield serial flash from my Windows 10 PC.
    I noticed though that when I wrote a file then read it back I had the following issue.
    • A .wav file was nearly twice as large and corrupted.
    • A .txt file was also much larger, but readable.


    I haven't tried to use the files on the Prop Shield yet.

    Here are the original files and the files copied back: TeensyTransferTestFiles.zip
    I'm using the Serial Flash from yesterday, Arduino 1.6.8 and Teensyduino 1.28b1
    Last edited by Wozzy; 04-02-2016 at 11:46 PM.

  22. #22
    Thanks Frank - I wanted to get a fresh build to confirm - this is all I get running the sketch on my T_3.2 w/Prop shield against the teensytransfer.exe I have::

    C:\tCode\libraries\TeensyTransfer\extras>teensytra nsfer.exe -l
    teensytransfer: Communication error
    I pulled the copy from the github too.

  23. #23
    Moderator Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany NRW
    Posts
    4,347
    Quote Originally Posted by Wozzy View Post
    Frank,

    This is a great tool, Thanks
    I was able to try each transfertool option successfully to the Prop Shield serial flash from my Windows 10 PC.
    I noticed though that when I wrote a file then read it back I had the following issue.
    • A .wav file was nearly twice as large and corrupted.
    • A .txt file was also much larger, but readable.


    I haven't tried to use the files on the from the Prop Shield yet.

    Here are the original files and the files copied back: TeensyTransferTestFiles.zip
    I'm using the Serial Flash from yesterday, Arduino 1.6.8 and Teensyduino 1.28b1
    Hmm..
    Can anyone confirm this ?

    Can you try the latest version please and delete the chip first ?

    I had no corrupted files, but perhaps it helps to update. There were updates for SerialFlash, too.

  24. #24
    Moderator Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany NRW
    Posts
    4,347
    Tim: does it help to remove power from the teensy first ?
    Perhaps the flash is in a fault state.

  25. #25
    I had done that earlier - on your post I did:: RawHardwareTest {failed as it was not erased}, ERASE, RawHardwareTest, ERASE and all worked - then I get the same with "teensytransfer.exe -l" again? And power cycle - then the same failure.

    Are the default build flags all set right for T_3.2 w/Prop shield?

    Code:
    Raw SerialFlash Hardware Test
    
    Read Chip Identification:
      JEDEC ID:     EF 40 17
      Part Nummber: W25Q64FV
      Memory Size:  8388608 bytes
      Block Size:   65536 bytes
    
    Reading Chip...
      Previous data found at address 0
      You must fully erase the chip before this test
      found this: 4C 55 96 FA 58 02 F6 18 
         correct: 00 00 00 00 15 F5 95 4B 
    
    Tests Failed  :{
    
    The flash chip may be left in an improper state.
    You might need to power cycle to return to normal.
    Flash Memory has 8388608 bytes.
    Erasing ALL Flash Memory:
      estimated wait: 20 seconds.
      Yes, full chip erase is SLOW!
    ..................
    Erase completed
      actual wait: 19 seconds.
    
    Double Checking All Signatures:
      all 4096 signatures read ok
    
    Checking Signature Pairs
      all 2047 signature pairs read ok
    
    Checking Read-While-Write (Program Suspend)
      write 256 bytes at 256
      write time was 442 microseconds.
      read-while-writing: 00 00 00 00 15 F5 95 4B 
      test passed, good read while writing
    
    Checking Read-While-Erase (Erase Suspend)
      erase time was 159478 microseconds.
      erase correctly erased 65536 bytes
      read-while-erasing: 00 00 00 00 15 F5 95 4B 
      test passed, good read while erasing
    
    All Tests Passed  :-)
    
    Test data was written to your chip.  You must run
    EraseEverything before using this chip for files.
    Flash Memory has 8388608 bytes.
    Erasing ALL Flash Memory:
      estimated wait: 20 seconds.
      Yes, full chip erase is SLOW!
    ..................
    Erase completed
      actual wait: 19 seconds.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •