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

Thread: Bootloader timeout?

  1. #1
    Junior Member
    Join Date
    Jan 2013

    Bootloader timeout?

    Hi there

    Forgive me if this has been posted already, I have looked but not found it.

    I am jumping to the bootloader with _reboot_Teensyduino_() - but if the bootloader doesn't receive any communications, is there a timeout? This is on a Teensy LC.

    If not, any chance a timeout could be added? Paul, I appreciate the risks with modifying bootloaders, but like many I have these boards boxed up inside enclosures, sometimes remotely. I am using commands over serial to reboot normally or jump to bootloader, but if I type the wrong one I'd like to know the board will come back, even if it's after a minute or so.

    Cheers... Mike

  2. #2
    Senior Member
    Join Date
    Dec 2016
    hi Mike, instead of using that command in one of my projects i just go after the register that triggers the reset:

    ((*(volatile uint32_t *)0xE000ED0C) = (0x5FA0004));

  3. #3
    Junior Member
    Join Date
    Jan 2013
    @tonton81 - thanks, but that's not quite what I mean.

    To elaborate: I have a number of devices which I control over a serial connection, and when I want to reflash these I typically type "bootloader". This calls _reboot_Teensyduino_() (or equivalent on other hardware) and I can reflash the device. The situation I'm trying to prevent is where I accidentally type "bootloader", the device jumps to the bootloader and it hangs. Obviously I don't mean the cat jumping on the keyboard here; more cut/paste mistakes or being connected to the wrong device. It happens.

    I tested your code, which seems to simply reset the device but not jump to the bootloader - useful (although I'd normally use the watchdog for this). But in my case I do actually want to jump to the bootloader, I just don't want it to stay there forever if I don't have a firmware to upload to it.

    (perhaps of interest to some: I have a LiFePo4 battery control board which is currently using an ATmega32u4 running my own bootloader (with just such a timeout) and firmware, and which is installed on my boat 100 miles away. The battery powers the computer, a raspberry pi, via a homemade supercap-based UPS which gives me about 30 seconds runtime. I can log onto the computer remotely and flash the controller for this battery: even though this cuts the power to the computer, the UPS will keep it going long enough for the new firmware to come back up, which restarts the power. I'm trying to switch away from AVR to ARM, but I'd like to make sure that even with the fattest of fingers I don't have to take a day off work, drive to the boat and remove a large number of screws just to press a reset button :-)
    Last edited by faceless; 12-18-2017 at 02:42 PM.

Posting Permissions

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