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

Thread: How does Teensy-Reboot.exe communicate ?

  1. #1
    Senior Member
    Join Date
    May 2015
    Posts
    115

    How does Teensy-Reboot.exe communicate ?

    Hello Paul

    I want to write an automatic Firmware uploader.
    I start Teensy.exe, then teensy_reboot.exe.

    But the information I need is how teensy_reboot.exe informs the Arduino IDE of success or failure.

    If the reboot was not successfull the IDE prints:

    Code:
    Teensy did not respond to a USB-based request to automatically reboot.
    Please press the PROGRAM MODE BUTTON on your Teensy to upload your sketch.
    How does the IDE know that ?
    The exit code of the teensy_reboot.exe process is always zero.

  2. #2
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    20,328
    Quote Originally Posted by Elmue View Post
    How does the IDE know that ?
    This info comes from Teensy Loader.

    A localhost connection to repeatedly query whether Teensy Loader has seen the device. Use Help > Verbose Info in Teensy Loader to get a view of this communication. Or you could use TCP/IP snooping tools to monitor the localhost connection. It's simple ascii-based communication. The important point is Teensy Loader is responsible for detecting when a Teensy appears in bootloader mode. Other program query it.

  3. #3
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    9,074
    Koromix figured it out in open code TYQT if you can't see it in the PJRC provided details Koromix used, maybe you can see it in his.

  4. #4
    Senior Member
    Join Date
    May 2015
    Posts
    115
    Hello Paul

    Thanks for the answer.
    But sadly it is lacking any details.

    It seems to me that PJRC is not willing to publish details about the Teensy tools.
    I saw a request for the source code of these tools here in the forum 2 years ago that has never been answered by you.
    https://forum.pjrc.com/threads/26321...sy_reboot-quot


    Please think that there are people who use Teensy not just for playing around.
    I use Teensy in a professional hardware that is used in many countries.
    I do not want to tell my clients that they have to read a manual how to use PJRC tools.
    I want to offer them a single button in my GUI to program a Teensy and therefore I need more details.
    I have to know if programming was successful or not.


    > A local host connection.

    To which port ?
    In TCPView I see that it opens port 3149.
    Is this a fix port that is always used ?

    In the verbose window I see the commands:
    "auto: on"
    which probably presses the green "Auto" button.

    and then lots of
    "status"
    commands which probably request the programming result.

    But what strings does the Teensy loader return on the "status" request?

    I tried to capture with a packet sniffer but it does not capture local host connections.
    In the code of Koromix I cannot find answers to these questions.

    It would be all so easy if teensy_reboot would return an exit code of 0 if it failed and an exit code of 1 if programming was successful!
    In C / C++ this is the return value of the main() function or you call ExitProcess() directly: See MSDN


    After establishing a connection to port 3149 I found out that all ascii commands are ignored if they do not end with a linefeed.

    When the Teensy does not respond a programming request (because it was compiled with USB Type: No USB) the communication looks like this:


    Sending 7 Bytes to Server (127.0.0.1):
    'status\n'

    Received:
    'dir:E:\Hardware\Firmware\
    file:Sketch.hex
    readable:1
    auto:1
    online:0
    online_count:0
    offline_count:0
    state:0
    code_size:262144
    EOT
    '



    And when the programming was successfull (after pressing the button on the board):

    Sending 7 Bytes to Server (127.0.0.1):
    'status\n'

    Received:
    'dir:E:\Hardware\Firmware\
    file:Sketch.hex
    readable:1
    auto:1
    online:0
    online_count:1
    offline_count:0
    state:0
    code_size:262144
    EOT
    '


    So I deduce that online_count:1 means that the programming was successfull ?

    What does all this stuff mean ?

    state:0
    readable:1
    online:0
    online_count:0
    offline_count:0
    Last edited by Elmue; 10-26-2016 at 03:16 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
  •