TeensyDuino 1.57 flashes fine, anything else - same code - bootloops?

lansalot

Member
Morning(?) all

Had this problem for a while and it's finally annoying me enough to ask what to do about it. For the AgOpenGPS project, we noticed that some people were having issues flashing the code to Teensy 4.1. Eventually, this was tracked down to the version of TeensyDuino we use to flash it.

If using TeensyDuino 1.57, it seems to be fine.
If we flash the self-same code with TeensyDuino 1.58, the Teensy goes into a boot loop with no serial output.
I discovered if I use the Arduino extension in vscode, same thing - boot loop
VS2022 and Visual Micro all do the same thing.

Even if we take the compiled .hex file and flash it with 1.58, boot loop. Same code, same hex, flashed with 1.57 - works fine.

Really stumped here - any suggestions gratefully received! The code is here: https://github.com/farmerbriantee/A...dules/V4.1/Firmware/Autosteer_gps_teensy_v4_1

Thanks!
 
Someone else can explain better, but this sounds like it might be related to a problem related to initialization of static objects with the newer gcc toolchain used in 1.58. I might not have this right, but some object initializations that occur early in the boot process don't occur correctly. There is a fix coming in 1.59, and available on github now. See the thread below/

https://forum.pjrc.com/threads/73291-Teensy-4-0-HELP!
 
Indeed, that seems like a starting point. Took a sec to look into the github and short time looking didn't find the smoking gun in the pile of files.

There was another instance of this just found today - but didn't find that link. But moving wire.begin from constructor to setup() got is working like it did on prior TD version.

updated this post pjrc.com/threads/73292-wire1-begin()-hangs-my-app with the link ...
 
Even if we take the compiled .hex file and flash it with 1.58, boot loop. Same code, same hex, flashed with 1.57 - works fine.

If a hex file uploaded with the 1.57 uploader works, but the same hex file uploaded with the 1.58 uploader doesn't work, I'd suspect something in the uploader? Does it work uploading with tyTools (https://github.com/Koromix/tytools)?

Can you post your hex file?
 
Been playing around a bit with this. As @defragster said - nothing obvious. I tried adding crashreport right the beginning:
Code:
void setup() {
Serial.begin(115200);
Serial.print(CrashReport);
while(1)();

I started the boot loop before even getting to the point of printing the crash report.
 
Been playing around a bit with this. As @defragster said - nothing obvious. I tried adding crashreport right the beginning:
Code:
void setup() {
Serial.begin(115200);
Serial.print(CrashReport);
while(1)();

I started the boot loop before even getting to the point of printing the crash report.

Yup, this is due to the way the crash report is implemented. You can see now (again) which option does not work ;)
A fix for the report would need a bit of effort, but is easy.
 
Last edited:
Try deleting these 2 lines:

Code:
/**************************************************************************/
/*!
    @brief  Instantiates a new ADS1115 class w/appropriate properties
*/
/**************************************************************************/
ADS1115_lite::ADS1115_lite(uint8_t i2cAddress) {
[COLOR="#FF0000"]        Wire1.end();
        Wire1.begin();[/COLOR]
        _i2cAddress = i2cAddress;
        _gain = ADS1115_REG_CONFIG_PGA_2_048V; /* +/- 6.144V range (limited to VDD +0.3V max!) */
        _mux = ADS1115_REG_CONFIG_MUX_DIFF_0_1; /* to default */
        _rate = ADS1115_REG_CONFIG_DR_128SPS; /* to default */
}

Add these at the beginning of setup(). Or add a begin() function to ADS1115_lite class and call it from setup().

This same issue as come up several times. In 1.57 calling Wire1.begin() worked because we used constexpr constructor in Wire1. We updated the toolchain from gcc 5.4 to 11.3, and the new version needs more than just constexpr constructor. Fix is already on github, so it will work again in 1.59. If you want to keep the same code, you could just keep using 1.57 until the 1.59 release comes.
 
Even if we take the compiled .hex file and flash it with 1.58, boot loop. Same code, same hex, flashed with 1.57 - works fine.

Just to be sure, are you saying that you can build a HEX file using TD 1.57, and it runs fine when loaded to the Teensy with TD 1.57, but that same HEX file (previously built using TD 1.57) causes a boot loop when loaded to the Teensy with TD 1.58 (presumably, by pressing the PROGRAM button on the Teensy) ?? If so, are you certain that the HEX file is not actually rebuilt when attempting to use TD 1.58 to load the HEX file previously built using TD 1.57 ??

Mark J Culross
KD5RXT
 
Try deleting these 2 lines:

Code:
Add these at the beginning of setup().  Or add a begin() function to ADS1115_lite class and call it from setup().

This same issue as come up several times.  In 1.57 calling Wire1.begin() worked because we used constexpr constructor in Wire1.  We updated the toolchain from gcc 5.4 to 11.3, and the new version needs more than just constexpr constructor.  Fix is already on github, so it will work again in 1.59.  If you want to keep the same code, you could just keep using 1.57 until the 1.59 release comes.[/QUOTE]

Did as you suggested and it worked running 1.59b2.  On more boot cycles and does get through setup prints properly.  I moved wire1 commands to setup()
 
Try deleting these 2 lines:

Code:
/**************************************************************************/
/*!
    @brief  Instantiates a new ADS1115 class w/appropriate properties
*/
/**************************************************************************/
ADS1115_lite::ADS1115_lite(uint8_t i2cAddress) {
[COLOR="#FF0000"]        Wire1.end();
        Wire1.begin();[/COLOR]
        _i2cAddress = i2cAddress;
        _gain = ADS1115_REG_CONFIG_PGA_2_048V; /* +/- 6.144V range (limited to VDD +0.3V max!) */
        _mux = ADS1115_REG_CONFIG_MUX_DIFF_0_1; /* to default */
        _rate = ADS1115_REG_CONFIG_DR_128SPS; /* to default */
}

Add these at the beginning of setup(). Or add a begin() function to ADS1115_lite class and call it from setup().

This same issue as come up several times. In 1.57 calling Wire1.begin() worked because we used constexpr constructor in Wire1. We updated the toolchain from gcc 5.4 to 11.3, and the new version needs more than just constexpr constructor. Fix is already on github, so it will work again in 1.59. If you want to keep the same code, you could just keep using 1.57 until the 1.59 release comes.

Thanks, can confirm removing all instances of 1.58 from my PC results in vs micro using 1.57. vscode also working OK. Will try moving that code around with 1.58 once I'm a bit more awake, but good to know it's a known issue. Thanks!
 
Back
Top