Arduino Forum
>
Using Arduino
>
Microcontrollers
>
Writing to a teensy hangs, how can I troubleshoot this?
Print
Go Down
Pages:
[1]
Topic: Writing to a teensy hangs, how can I troubleshoot this?
(Read 403 times)
previous topic
-
next topic
loomy__
Newbie
Posts: 11
Karma: 0
[add]
Writing to a teensy hangs, how can I troubleshoot this?
Dec 19, 2020, 06:16 pm
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?
loomy__
Newbie
Posts: 11
Karma: 0
[add]
Re: Writing to a teensy hangs, how can I troubleshoot this?
#1
Dec 19, 2020, 11:17 pm
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.
loomy__
Newbie
Posts: 11
Karma: 0
[add]
Re: Writing to a teensy hangs, how can I troubleshoot this?
#2
Dec 19, 2020, 11:28 pm
doesn't work :
void loop(){
// CODE
}
Works :
void loop() {
while(true){
// code
}
}
WattsThat
Edison Member
Posts: 1,197
Karma: 113
[add]
Re: Writing to a teensy hangs, how can I troubleshoot this?
#3
Dec 20, 2020, 02:54 am
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
https://forum.pjrc.com/
Vacuum tube guy in a solid state world
loomy__
Newbie
Posts: 11
Karma: 0
[add]
Re: Writing to a teensy hangs, how can I troubleshoot this?
#4
Jan 07, 2021, 02:13 am
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
Print
Go Up
Pages:
[1]
Loading...