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

Thread: println stops after 6 iterations

  1. #1
    Senior Member
    Join Date
    Dec 2016
    Location
    Montreal, Canada
    Posts
    2,588

    println stops after 6 iterations

    Question, using a teensy 3.6 to test this, does anyone know why the output stops sending after 6 iterations?
    commenting out the last Serial1.println statement makes it continue..

    Code:
    void setup() {
      Serial.begin(115200);
      Serial1.begin(4608000);
    }
    
    void loop() {
      static uint32_t myTimer = millis();
      if ( millis() - myTimer > 1000 ) {  // <-- changing the time doesnt affect, always stops after 6 prints.
        myTimer = millis();
        Serial.print(millis());
        Serial.print(" Sent: ");
        Serial.println("Hello World");
        Serial1.println("Hello World"); // <-- comment this out and usb serial will continue printing after 6 iterations
      }
    }
    Output at 3000 timer:

    Code:
    3401 Sent: Hello World
    6402 Sent: Hello World
    9403 Sent: Hello World
    12404 Sent: Hello World
    15405 Sent: Hello World
    18406 Sent: Hello World
    Output at 1000 timer:
    Code:
    1401 Sent: Hello World
    2402 Sent: Hello World
    3403 Sent: Hello World
    4404 Sent: Hello World
    5405 Sent: Hello World
    6406 Sent: Hello World
    Output with Serial1.println commented out:
    Code:
    1401 Sent: Hello World
    2402 Sent: Hello World
    3403 Sent: Hello World
    4404 Sent: Hello World
    5405 Sent: Hello World
    6406 Sent: Hello World
    7407 Sent: Hello World
    8408 Sent: Hello World
    9409 Sent: Hello World
    10410 Sent: Hello World
    11411 Sent: Hello World
    12412 Sent: Hello World
    13413 Sent: Hello World
    14414 Sent: Hello World
    15415 Sent: Hello World
    16416 Sent: Hello World
    17417 Sent: Hello World
    18418 Sent: Hello World
    19419 Sent: Hello World
    20420 Sent: Hello World
    21421 Sent: Hello World
    22422 Sent: Hello World
    23423 Sent: Hello World
    24424 Sent: Hello World
    25425 Sent: Hello World
    26426 Sent: Hello World
    27427 Sent: Hello World
    etc...

  2. #2
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    3,532
    No idea...
    Ran it on T3.6 default configuration
    Code:
    1401 Sent: Hello World
    2402 Sent: Hello World
    3403 Sent: Hello World
    4404 Sent: Hello World
    5405 Sent: Hello World
    6406 Sent: Hello World
    7407 Sent: Hello World
    8408 Sent: Hello World
    9409 Sent: Hello World
    10410 Sent: Hello World
    11411 Sent: Hello World
    12412 Sent: Hello World
    13413 Sent: Hello World
    14414 Sent: Hello World
    15415 Sent: Hello World
    16416 Sent: Hello World
    17417 Sent: Hello World
    18418 Sent: Hello World
    19419 Sent: Hello World
    20420 Sent: Hello World
    21421 Sent: Hello World
    22422 Sent: Hello World
    23423 Sent: Hello World
    24424 Sent: Hello World
    25425 Sent: Hello World
    26426 Sent: Hello World
    27427 Sent: Hello World
    28428 Sent: Hello World
    29429 Sent: Hello World
    30430 Sent: Hello World
    31431 Sent: Hello World
    ...

  3. #3
    Senior Member
    Join Date
    Dec 2016
    Location
    Montreal, Canada
    Posts
    2,588
    Good evening Kurt, after I saw your reply it puzzled me, so I went back to the IDE settings and seen that I was still on 24MHz testing some ESP stuff. I set it back to 180 now and it seems to be working fine now..
    I would have imagined it would just spew garbage if it didnt work, not stop the other Serial.print, not sure if it even halts the loop or just the hardwareserial code..
    Last edited by tonton81; 11-08-2017 at 02:02 PM.

  4. #4
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    17,595
    Just to confirm, I can reproduce the problem here. Works fine at 96 MHz or higher, fails at 72 MHz or lower.

    I've put this on my list of bugs to investigate. Realistically, soonest I can really look at this will be sometime next week. But my gut feeling is this very likely will turn out to be a bug in configuring the baud rate when something much faster than the hardware can actually do is requested.

  5. #5
    Senior Member
    Join Date
    Dec 2016
    Location
    Montreal, Canada
    Posts
    2,588
    thanks paul, unintentionally hit that by accident, i really hate the ESP UNSTABLE half duplex command sequenced SPI, which spews garbage whenever it pleases more than it can see the data, i decided to go UART instead and i know frank or others had 4Mbit running okay, so ill be writing a teensy protocol for it, but thatll take a bit of time to accomplish

  6. #6
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    17,595
    Ok, this was a pretty simple fix.

    https://github.com/PaulStoffregen/co...86048574a8b1e5

    Of course, this doesn't make those fast baud rates actually work at low CPU speeds, but at least you get a wrong baud rate that's the maximum the hardware can do instead of Serial1.print() waiting forever.

Posting Permissions

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