Teensy 4.0 Flashing impact on digital outputs

murgui

New member
Hi,

I'm using a Teensy 4.0 integrated into a larger board for managing a power distribution board including DCDC converters and load switches.

In this system we had issue only sometimes, where the Teensy and other peripherals were turned off during the flashing process, impeding its completion. Most of the occasions, the flashing did not have any impact. Due to the nature of the issue, it could be caused by a a digital output from the teensy (mapped to the system turn off circuitry).

I'm now designing the next iteration of the board and I want to avoid this issue from happening again.

What happens to DIgital outputs when changing the flashed software?

I found this post where OP says 2 pins which are DO are being set during the flashing process conflicting with his application. I have found few information about the topic.

During the first iteration of my design, I think I found some resources indicating that the pins would go into high impedance but I haven't found that information again.

Any information will be appreciated.

Thanks and regards
 
Is there anyone who might know the topic and provide some reference on how to address the topic?

Regards
 
Unfortunately there isn't a lot of solid documentation. The actual behavior is a combination of what the hardware does at reset and what NXP's ROM does at startup and when Teensy's bootloader does when it takes control of the hardware.

At reset, the hardware turns most of the pins to inputs with "weak keeper" circuitry. The keeper is basically a pullup or pulldown resistor which tries to keep the pin at whatever logic level it was previously.

NXP's ROM changes pins 24 & 25, and might do other stuff, but generally it leaves most pins alone.

Likewise, Teensy bootloader will leave all the pins as they were. It only uses the flash memory and main USB port.

However, the 15 second restore is special. It puts all pins into high impedance mode. If you press the button for 13-17 seconds and allow the flash wipe & restore to run, all the pins (except the flash signals) go tristate while it slowly wipes the flash.

If you want certain pins to be well defined voltages, real pullup or pulldown resistors are the way to go. Values like 1K to 10K are probably about right if you want to override the weak keepers. Otherwise 100K can probably work, if you only need defined results at powerup and you're willing to have the pin stay as whatever it was when the hardware stopped.

Avoid pins 24 & 25. NXP's ROM uses the pins before Teensy's bootloader can take control. You'll get undefined behavior on those pins.
 
Unfortunately there isn't a lot of solid documentation. The actual behavior is a combination of what the hardware does at reset and what NXP's ROM does at startup and when Teensy's bootloader does when it takes control of the hardware.
...
Avoid pins 24 & 25. NXP's ROM uses the pins before Teensy's bootloader can take control. You'll get undefined behavior on those pins.

Have put whole of p#4 on other older linked thread for reference.

The "Avoid pins 24 & 25" note should be on the 1062 T_4.x's product pages.
Added: github.com/PaulStoffregen/Website_Updates/issues/35

First seen as noted on other thread with the 'PJRC hardware All Edge Pin LEDs' board that indicates when held HIGH.

Those two pins are affected while the Bootloader (RED LED) is active - either uploading or just sitting.
 
Last edited:
Thank you very much for the explanation. I'm not using pins 24 and 25 so I would blame the weak keeper circuitry which I wasn't aware of.

Regards
 
Weak keeper circuitry is designed to keep unused and tri-state inputs from the forbidden voltage range without any current flowing, which can prevent unwanted current consumption in a micro-power application (even weak pullups can significantly reduce battery life in this circumstance).

However at reset time it can be a liability as seen here - at reset/power some pins may need to be in particular states to make the other hardware behave - this is the case where physical pullups and pulldowns are useful.

I once had a PCB where I was driving an H-bridge of MOSFETs direct from the microcontroller, allowing the reset/power up state to create shoot-through, which crowbarred the supply voltage - result was programming it was almost impossible till I bodged a couple of resistors to the PCB. I think that microcontroller just floated its pins on reset, but the result was the same.
 
Back
Top