There may well be a simpler solution to this problem, but here goes. I need to be able to reboot a custom-board teensy 3.1 to the bootloader. On Teensy++ 2.0, I can just use _reboot_Teensyduino(), but that doesn't seem to work on 3.1 - all the forums threads I've come across seem to only discuss restarting a 3.1 from software, not jumping to the bootloader. So, I'm assuming there's no way to jump the bootloader chip purely from software running on the MK20DX256. With that in mind, I figured I could use another pin on the MK20, tie it to P5.2 on the MINI54, and just pull it low when I need to reboot. This works pretty well in rough testing with an official 3.1 board:
This works surprisingly well, every 10.5 seconds, the teensy reboots and uploads new firmware if Teensy Loader is running.
The problem is, I'm all out of useable digital output pins on one of my processors on my custom board. All I have left is the DAC/A14 pin. I've got two custom-Teensy's living on the board communicating via Serial, so if necessary I can put the reset code for BOTH chips on a single MK20 (the main one would essentially send a reboot request via serial, and then the secondary MK20 would perform the actual reset) but that seems... ugly.
So, TL;DR: Is there a way to jump the MINI54 to upload mode, purely in software? If not, is it possible to use the DAC pin as a digital output (or an approximation of one) without using the audio library?
Code:
//using pin 32 as a 'reset' pin
void setup(){
pinMode(13, OUTPUT);
digitalWrite(13, HIGH);
pinMode(32, OUTPUT);
digitalWrite(32, HIGH);
delay(10000);
digitalWrite(13, LOW);
delay(500);
digitalWrite(32, LOW);
//
}
//we should never get to the loop, if Teensy Loader is running
void loop(){}
This works surprisingly well, every 10.5 seconds, the teensy reboots and uploads new firmware if Teensy Loader is running.
The problem is, I'm all out of useable digital output pins on one of my processors on my custom board. All I have left is the DAC/A14 pin. I've got two custom-Teensy's living on the board communicating via Serial, so if necessary I can put the reset code for BOTH chips on a single MK20 (the main one would essentially send a reboot request via serial, and then the secondary MK20 would perform the actual reset) but that seems... ugly.
So, TL;DR: Is there a way to jump the MINI54 to upload mode, purely in software? If not, is it possible to use the DAC pin as a digital output (or an approximation of one) without using the audio library?