Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 21 of 21

Thread: C# Library for Uploading Firmware from User Applications

Threaded View

  1. #1
    Senior Member
    Join Date
    Apr 2014
    Location
    Germany
    Posts
    1,623

    C# Library for Uploading Firmware from User Applications

    Hello all,

    I'm currently working on a commercial project which will include a Teensy 3.1. As discussed a few times in the forum for many applications it is desirable to upload new firmware from within windows applications. I therefore wrote a little easy to use C# library which handles uploads to Teensy boards. For the protocol I used the algorithms from the Teensy_Loader_CLI. Communication with the board is done via Mike O'Brians HIDLibrary (https://github.com/mikeobrien/HidLibrary). The lib is published it at GitHub (https://github.com/luni64/TeensySharp, VS2013 Solution).

    The usage is quite simple. Below you find some pseudo code showing the idea. A working test app is included in the repo
    Code:
                        
    var Board = PJRC_Board.Teensy_31;  // all boards implemented but only Teensy 3.1 tested so far           
    var FlashImage = SharpUploader.GetEmptyFlashImage(Board);  //Get an empty flash image with the correct size and all bytes cleared (i.e. set to 0xFF)    
    
    // Open the hex file, parse it and write the result into the image file
    var HexStream = File.OpenText(testfile);
    SharpHexParser.ParseStream(HexStream, FlashImage);    
    
    // Upload the image to the board and reboot
    int result = SharpUploader.Upload(FlashImage, Board, reboot: true);
    The Lib works nicely for T3.1. I don't have other Teensies so I couldn't test it for those boards. Any feedback, test results and improvement suggestions welcome

    Have fun
    Lutz
    Last edited by luni; 07-01-2015 at 08:56 PM.

Posting Permissions

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