I'm posting a limited snippet that "locks up", and im able to make it happen (lockup) every time. It seems somewhere between the DTR toggling teensy will lock up and the IDE as well (or maybe the USB driver crashes?)
Without closing the IDE in this state, other than killing the process at this point, I stumbled on another weird thing as well. If I press the program button on teensy when the IDE & teensy are locked, the serial monitor unlocks, greys out, teensyduino uploads, and serial monitor works again... something wrong with the code? usb drivers? (windows 8) my use of DTR?
Once that code is loaded on teensy you can do this as many times if you want...
1: Open serial monitor
2: type anything to put something in the buffer
3: close the monitor
4: repeat
But, if you do this:
1: close serial monitor
2: with esptool installed, run this in command line to send an erase signal to the ESP via esptool (we're just capturing the packets here, but the tool toggles the DTR in the process)
3: open Serial monitor after step 2 is done.
4: try to type something in the serial monitor box, hit send, and immediately the IDE & teensy lock up, with the characters still in the serial monitor box....
5: hit program button to unfreeze serial monitor and auto upload last hex...
Without closing the IDE in this state, other than killing the process at this point, I stumbled on another weird thing as well. If I press the program button on teensy when the IDE & teensy are locked, the serial monitor unlocks, greys out, teensyduino uploads, and serial monitor works again... something wrong with the code? usb drivers? (windows 8) my use of DTR?
Code:
void setup() {
Serial.begin(1);
}
void loop() {
delay(100); Serial.println(millis()); // print millis() every 100ms...
static bool _DTR = 0; // last DTR state
if ( _DTR != Serial.dtr() ) { // if old state and new state don't match...
_DTR = Serial.dtr(); // set new DTR state
if ( !_DTR && Serial.available() > 0 && Serial.peek() != 0xC0 ) {
// Do Something...
}
if ( _DTR && Serial.available() > 0 && Serial.peek() == 0xC0 ) {
// Do Something...
}
}
}
Once that code is loaded on teensy you can do this as many times if you want...
1: Open serial monitor
2: type anything to put something in the buffer
3: close the monitor
4: repeat
But, if you do this:
1: close serial monitor
2: with esptool installed, run this in command line to send an erase signal to the ESP via esptool (we're just capturing the packets here, but the tool toggles the DTR in the process)
Code:
esptool -cp COM46 -ce
4: try to type something in the serial monitor box, hit send, and immediately the IDE & teensy lock up, with the characters still in the serial monitor box....
5: hit program button to unfreeze serial monitor and auto upload last hex...