
Originally Posted by
jeff0778
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