serial monitor woes

Status
Not open for further replies.

harrih

Member
I have recently been playing around learning about ftm timers and
have been using a piece of code that was published by TelephoneBill here
to get me going.https://forum.pjrc.com/threads/29421-Teensy3-1-and-Flextimer(s-)?p=81068&viewfull=1#post81068

At first it seemed all well behaved just as advertised,
and then after a few reboots the serial console started playing up
ie not printing messages properly,if at all.

So after all sorts of searching around, adding serial flushes etc
and thinking it might be some kind of interference between the FTM timer and USB
I discovered I can reproduce a similar effect with a slightly modified Blink Sketch
see below

I am using MacBookPro OSX el Capitan
Arduino 1.6.9 teensy loader 1.29 teensy 3.2
( have just tried 1.613 and teensyduino 1.32, no difference)

Can anyone help explain why this kind of thing is happening

judging by the correspondence on the forum, there seem to be quite few issues of this nature,
but no discussion that I can find there quite relates to the problems I seem to be experiencing




Code:
/*
  Blink_with_Println()
  Turns on an LED on for one second, then off for one second, repeatedly.
 
  This example code is in the public domain.
 */
 
// Pin 13 has an LED connected on most Arduino boards.
// Pin 11 has the LED on Teensy 2.0
// Pin 6  has the LED on Teensy++ 2.0
// Pin 13 has the LED on Teensy 3.0
// give it a name:
int led = 13;

// the setup routine runs once when you press reset:
void setup() { 
    Serial.begin(115200);
     while (!Serial);               
  // initialize the digital pin as an output.
  pinMode(led, OUTPUT);     
}

// the loop routine runs over and over again forever:
void loop() {
  digitalWrite(led, HIGH);   // turn the LED on (HIGH is the voltage level)
 Serial.println("Blink on");
  delay(1000);               // wait for a second
 
  digitalWrite(led, LOW);
     Serial.println("Blink off"); 
  // turn the LED off by making the voltage LOW
  delay(1000);               // wait for a second
}

which should write to the serial console once every sec
I get occasional writes sometime a whole serial.println() message,
sometimes only partial
and seemingly at more or less random intervals

here is an example
grab.jpg

If I turn everything off and restart, I can usually get it to behave for a while,
but once getting into rebooting or recompile and upload these symptoms reappear.
regards
Harry Harrison
 
Thanks for the quick response,

Tried TYQT ,
but get similar behaviour
I do however get an error message occasionally to do with tcsetattr() ??

Hope I don't have to reinstall mac OS


Harry
 
El Capitan USB Serial workaround updated for 1.34

Paul + harrih

The workaround in usb_serial.c that I found in the 1.26 beta 1 release thread worked for me. I'm currently using arduino 1.8.0, teensy 1.34, OS X 10.11.6.

I guess the fix was never fully implemented and I could find a workaround anywhere else. Anyway here is the file: View attachment usb_serial.c

usb_serial.c posted there doesn't quite drop-in to 1.34 so I've copied the changes over.
 
DANGIT nevermind. The problem is so intermittent that it appeared to be working for a while but actually isn't. Even after increasing:
Code:
if (tx_full_count >= 15) {

Anyway it still might work for you harrih.
 
@ Brendan
Thanks for your reply
I guess you mean replace whatever Changes in usb_serial.c is in the version of Teensy I'm using
With those in the file you posted.

The lock ups I experience seem to be largely related to very short response intervals
and high volume messages from Teensy

eg Message triggered by a short period interval timer interrupt

Will explore
 
Yeah or just swap the file entirely.

Anyway, might be a slightly different problem. FYI for anyone who might be still be having problems with this: mine seems to be a complete crap shoot; once in a while the serial monitor (or any other serial application) works fine, but most of the drop it drops data like crazy. Sometimes looses the data complete print/write calls (which I think is independent from packets, especially w/ USB), sometimes partial. Various sketches, several Arduino/Teensyduino updates and reinstalls, and all Teensy boards I have tried (3.0, 3.1, 3.2, 3.5 3.6).

I'm overdue for an upgrade to Sierra on my end. Hopefully that solves the problem I'm having as the El Capitan fix didn't seem to do the trick.

ALSO it appears the El Capitan fix was implemented, it just seems to work in a different way than in the original forum post. And it doesn't seem to work for me for whatever reason.

Good luck harrih! Post here if you find a solution!
 
Last edited:
Status
Not open for further replies.
Back
Top