Writing to a teensy hangs, how can I troubleshoot this?

I have a teensy 3.6 as /dev/ttyACM0

I noticed that when I used serial.write() in python it would hang. I opened the Arduino IDE serial monitor and I can see the output. When I write in the serial monitor anything it immediately hangs and freezes the Arduino IDE.

I tried to isolate the issue by testing the following :

If I do cat < /dev/ttyACM0 I get the expect output from the teensy. If I keep this open in a terminal and do echo "who" > /dev/ttyACM0 in another terminal, it also hangs and I don't see any additional output on my previously opened terminal.

Why is the writing blocked and how can I fix this?

Update : It hangs because the loop() function is only called once. I have no clue why.

If I print to the serial monitor at the beginning of the loop function and at the end, I see those two prints, but only once.

doesn't work :

void loop(){
// CODE
}

Works :

void loop() {
while(true){
// code
}
}

You need to create a serial port with any Teensy 3.0 and up. It’s not there until you create it in code.

For proper help in forums, you need to post minimal code that doesn’t function as expected, not code fragments with ellipsis.

https://www.pjrc.com/teensy/troubleshoot.html

I don't think this is the issue. I dumbed things down and here's the core issue. If I upload the Blink Arduino default project using LED_BUILTIN, it only blink once. I have to do while(true) { //the code } to actually get it to blink more than once. The loop function is only called once

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.