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

Thread: Restart Teensy 2.0

  1. #1
    Senior Member
    Join Date
    Jun 2013
    Posts
    299

    Restart Teensy 2.0

    I've got some code that reboots a Teensy 3.2 just fine.
    Code:
    #define CPU_RESTART_ADDR (uint32_t *)0xE000ED0C
    #define CPU_RESTART_VAL 0x5FA0004
    #define CPU_RESTART (*CPU_RESTART_ADDR = CPU_RESTART_VAL);
    I'm looking for the same behavior on Teensy 2.0. I'm aware of the _restart_Teensyduino_() method, but that doesn't disconnect the USB. I'm also aware of the _reboot_Teensyduino_() method, but that puts the device into program mode. What I'm looking for is a way to reboot the device without entering program mode. Any ideas?

  2. #2
    Senior Member
    Join Date
    Jun 2013
    Posts
    299
    I have a solution.

    I hacked pins_teensy.c

    This is what it looked like before:
    Code:
    void _restart_Teensyduino_(void)
    {
    	cli();
    	disable_peripherals();  // but leave USB intact
    	delayMicroseconds(15000);
    	asm volatile("jmp 0");
    	//__builtin_unreachable();  // available in gcc 4.5
    	while (1) ;
    }
    And I changed it to:
    Code:
    void _restart_Teensyduino_(void)
    {
    	cli();
    	UDCON = 1;
    	USBCON = (1 << FRZCLK);
    	delayMicroseconds(15000);
    	disable_peripherals();  // but leave USB intact
    	delayMicroseconds(15000);
    	asm volatile("jmp 0");
    	//__builtin_unreachable();  // available in gcc 4.5
    	while (1) ;
    }

Posting Permissions

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