Forum Rule: Always post complete source code & details to reproduce any issue!
Page 5 of 5 FirstFirst ... 3 4 5
Results 101 to 119 of 119

Thread: K64 Beta Test :: Teensy 3.5

  1. #101
    Senior Member
    Join Date
    Jan 2013
    Posts
    843
    Quote Originally Posted by ninja2 View Post
    1) how can I (soft) reset a teensy when it's PC connected?
    The easiest way is to use TyQt, there is a GUI and a command line version:
    https://forum.pjrc.com/threads/27825-Teensy-Qt

  2. #102
    Senior Member ninja2's Avatar
    Join Date
    Aug 2016
    Location
    Adelaide, Australia
    Posts
    151
    OK thanks ... I guess I've gotta bite that bullet.
    Bit of a learning curve and some work to do though, I don't have cmake or much familiarity with it ... yet

  3. #103
    Senior Member
    Join Date
    Apr 2013
    Posts
    1,899
    Reseting a Teensy if you have code running is
    https://forum.pjrc.com/threads/24304...ll=1#post35985
    Still leaves the question of getting logic that reboots at the time you are actually wanting to see. Other option is to have a shell type code running that responds to serial commands received and returns status information, including maybe something that does actually trigger a soft reboot.

    One tool I've found very handy for debug is a 3.3 compatible (or butchered 5V) FTDI cable on Teensy Serial1. Means Serial port remains during programing/reboot, and leaves the USB serial free for whatever your application is sending on it without debug clutter.

    Do not believe there is a schematic yet, there are for other Teensies so would assume one will show up in due course.

  4. #104
    Senior Member
    Join Date
    Apr 2016
    Location
    St. Petersburg, FL
    Posts
    149
    Here's the adapter I use for Pro Mini programming and T32 linking to a PC. That link runs at 2.25Mbps.

    http://www.ebay.com/itm/usb-FTDI-Bas...EAAOxyXp5SRY0w

    It has a jumper for 3v3 or 5v0 operation, all the serial signals on one side, and some of the chip I/O pins on the other.

  5. #105
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    5,416
    1) Not sure if there are any official ways to reboot the Teensy 3.5/3.6. I have seen some threads showing ways for earlier boards. But there are probably many ways to get the board to reset. I know as I hit several when trying to add support for some new features during the beta. Example, suppose your program is not using Serial5 and as such you have not enabled the access to the memory associated with the registers for UART4 by doing: SIM_SCH1 |= SIM_SCG1_UART4; (Which is done internally to all of the Serial4 commands), just try to access any of the registers like: UART4_C1 = 0;
    And the processor will hit a memory fault and reboot... Probably not the cleanest method...

    2) I do not believe the Schematics have been released yet. But it is my assumption is that they will be, probably reasonably soon (within the next few months), as he has released the schematics of all of the previous boards.

  6. #106
    Senior Member ninja2's Avatar
    Join Date
    Aug 2016
    Location
    Adelaide, Australia
    Posts
    151
    thanks for all the suggestions. I think I need to invest in TyQt.

    Because teensy does not reset when Serial Monitor is restarted, the only method I have so far is to recompile and upload the same code ... seems a bit weird to me.

    If I use a FTDI adapter into Serial1, how does teensy know new code is now uploaded via Serial1?
    (Is the USB port called Serial0?)

  7. #107
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany NRW
    Posts
    5,679
    Quote Originally Posted by ninja2 View Post
    thanks for all the suggestions. I think I need to invest in TyQt.

    Because teensy does not reset when Serial Monitor is restarted, the only method I have so far is to recompile and upload the same code ... seems a bit weird to me.
    Why not ?
    If you don't like it, you can add a reset-button.

    Quote Originally Posted by ninja2 View Post
    If I use a FTDI adapter into Serial1, how does teensy know new code is now uploaded via Serial1?
    It does not know it - because..it is not possible. Upload is USB only.
    Quote Originally Posted by ninja2 View Post
    (Is the USB port called Serial0?)
    No. Serial. (<-- no number)

  8. #108
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    9,679
    USB is Serial.
    Code is only uploaded to Teensy via USB - while the Teensy is Offline in Program Mode - using a USB cable HID protocol.
    The Teensy with active USB can be put into Program Mode using USB mechanism - as done by IDE or TYQT.

    Indeed get TYQT - 7.5-210 is the latest I see and I've been using it on the T_3.6/T_3.5 like on prior Teensys to good effect.:: files/koromix/ty
    TYQT can conflict with TeensyDuino - Teensy.exe. I've been using the Tools / Integrate to Arduino and close Teensy.exe.
    If can RESET or UPLOAD to one or more connected Teensys under program control.

  9. #109
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany NRW
    Posts
    5,679
    don't know if it would be useful - i could image a short routine that checks for DTR high to DTR-lo transition (with Serial.dtr() ) and resets the teensy.
    (DTR means "DATA TERMINAL READY")

    On the other hand... that would mean that your teensy restarts every time when you close the monitor. Do you want that ??? Are the other Arduinos doing that ? (I don't know,.. don't have one. Sounds annoying.)
    Last edited by Frank B; 10-17-2016 at 08:59 PM.

  10. #110
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany NRW
    Posts
    5,679
    Code:
    /* Reset on dtr high -> dtr lo
     *  
     * Frank B 16/10/17
     */
    
    void resetWhenTerminalStops() {
      static int8_t stateOfDtr = 0;
      if (stateOfDtr==0 && Serial.dtr()) stateOfDtr=1;
      else 
      if (stateOfDtr==1 && !Serial.dtr()){
        SCB_AIRCR = 0x05FA0004; // software reset
      }
    }
    
    
    void setup() {
      // put your setup code here, to run once:
      while(!Serial);
      delay(100);
      Serial.println("R E S E T");
    }
    
    void loop() {
      // put your main code here, to run repeatedly:
      resetWhenTerminalStops();
    
      //Do something useful
      delay(100);
      Serial.println("Running");
    }
    Have fun with it..

    use it or not.. :-)

    edit: Played a bit with it.. it IS annyoing..
    Last edited by Frank B; 10-17-2016 at 10:26 PM.

  11. #111
    Senior Member ninja2's Avatar
    Join Date
    Aug 2016
    Location
    Adelaide, Australia
    Posts
    151
    wow the ideas just keep on flowing ...

    I'm happy to dive into TyQt or add a RESET button myself, but in case I'm actually doing something wrong here's how my teensy works using the IDE + teensyduino. It should explain why I've been asking how to RESET:

    1) Say I'm developing a sketch and I've uploaded it to the teensy and it runs, almost always I have it reporting to the Serial Monitor (SM) ... all good so far.

    2) Of course I spot a bug or somethiing I want to improve so I edit the sketch and upload. The SM has not been closed, but after the sketch is uploaded SM does not report anything unless I restart it.

    3) If I restart SM soon enough after upload it will show all expected outputs from start of sketch / setup(). But it's tricky, I often loose first few feedback lines if I'm not quick enough.

    4) If I'm debugging sketch startup / setup() then only choice is to recompile & upload again & try to open SM real quick to catch first few lines of feedback.

    5) Whereas If I was using Uno/Mega/Due I would just hit reset button whilst SM was open, and see everything on SM from t = 0 onwards ...

  12. #112
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    5,416
    The Teensy like some of the other Arduinos like Leonardo, have the USB as part of the actual processor and as such, yes the Serial port may go away when you upload a new program to your processor

    So you have Serial.print statements right at the start of your program, you can miss some.

    Which is why, a lot of us add code like:

    while (!Serial && (millis() < 5000)) ;

    At the start of our program, usually then add the Serial.begin() and then maybe a short delay, for everything to stabilize.

  13. #113
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    9,679
    Like this provides 5 seconds to get Serial Monitor on USB connected - Teensy is typically ready in under 2 seconds when the SerMon is:
    Code:
      Serial.begin(38400);
      while (!Serial && (millis ()  <= 5000)) ;
      Serial.println("Hello World");
    TYQT is a joy and makes Teensy Better. Unzip to a directory on Windows - unblock - and run TYQT.exe .

  14. #114
    Senior Member ninja2's Avatar
    Join Date
    Aug 2016
    Location
    Adelaide, Australia
    Posts
    151
    yep my sketches already include that !Serial code (as discussed a little earlier in this loo...oong thread) .. although I do need to add it to my latest sketch.

    Anyway I'm sold by all the enthusiasm for TYQT (TyQt?) so I'm heading that way as soon as I can. cheers++
    Last edited by ninja2; 10-18-2016 at 03:38 AM.

  15. #115
    Senior Member ninja2's Avatar
    Join Date
    Aug 2016
    Location
    Adelaide, Australia
    Posts
    151
    In absence of schematics I was wondering if there is a built in pull-up resistor on the reset (RST) input pin/hole to T3.5/3.6
    If these are at all similar to T3.2 that schematic shows no pull up fitted.

  16. #116
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany NRW
    Posts
    5,679
    ninja2 i've stopped counting how often you mentioned that you want to see the schematic. I guess, we all noticed it, now.

    Edit: And i hope that more important things are on Pauls TODO

  17. #117
    Senior Member ninja2's Avatar
    Join Date
    Aug 2016
    Location
    Adelaide, Australia
    Posts
    151
    Sorry not meaning to hassle, and I'm quite OK with waiting.
    But please don't under estimate how much information a schematic transfers. software is not the solution to everything
    Just one example: it would answer my question about whether there is a pull up on reset line or not
    Last edited by ninja2; 10-18-2016 at 10:38 AM.

  18. #118
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany NRW
    Posts
    5,679
    There must be a pullup somewhere otherwise the pin would be floating and erratically reset the teensy.
    Logic.

    Edit: it's inside the chip, if there is no external resistor.
    Last edited by Frank B; 10-18-2016 at 10:23 AM.

  19. #119
    Senior Member ninja2's Avatar
    Join Date
    Aug 2016
    Location
    Adelaide, Australia
    Posts
    151
    true, maybe inside the K64 / K66 chips?
    I should just wire in a pushbutton to ground and see what happens.
    Last edited by ninja2; 10-18-2016 at 10:37 AM.

Posting Permissions

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