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

Thread: Restart sketch Teensy 3.6

  1. #1
    Junior Member
    Join Date
    Nov 2019
    Location
    London
    Posts
    11

    Restart sketch Teensy 3.6

    Hi,
    I am working on data logging using T_3.6, powered by external batteries.
    The code will flow into loop of LED blinking once finished. (Code is inspired from tni's logger. Shout-out to tni ! xx)

    If let say I want to restart the sketch after I finished one measurement. From my observation, unpowering Teensy after finish, and then power it back will restart the sketch.
    Just to confirm if this method is really reliable (or any flaw?), or if there is any more elegant way.

    Many thanks !
    xx

    p/s: I tried with holding 15 secs button, but it restarted to blank sketch when powered by battery. Let me know if I am wrong

  2. #2
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany NRW
    Posts
    6,243
    You can use the reset-pin.

  3. #3
    Junior Member
    Join Date
    Nov 2019
    Location
    London
    Posts
    11
    I am assuming the "Interior" reset pin next to pin 38 on Teensy 3.6 , apply HIGH voltage to the pin, automatically restart the sketch.

    Cheers Frank :)

    Edit: Found this xx

    Quote Originally Posted by PaulStoffregen View Post
    If you want to cause a reset, just write to SBC_AIRCR. No external wire required.

    https://forum.pjrc.com/threads/29171...ll=1#post77892
    Sorry for any inconvenience :) Thanks Frank & Paul
    Last edited by scarlet_bear; 01-15-2020 at 01:04 AM.

  4. #4
    Senior Member+ MichaelMeissner's Avatar
    Join Date
    Nov 2012
    Location
    Ayer Massachussetts
    Posts
    3,490
    Quote Originally Posted by scarlet_bear View Post
    I am assuming the "Interior" reset pin next to pin 38 on Teensy 3.6 , apply HIGH voltage to the pin, automatically restart the sketch.

    Cheers Frank
    No, you want to connect the reset pin to ground to reset the board, not HIGH.

  5. #5
    Junior Member
    Join Date
    Nov 2019
    Location
    London
    Posts
    11
    Silly me ! Thank you Michael for the correction. Grounding it via Teensy itself should work isnt it ?

  6. #6
    Senior Member+ MichaelMeissner's Avatar
    Join Date
    Nov 2012
    Location
    Ayer Massachussetts
    Posts
    3,490
    Quote Originally Posted by scarlet_bear View Post
    Silly me ! Thank you Michael for the correction. Grounding it via Teensy itself should work isnt it ?
    I would worry about the state of the pin while the chip is booting, before it gets to setup, but it shouldn't be hard to try.

    Here is a solution for the Teensy 3.2 to use a spare pin as a reset. It works on a 3.5. I don't have a 3.6 nearby. It seems to turn off the Teensy 4.0, but I have to power cycle it to get the Teensy running again:

  7. #7
    Junior Member
    Join Date
    Nov 2019
    Location
    London
    Posts
    11
    Oh my...

    Using Interrupt pin to force reset. That is very elegant !

    Thanks a lot Michael :)
    Have a good day.
    xx

  8. #8
    Junior Member
    Join Date
    Nov 2019
    Location
    London
    Posts
    11
    Quote Originally Posted by MichaelMeissner View Post
    I would worry about the state of the pin while the chip is booting, before it gets to setup, but it shouldn't be hard to try.

    Here is a solution for the Teensy 3.2 to use a spare pin as a reset. It works on a 3.5. I don't have a 3.6 nearby. It seems to turn off the Teensy 4.0, but I have to power cycle it to get the Teensy running again:
    Tested it on 3.6 , works like a charm !

    Cheers everyone xx

  9. #9
    Senior Member
    Join Date
    Jul 2014
    Posts
    2,530
    Quote Originally Posted by scarlet_bear View Post
    Hi,
    I am working on data logging using T_3.6, powered by external batteries.
    The code will flow into loop of LED blinking once finished. (Code is inspired from tni's logger. Shout-out to tni ! xx)

    If let say I want to restart the sketch after I finished one measurement. From my observation, unpowering Teensy after finish, and then power it back will restart the sketch.
    Just to confirm if this method is really reliable (or any flaw?), or if there is any more elegant way.

    Many thanks !
    xx

    p/s: I tried with holding 15 secs button, but it restarted to blank sketch when powered by battery. Let me know if I am wrong
    you can also use the RTC to restart after so many seconds (i.e. fixed duty cycle)
    if interested search forum for microSoundRecorder

Posting Permissions

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