I have a weird issue that I can't seem to fix or debug very well. Have a device that pumps data out their serial bus into teensy 3.6.
When I first boot up the power or send new code, the serial data get's picked up by teensy. If I unplug the serial cable and re-plug in, teensy stops picking up the serial data. Takes a few times of unplugging and re-plugging the serial cable before the serial data get's picked up again by Teensy. I can confirm with scope that data is being delivered each time.
I scaled down the code to a simple sketch and still seems to be an issue for me. Any idea what I can try next?
Results
When I first boot up the power or send new code, the serial data get's picked up by teensy. If I unplug the serial cable and re-plug in, teensy stops picking up the serial data. Takes a few times of unplugging and re-plugging the serial cable before the serial data get's picked up again by Teensy. I can confirm with scope that data is being delivered each time.
I scaled down the code to a simple sketch and still seems to be an issue for me. Any idea what I can try next?
Code:
#include <Metro.h>
Metro Serial1_TMR = Metro(1000);
void setup() {
Serial.begin(115200);
Serial1.begin(19200);
}
void loop() {
if (Serial1_TMR.check()) {
Serial.println("No Data");
}
while (Serial1.available() > 0) {
Serial1.read();
Serial1_TMR.reset();
Serial.println("HERE");
}
}
Results
......
HERE
HERE
HERE
HERE
HERE
HERE
HERE
No Data
No Data
No Data
No Data
HERE (unplug cable)
No Data (plug in cable)
No Data
HERE (unplug cable)
No Data (plug in cable)
No Data
No Data
HERE (unplug cable)
HERE
No Data (plug in cable)
No Data
No Data
HERE (unplug cable)
HERE (plug in cable)
HERE
HERE
HERE
......