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

Thread: How to reset teensy 4.1?

  1. #1
    Member
    Join Date
    Sep 2019
    Location
    United States
    Posts
    41

    How to reset teensy 4.1?

    Is there a way to reset the Teensy4.1 without removing power?
    I have code that locks up the board, but there are trace logs that I push to psram
    prior to that. I'd like to be able to restart the CPU without having a power-cycle
    mess up the PSRAM.
    As far as I can tell, the ONOFF pin doesn't do that on its own, so I'm kinda
    baffled at the moment...
    Any thoughts?
    Ed

  2. #2
    Member
    Join Date
    Sep 2019
    Location
    United States
    Posts
    41
    Well, after what appears to be about 140 views, but no replies; I guess there is no
    easy (i.e. button-push) way to do this. I haven't come up with anything. :-(
    So, I guess I stick with just depending on the watchdog, since that's what it's made for...
    Meanwhile, if anyone comes up with a clean "button-push" reset (without power-cycle)
    for the 4.1, please post!
    Ed

  3. #3
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    12,388
    I see 15 names that clicked the link - lots of repeat viewers ... just seeing the ping post here ...

    Indeed the T_4.x does not have a functional 'Reset' pin. Not sure about the On/Off comment? Was it tried and PSRAM was lost? It does shut down the 3.3V power.

    When PSRAM was tested in beta it was indeed observed to retain data across reprogramming.

    If you have a spare pin you might try a 'CHANGE' interrupt on that and in that with PULLUP and then apply GND to the PIN, then in _isr() put the reset command. I have seen the Teensy go offline and stop loop() and yet have such a pin interrupt function ... in whatever case of bad code that was.

    Also it might be worth trying the GDB debugger - it may be faulting and that would show that - and perhaps allow a backtrace to(ward) the source of the trouble.

  4. #4
    Senior Member
    Join Date
    Apr 2014
    Location
    Germany
    Posts
    1,136
    Couldn't you simply use tyCommander? It has a reset button. If your board hangs so badly that it doesn't respond to the reset button you can always press the reboot button on the board prior to resetting it with tyCommander.

    Click image for larger version. 

Name:	Screenshot 2020-09-14 122239.jpg 
Views:	10 
Size:	61.2 KB 
ID:	21719

  5. #5
    Member
    Join Date
    Sep 2019
    Location
    United States
    Posts
    41
    @defragster,
    I'm sure I contributed some to the click count, just looking for a reply.
    Regarding ONOFF... All I meant there was that I tried grounding that pin (thinking it would cause a reset) and it didn't. Then I read more about the pin function (yea, I should've read before grounding :-( ) and quite honestly, I'm not sure how its supposed to be used; but somehow coordinates with a PMIC (if one was designed in). Anyway, that led me to the original question.

    Just to give a bit more context, I'm not running Arduino/teensyduino. I'm using snippets of that code, along with my own stuff to run a boot monitor I wrote (umonfw.com). The monitor catches all un-assigned exceptions (hopefully), so had that been the case I would have detected it. Also note that I am still on the learning curve for this SOC, so please don't hold anything stupid I say against me! :-) Your suggestion to try a CHANGE interrupt is good, I may give that a try, but for now just enabling the WDT (through a command in the monitor) should give me what I need without any solder/wiring.
    Tx

  6. #6
    Member
    Join Date
    Sep 2019
    Location
    United States
    Posts
    41
    @luni
    Never used tyCommander. See my response to defragster regarding my non-standard context.
    Regarding the reboot button on the Teensy4.1... as far as I understand things, that drops the board to
    halfKay bootloader (waiting for a firmware update), and if I don't reload the firmware at that point I
    would have to power cycle just to get it to restart without intervention from halfKay.
    Please correct me if I'm wrong...
    Ed

  7. #7
    Member
    Join Date
    Sep 2019
    Location
    United States
    Posts
    41
    Just thinking a bit more about my reply to luni...
    An interesting feature for halfKay (IMHO) would be for it to timeout after some duration waiting for a firmware update and just reset the main SOC...

  8. #8
    Senior Member
    Join Date
    Apr 2014
    Location
    Germany
    Posts
    1,136
    Quote Originally Posted by edsut View Post
    @luni
    Regarding the reboot button on the Teensy4.1... as far as I understand things, that drops the board to
    halfKay bootloader (waiting for a firmware update),
    Right

    and if I don't reload the firmware at that point I
    would have to power cycle just to get it to restart without intervention from halfKay.
    Ed
    Wrong :-)

    while in Halfkay mode the board accepts a reset command which does not load new firmware but just resets the board. Technically, in halfKay mode the board acts as HID device. If you send it a report with some magic bytes it will reset. TyCommander will take care of this. I would say, this should also work if you don't use teensyduino. As long as you didn't unsolder the booltloader chip a button press should put the device in halfKay mode where it can be resetted. Just try it...

  9. #9
    Member
    Join Date
    Sep 2019
    Location
    United States
    Posts
    41
    Excellent! I will give that a try...
    Thanks,

  10. #10
    Member
    Join Date
    Sep 2019
    Location
    United States
    Posts
    41
    @luni,
    Ok, "teensy_loader_cli -b -mmcu=imxrt1062" does exactly what I want!
    Thanks much, hopefully this will give me everything I need...

  11. #11
    Member
    Join Date
    Sep 2019
    Location
    United States
    Posts
    41
    Just to confirm, I did the following...

    1. I transferred a 0x800000 byte file to PSRAM
    2. I pushed the reboot button
    3. From linux I ran: teensy_loader_cli -mmcu=imxrt1062 -b
    4. I retrieved the 0x800000 bytes from PSRAM to another file
    5. Comparison of the two validated that resetting this way does not corrupt PSRAM.

    Excellent!!!

  12. #12
    Senior Member
    Join Date
    Apr 2014
    Location
    Germany
    Posts
    1,136
    Perfect, sounds like a simple solution ...

  13. #13
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    12,388
    Quote Originally Posted by luni View Post
    Perfect, sounds like a simple solution ...
    I started to suggest that - but was already two hours late for signing off. In fact when I did the pin change _isr() - USB printing worked .... that time.

    But only having "I have code that locks up the board" to go on it seemed that USB might be 'offline' - in which case TyCommander would have been ignored. But yes, TyCommander GUI Reset has been very useful these past 5 years.

    And yes, PSRAM survives as noted above across Upload - but also across 'TyComm Reset' as that was done to see SPIFFS file system on PSRAM survived.

  14. #14
    Junior Member
    Join Date
    Aug 2020
    Posts
    8
    Question about a hardware solution to this, would it do any harm to the board if I were to attach a toggle to the 5v pin to reset it? Perhaps even a push-button?

Posting Permissions

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