Restart Teensy 2.0

Status
Not open for further replies.

yeahtuna

Well-known member
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?
 
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) ;
}
 
Status
Not open for further replies.
Back
Top