Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 5 of 5

Thread: Serial monitor output unexpectedly stops

  1. #1

    Serial monitor output unexpectedly stops

    When outputting a substantial amount of text to the Serial Monitor I've been experiencing an issue where the output will just truncate and stop appearing. Here's a super simple sketch that generates the problem (I'm running this on a new Teensy 4.1, with the CPU speed set to 396MHz, and Optimize set to "Fast")...

    Code:
    void setup() {
    
      Serial.begin(9600);
      for (int i = 0; i < 500; i++) {
        Serial.print("Another number: ");
        Serial.println(i);
      }
    
    }
    
    void loop() {
    
    }
    After the expected output appears in the Serial Monitor for a few hundred lines, it just dies. Here's the end of the output...

    Code:
    Another number: 386
    Another number: 387
    Another number: 388
    Another number: 389
    Another number: 390
    Another number: 391
    Another number: 392
    Another number: 393
    Another number: 394
    Another
    There are no errors during compilation (not surprising, considering how simple the sketch is). Anyone have any idea what's going on? THANKS!

  2. #2
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    11,800
    Putting that on a currently active Teensy LC works fine. The T_4.1 at 480 Mbps is way faster than that at 12 Mbps.

    The change below - waits for Serial before printing. Without that the T_4.1 here showed nothing of the prints 0-499.

    Code:
    void setup() {
      Serial.begin(9600);
      while (!Serial && millis() < 2000) ; // wait
      for (int i = 0; i < 500; i++) {
        Serial.print("Another number: ");
        Serial.println(i);
      }
    
    }
    
    void loop() {
    
    }

  3. #3
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    22,110
    Are you using Mac, Linux or Windows. Which version? If Linux, double check you have the latest udev rules (they were updated months ago for a new ModemManger bug).

  4. #4
    Quote Originally Posted by defragster View Post
    Putting that on a currently active Teensy LC works fine. The T_4.1 at 480 Mbps is way faster than that at 12 Mbps.

    The change below - waits for Serial before printing. Without that the T_4.1 here showed nothing of the prints 0-499.

    Code:
    void setup() {
      Serial.begin(9600);
      while (!Serial && millis() < 2000) ; // wait
      for (int i = 0; i < 500; i++) {
        Serial.print("Another number: ");
        Serial.println(i);
      }
    
    }
    
    void loop() {
    
    }
    Thanks, I'll try that!

  5. #5
    I'm on Mac. Thanks!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •