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

Thread: Teensy 3.6 Reset Pin

  1. #1

    Teensy 3.6 Reset Pin

    Simple question. Is the reset pin an active low signal?

    Does it behave as a simple reset, meaning rebooting the processor the same as at power on?


    I have an external watchdog & power supervisory chip (ADM8321WAX30) that I plan to use. My project has several high power solenoids that I have to be absolutely sure don't get 'stuck' on or they'd melt/catch fire.

    So, since I need something external to the processor to kill those drivers, I might as well have it reset the processor too.

    If it's just a typical active low reset, I can throw a pullup resistor on the open drain output of the watchdog and connect it up.

    The other question would be, can it be held in reset until the 3.3V comes up? I'd assume yes ... but better to ask! I've read some other threads were some say you can put a cap on reset to ground, which would work if reset has an internal pullup. But then another thread said the Teensy wouldn't boot when they had an external pull up to 3.3V and cap to ground so....

  2. #2
    Senior Member
    Join Date
    Dec 2016
    Location
    Montreal, Canada
    Posts
    3,463
    yes you just need to ground the reset pin to reset teensy or hold it down to hold it reset, but do not hold it down for exactly 15 seconds before releasing, or else the bootloader would reflash teensy with a blank sketch. The issue with most of those boot issues is due to the powersupply, the capacitor method is more like a bandaid fix. Ideally you’d either use a better PSU, or put on a POR (power on reset) chip that would do exactly what you said, hold reset until voltage stabilizes.

  3. #3
    Senior Member+ Theremingenieur's Avatar
    Join Date
    Feb 2014
    Location
    Colmar, France
    Posts
    2,586
    If I remember well, the 15 second thing applies to the program pin, not the reset pin...

  4. #4
    Senior Member
    Join Date
    Dec 2016
    Location
    Montreal, Canada
    Posts
    3,463
    yup, my bad

  5. #5
    Cool, sounds great.

    Thanks!

  6. #6
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    23,001
    Quote Originally Posted by Geomancer View Post
    If it's just a typical active low reset, I can throw a pullup resistor on the open drain output of the watchdog and connect it up.
    Yes, that's exactly how it's meant to be used.

    There's already a weak pullup resistor built inside the chip. It's fine to add another really pullup. Recommend between 2.2K to 10K.

    Also be aware your watchdog chip isn't the only thing that can pull the pin low. The bootloader also pulls the reset low. The reset pin pulls itself low when the chip initiates its own reset (eg, vis the AIRCR register or the internal watchdog).


    The other question would be, can it be held in reset until the 3.3V comes up?
    Yes, you can do this.


    I've read some other threads were some say you can put a cap on reset to ground
    That's correct. Do not use capacitor. Use a chip that only pulls the pin low at startup, and make sure it's open collector/drain, not a push-pull type.

    A capacitor will play havoc when the bootloader chip needs to reboot the main processor. Remember the reset is open collector, so more than 1 source can pull it low. Your external circuit isn't the only actor here.

  7. #7
    Junior Member
    Join Date
    May 2018
    Posts
    9
    Can I use a pin on the Teensy itself, tied to the reset pin with a 10k pullup resistor?

  8. #8
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    23,001
    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

  9. #9
    Junior Member
    Join Date
    Dec 2019
    Posts
    12
    Quote Originally Posted by PaulStoffregen View Post
    A capacitor will play havoc when the bootloader chip needs to reboot the main processor. Remember the reset is open collector, so more than 1 source can pull it low. Your external circuit isn't the only actor here.
    Iíve got a project where Iíve only just realised (newbi &#128580 I need to delay the MCU at boot up. Iíve made 50 units using the teensy 35 and realised about half of them have a boot up issue.
    Is it a definite no go to add a small RC network to the reset pin.
    Do I have any other options?

  10. #10
    Quote Originally Posted by jeff0778 View Post
    I’ve got a project where I’ve only just realised (newbi ��) I need to delay the MCU at boot up. I’ve made 50 units using the teensy 35 and realised about half of them have a boot up issue.
    Is it a definite no go to add a small RC network to the reset pin.
    Do I have any other options?
    A power supervisor chip may do that, just get one that has an open drain or open collector. Depends how much delay you need and what the delay is for.

    Or you could build your own by using an open collector comparator, putting a resistor divider on one input to set the threshold, and an RC on the other to get your delay.

  11. #11
    Junior Member
    Join Date
    Dec 2019
    Posts
    12
    Thanks for the response.
    I tried a basic RC network and while this does resolve the boot up issue it does stop you from updating the code via the USB.

    I ordered some MIC803 supervisors (20ms with open drain) at the weekend and they came today. They seem to work well and I can still use the USB to update code. I've also created a small PCB that I can mount over the top of the teensy that should allow me to mount the supervisor on all the 50 units...

    Cheers

  12. #12
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    23,001
    Quote Originally Posted by jeff0778 View Post
    Do I have any other options?
    This might be a long shot, but you could try adding a delay in the startup code in mk20dx128.c.

    For a bit of background, a couple years ago we had issues where Teensy 3.6 would work with USB power but would fail to start up with certain types of external power supplies. While at first it seemed Teensy 3.6 wasn't booting at all, in fact it was starting up but crashing early in the startup code when it tried to turn on the RTC's oscillator. With slowly rising power, the extremely fast startup of the hardware would result in the code running before VBAT had stabilized, because it is one diode "behind" the main 3.3V power. Turns out the startup begins when the power is only about 1.6 volts! As you can see from the comments in mk20dx128.c, we delayed the RTC init until later, which gives time for VBAT to reach enough voltage.

    I did say this is sort of a long shot, because I have absolutely no idea whether the problem you're seeing with Teensy 3.5 is related, or if it's something completely different. But adding a delay should be pretty easy, so it might be worth a try. You can't call any of the normal functions very early in the startup code, because pretty much all of the hardware is not yet initialized. But you can try adding something simple like this:

    Code:
      volatile uint32_t n = 0;
      for (n=0; n < 29000000; n++) { /* simple delay */ };
    If you add this, find this place in mk20ds128.c where the RTC is first initialized and add it just before.

    Code:
    #if defined(KINETISK) && !defined(__MK66FX1M0__)
            // If the RTC oscillator isn't enabled, get it started early.
            // But don't do this early on Teensy 3.6 - RTC_CR depends on 3.3V+VBAT
            // which may be ~0.4V "behind" 3.3V if the power ramps up slowly.
            if (!(RTC_CR & RTC_CR_OSCE)) {
                    RTC_SR = 0;
                    RTC_CR = RTC_CR_SC16P | RTC_CR_SC4P | RTC_CR_OSCE;
            }
    #endif

  13. #13
    Junior Member
    Join Date
    Dec 2019
    Posts
    12
    Hi Paul, thanks for the response. It is odd that I'm not seeing this on all the Teensy 35 unit, but about 60% of them.

    I'm using platformIO on "Visual Studio Code", do you happen to know where i would find the file "mk20dx128.c" to carry out these edits. I've done a file search on my laptop and can't find it.

  14. #14
    Member
    Join Date
    Aug 2018
    Location
    Brisbane, Australia
    Posts
    30
    I'm using linux and on my machine the file is located at
    Code:
    ~/.platformio/packages/framework-arduinoteensy/cores/teensy3/mk20dx128.c

Posting Permissions

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