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

Thread: 3.5 Boot Lockup

  1. #1
    Junior Member
    Join Date
    Nov 2017
    Posts
    2

    3.5 Boot Lockup

    I have a Teensy 3.5 that is sporadically locking up on me. It looks like some times when external power is cycled the teensy sticks at the bootloader and does not run the program it was previously running. Once this happens once it will stay locked up like this while external power is cycled. If instead I use a usb cable to power up the teensy it continues past the bootloader and works fine. I am running another board with the exact same setup that does not seem to have this problem. My guess is there is some sort of power issue, but if I am missing something else let me know.

    Thanks

  2. #2
    Senior Member+ Theremingenieur's Avatar
    Join Date
    Feb 2014
    Location
    Colmar, France
    Posts
    1,458
    Difficult to say. Might also be a code issue, especially when using third party (non Teensyduino) libraries. Most Arduino stuff is much slower and timing / locking issues can arise since the Teensies are so much quicker.

    As a differential diagnose, load the blink example sketch from the Teensy examples and check if the issue persists. If not, it's most probably code specific and you might solve it with a delay(200); at the beginning of setup() in your code. Sometimes it's also external connected hardware which draws much current from the 3.3V regulator, making it start slower...

    Unfortunately, you did not respect the forum rules, posting code (and/or documenting your exact h/w setup) which allows everybody to reproduce your issue, so that these are all blind guesses...

  3. #3
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    3,432
    Sometimes it is because you have code in you sketch that looks like: while (!Serial) ;
    Which will wait until the Teensy is connected to USB... Again hard to know without seeing anything.

  4. #4
    Junior Member
    Join Date
    Nov 2017
    Posts
    2
    Sorry about missing the code, I am going on the assumption that it is something on the hardware side. I have been using a power supply with a few other things hooked up. If I cycle power just to the board but leave the power supply running it looks to fix things. I have the power coming in from 12V down to 5V through a linear regulator. Would voltage fluctuations at start up be a cause for this lock up?
    Code:
    #define HWSERIAL Serial1
    
    const int LED_U5          = 20;               // I/O pin numbers
    const int LED_U9          = 21;
    
    // Switch input location designation
    const int SwitchAA = 12;
    const int SwitchAB = 11;
    const int SwitchAC = 10;
    const int SwitchAD = 9;
    const int SwitchAE = 8;
    const int SwitchAF = 7;
    const int SwitchAG = 6;
    const int SwitchAH = 5;
    byte ALowOutput;
    byte AHighOutput;
    
    const int SwitchBA = 30;
    const int SwitchBB = 29;
    const int SwitchBC = 28;
    const int SwitchBD = 27;
    const int SwitchBE = 26;
    const int SwitchBF = 25;
    const int SwitchBG = 24;
    const int SwitchBH = 23;
    byte BLowOutput;
    byte BHighOutput;
    
    const int SwitchCA = 39;
    const int SwitchCB = 40;
    const int SwitchCC = 41;
    const int SwitchCD = 42;
    const int SwitchCE = 43;
    const int SwitchCF = 44;
    const int SwitchCG = 45;
    const int SwitchCH = 46;
    byte CLowOutput;
    byte CHighOutput;
    
    const int SwitchDA = 31;
    const int SwitchDB = 32;
    const int SwitchDC = 33;
    const int SwitchDD = 34;
    const int SwitchDE = 35;
    const int SwitchDF = 36;
    const int SwitchDG = 37;
    const int SwitchDH = 38;
    byte DLowOutput;
    byte DHighOutput;
    
    const int SwitchEA = 13;
    const int SwitchEB = 14;
    const int SwitchEC = 15;
    const int SwitchED = 16;
    const int SwitchEE = 17;
    const int SwitchEF = 18;
    const int SwitchEG = 19;
    const int SwitchEH = 20;
    byte ELowOutput;
    byte EHighOutput;
    
    bool speedTestToggle = false;
    
    
    //Byte address location loaded into top half of byte
    const byte MessageHeader[10] = {0x10,0x20,0x30,0x40,0x50,0x60,0x70,0x80,0x90,0xA0};
     
    void setup() 
    {
      //Serial.begin(57600);
      HWSERIAL.begin(57600);
      HWSERIAL.transmitterEnable(2);
    
       delay(50);
    
    
      pinMode(LED_U5, OUTPUT);
      digitalWrite(LED_U5, 0);
    
       delay(50);
    
      
    
    
      
      pinMode(SwitchAA, INPUT_PULLUP);
      pinMode(SwitchAB, INPUT_PULLUP);
      pinMode(SwitchAC, INPUT_PULLUP);
      pinMode(SwitchAD, INPUT_PULLUP);
      pinMode(SwitchAE, INPUT_PULLUP);
      pinMode(SwitchAF, INPUT_PULLUP);
      pinMode(SwitchAG, INPUT_PULLUP);
      pinMode(SwitchAH, INPUT_PULLUP);
    
       delay(50);
    
    
      pinMode(SwitchBA, INPUT_PULLUP);
      pinMode(SwitchBB, INPUT_PULLUP);
      pinMode(SwitchBC, INPUT_PULLUP);
      pinMode(SwitchBD, INPUT_PULLUP);
      pinMode(SwitchBE, INPUT_PULLUP);
      pinMode(SwitchBF, INPUT_PULLUP);
      pinMode(SwitchBG, INPUT_PULLUP);
      pinMode(SwitchBH, INPUT_PULLUP);
    
       delay(50);
    
    
      pinMode(SwitchCA, INPUT_PULLUP);
      pinMode(SwitchCB, INPUT_PULLUP);
      pinMode(SwitchCC, INPUT_PULLUP);
      pinMode(SwitchCD, INPUT_PULLUP);
      pinMode(SwitchCE, INPUT_PULLUP);
      pinMode(SwitchCF, INPUT_PULLUP);
      pinMode(SwitchCG, INPUT_PULLUP);
      pinMode(SwitchCH, INPUT_PULLUP);
    
       delay(50);
    
    
      pinMode(SwitchDA, INPUT_PULLUP);
      pinMode(SwitchDB, INPUT_PULLUP);
      pinMode(SwitchDC, INPUT_PULLUP);
      pinMode(SwitchDD, INPUT_PULLUP);
      pinMode(SwitchDE, INPUT_PULLUP);
      pinMode(SwitchDF, INPUT_PULLUP);
      pinMode(SwitchDG, INPUT_PULLUP);
      pinMode(SwitchDH, INPUT_PULLUP);
    
       delay(50);
    
    
      pinMode(SwitchEA, INPUT_PULLUP);
      pinMode(SwitchEB, INPUT_PULLUP);
      pinMode(SwitchEC, INPUT_PULLUP);
      pinMode(SwitchED, INPUT_PULLUP);
      pinMode(SwitchEE, INPUT_PULLUP);
      pinMode(SwitchEF, INPUT_PULLUP);
      pinMode(SwitchEG, INPUT_PULLUP);
      pinMode(SwitchEH, INPUT_PULLUP);
    
      delay(50);
    
      int temploop;
      pinMode(LED_U9, OUTPUT);
      digitalWrite(LED_U9, 1);
      
      for (temploop = 0 ; temploop < 95 ; temploop ++)
      {
      delay(300);
      digitalWrite(LED_U9, temploop % 2);
      }
    
      delay(300);
      digitalWrite(LED_U9, 1);
      
    }
    // The status of the toggle switches is loaded into the bottom half out the communication bytes. The bytes are sent over serial right away. 
    void loop() 
    {
      ALowOutput = !digitalRead(SwitchAA) | (!digitalRead(SwitchAB) << 1) | (!digitalRead(SwitchAC) << 2) | (!digitalRead(SwitchAD) << 3) | MessageHeader[0];
      AHighOutput = !digitalRead(SwitchAE) | (!digitalRead(SwitchAF) << 1) | (!digitalRead(SwitchAG) << 2) | (!digitalRead(SwitchAH) << 3) | MessageHeader[1];
    
    
    
      BLowOutput = !digitalRead(SwitchBA) | (!digitalRead(SwitchBB) << 1) | (!digitalRead(SwitchBC) << 2) | (!digitalRead(SwitchBD) << 3) | MessageHeader[2];
      BHighOutput = !digitalRead(SwitchBE) | (!digitalRead(SwitchBF) << 1) | (!digitalRead(SwitchBG) << 2) | (!digitalRead(SwitchBH) << 3) | MessageHeader[3];
    
      
     
      HWSERIAL.write(ALowOutput);
      HWSERIAL.write(AHighOutput);
      HWSERIAL.write(BLowOutput);
      HWSERIAL.write(BHighOutput);
    
    
      delay(18);
      
      CLowOutput = !digitalRead(SwitchCA) | (!digitalRead(SwitchCB) << 1) | (!digitalRead(SwitchCC) << 2) | (!digitalRead(SwitchCD) << 3) | MessageHeader[4];
      CHighOutput = !digitalRead(SwitchCE) | (!digitalRead(SwitchCF) << 1) | (!digitalRead(SwitchCG) << 2) | (!digitalRead(SwitchCH) << 3) | MessageHeader[5];
    
    
      HWSERIAL.write(0x00);
      HWSERIAL.write(0x00);
      HWSERIAL.write(CLowOutput);
      HWSERIAL.write(CHighOutput);
    
    
      delay(18);
    
    
      DLowOutput = !digitalRead(SwitchDA) | (!digitalRead(SwitchDB) << 1) | (!digitalRead(SwitchDC) << 2) | (!digitalRead(SwitchDD) << 3) | MessageHeader[6];
      DHighOutput = !digitalRead(SwitchDE) | (!digitalRead(SwitchDF) << 1) | (!digitalRead(SwitchDG) << 2) | (!digitalRead(SwitchDH) << 3) | MessageHeader[7];
    
    
    
      
      ELowOutput = !digitalRead(SwitchEA) | (!digitalRead(SwitchEB) << 1) | (!digitalRead(SwitchEC) << 2) | (!digitalRead(SwitchED) << 3) | MessageHeader[8];
      EHighOutput = !digitalRead(SwitchEE) | (!digitalRead(SwitchEF) << 1) | (!digitalRead(SwitchEG) << 2) | (!digitalRead(SwitchEH) << 3) | MessageHeader[9];
    
    
      HWSERIAL.write(DLowOutput);
      HWSERIAL.write(DHighOutput);
      HWSERIAL.write(ELowOutput);
      HWSERIAL.write(EHighOutput);
    
    
      delay(18);
    
    
    
    
    }

  5. #5
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    17,030
    We've had people report problems when using certain power supplies, especially the tiny Traco DC to DC converters.

    https://www.tracopower.com/products/...ators/tsr-1/1/

  6. #6
    Senior Member+ Theremingenieur's Avatar
    Join Date
    Feb 2014
    Location
    Colmar, France
    Posts
    1,458
    You can always try to delay the boot either with a RC combination at the RESET pin (fixed time constant) or using a 12 to 5V regulator IC which gives you a power good signal as soon as everything has stabilized.

  7. #7
    I also have this same problem with Teensy 3.6 and power source TENMA model 72-2535, which is a cheap source but that works well I think.

    I think the failure of Teensy to boot is due to some power sources that control/limit the current have a ramp at startup and take a while to reach the nominal voltage.

    If I use the On/Off button of the power source, Teensy 3.6 have problems to boot. If I connect Teensy by physically plugging the banana or using a mechanical switch, Teensy boots without problems.

  8. #8
    Senior Member+ Theremingenieur's Avatar
    Join Date
    Feb 2014
    Location
    Colmar, France
    Posts
    1,458
    That's why I always recommend using power supplies or regulators which have a separate output with a "power good" signal which can be used to handle the Teensy reset.

  9. #9
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    3,432
    I have seen a few problems with the 3.6 with some power supplies, but don't remember seeing them with the 3.5. For example, I had an issue with:
    https://smile.amazon.com/Castle-Crea...dp/B000MXAR12/ which works with T3.5 and 3.2 and I believe LC (and RPI and Odroid...)

  10. #10
    I also have a problem with a Teensy 3.5 locking up and it is somehow related to the electrical power up sequence. I cut the trace on the 3.5 and use diodes so that I can use both USB power and an external power source. This works fine on most all of my boards, but I have one set of boards that consistently lock up the Teensy if I first connect USB power, then connect the external power source. If I first connect the external power source, then the USB power source, it seems to work fine. Again on all of my other boards it does not matter which order I connect the two power sources, they always seem to work fine. On all of my boards, the external power source is 24V stepped down to 5V with a DC-DC converter (RECOM R-78C5.0-1.0, Digikey 945-1395-5-ND) to power the Teensy.

    I have some large capacitors on the boards where I see the problem, perhaps they are somehow to blame. They connect to the 24V external power source before the DC-DC converter.

    I setup a watchdog timer hoping that it would simply reset the Teensy after it locks up, but even though I know the watchdog is functioning properly and I enable the it in the very beginning of my code, it does not reset the Teensy when it locks up. I have not tried enabling the watchdog in the startup_early_hook function.

    Is there some other part of the bootloading process that could be locking up? Is there something I could add to the circuit to protect it against this sort of lockup? Thanks!

  11. #11
    Senior Member+ Theremingenieur's Avatar
    Join Date
    Feb 2014
    Location
    Colmar, France
    Posts
    1,458
    The problem is most probably the rising of the 24V and consecutively of the 5V. I understand that using the RECOM step-down modules might be an economic decision, but using a more sophisticated DC-DC converter with a dedicated POWER_GOOD signal connected to the Teensy's reset pin, might solve your problems.

  12. #12
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    3,432
    Hi @Theremingenieur - As I mentioned I had problems with the one BEC mentioned in #9... (Maybe I should send one to Paul as a I have a couple of them sitting around)...

    However in some of my newer boards (only for my own personal fun) I have been using a few different DC to DC converters. The most recent ones are: https://www.pololu.com/product/2858
    Maybe I should look into using the PG pin. Looks like it would require a PU resistor... And maybe hook up to reset logic?

    I have also used some other DC to DC converters without additional pins like: https://www.digikey.com/product-deta...6-5-ND/2259781

    So curious to see what the other fixes are.

  13. #13
    So you think it is definitely the processor that is locking up and not an issue with some other component on the Teensy board? Do you have a part number for an example DC-DC converter with a POWER_GOOD signal that I can look at?

    Unfortunately I am also seeing the same issue with the Teensy 3.2 and the reset pin is much more difficult for me to attach to in my breakout board.

    I will keep experimenting with the watchdog to see if I can enable it early enough in the startup sequence to reset the Teensy when it locks up.

  14. #14
    I enabled the watchdog in startup_enable_hook and that does not cause the Teensy to reset when it has locked up during the power up sequence. Perhaps it is the MKL02Z32VFG4 chip that needs to be reset and not the main processor. Is there any way to reset that chip without using the hardware reset pin?

Posting Permissions

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