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

Thread: Teensy long Serial.print is trunked

  1. #1

    Teensy long Serial.print is trunked

    Hi,

    Long text is trunked. If you download it many times you will see rarely the full text.


    Code:
    void setup() {
      // put your setup code here, to run once:
    delay(1000);
    Serial.print("If begin(baud) is called after serial data is already incoming, any 0 data bit may be mistakenly detected as the first start bit, resulting in corrupted reception. If started out of sync, the receiver needs an idle time of 9 bits between a stop bit and the next start bit to get into sync. Certain 100% bandwidth utilization patterns may never sync, which is a fundamental limitation of serial communication.This simple example shows how to use both the UART and USB Serial at the same time. Both are monitored for incoming bytes, and when either receives data, the results are printed to both.This simple example shows how to use both the UART and USB Serial at the same time. It may also be used while the serial port is active. ");
    Serial.flush();
    }
    Most of the time you get :
    Code:
    If begin(baud) is called after serial data is already incoming, any 0 data bit may be mistakenly detected as the first start bit, resulting in corrupted reception. If started out of sync, the receiver needs an idle time of 9 bits between a stop bit and the next start bit to get into sync. Certain 100% bandwidth utilization patterns may never sync, which is a fundamental limitation of serial communication.This simple example shows how to use both the UART and USB Serial at the same time. Both are monitored for incoming bytes, and when either receives data, the results are printed to both.This simple example shows how to use both the
    I tried to expand the serial buffer: https://forum.pjrc.com/threads/54773...l=1#post194517. Without succes.

    Why ??

    Thanks

  2. #2
    Senior Member
    Join Date
    Apr 2014
    Location
    -
    Posts
    9,753
    Quote Originally Posted by 2n3055 View Post
    Hi,

    Long text is trunked. If you download it many times you will see rarely the full text.


    Code:
    void setup() {
      // put your setup code here, to run once:
    delay(1000);
    Serial.print("If begin(baud) is called after serial data is already incoming, any 0 data bit may be mistakenly detected as the first start bit, resulting in corrupted reception. If started out of sync, the receiver needs an idle time of 9 bits between a stop bit and the next start bit to get into sync. Certain 100% bandwidth utilization patterns may never sync, which is a fundamental limitation of serial communication.This simple example shows how to use both the UART and USB Serial at the same time. Both are monitored for incoming bytes, and when either receives data, the results are printed to both.This simple example shows how to use both the UART and USB Serial at the same time. It may also be used while the serial port is active. ");
    Serial.flush();
    }
    Most of the time you get :
    Code:
    If begin(baud) is called after serial data is already incoming, any 0 data bit may be mistakenly detected as the first start bit, resulting in corrupted reception. If started out of sync, the receiver needs an idle time of 9 bits between a stop bit and the next start bit to get into sync. Certain 100% bandwidth utilization patterns may never sync, which is a fundamental limitation of serial communication.This simple example shows how to use both the UART and USB Serial at the same time. Both are monitored for incoming bytes, and when either receives data, the results are printed to both.This simple example shows how to use both the
    I tried to expand the serial buffer: https://forum.pjrc.com/threads/54773...l=1#post194517. Without succes.

    Why ??

    Thanks
    Sadly, that's nothing you could fix.

    I'm looking for the popcorn right now....

  3. #3
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    27,074
    Before I jump into trying to reproduce this, can you tell me which Teensy model you're using, and which operating system & version? Please also confirm which version of Teensyduino you have (to check, click Help > About in Arduino) so I can know which code you're really running on the Teensy side.
    Last edited by PaulStoffregen; 02-08-2022 at 09:57 PM.

  4. #4
    Senior Member
    Join Date
    Nov 2012
    Posts
    1,900
    I've tried that code on a Teensy 4.0 with TD 1.56 and Arduino 1.8.19 with Serial monitor on a PC.
    It worked 20 times in a row.

    Pete

  5. #5
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    27,074
    Seems to work every time with Teensy 4.1 used with Ubuntu 20.04 running Arduino 1.8.19 + Teensyduino 1.56.

    Click image for larger version. 

Name:	screenshot.png 
Views:	19 
Size:	17.1 KB 
ID:	27485
    Attachment 27482

  6. #6
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    16,492
    Just tried on a T_3.6, ALSO a T_4.1, with slight code MOD - to assure SERIAL is online before printing. It worked properly on T_3.6 - minor glitch on T_4.1 - maybe a Teensy_SerMon issue with overflow?:
    Code:
    void setup() {
      // put your setup code here, to run once:
      delay(1000);
      while ( !Serial );
      for ( int ii = 0; ii < 10; ii++ ) {
        Serial.println("If begin(baud) is called after serial data is already incoming, any 0 data bit may be mistakenly detected as the first start bit, resulting in corrupted reception. If started out of sync, the receiver needs an idle time of 9 bits between a stop bit and the next start bit to get into sync. Certain 100% bandwidth utilization patterns may never sync, which is a fundamental limitation of serial communication.This simple example shows how to use both the UART and USB Serial at the same time. Both are monitored for incoming bytes, and when either receives data, the results are printed to both.This simple example shows how to use both the UART and USB Serial at the same time. It may also be used while the serial port is active. ");
        Serial.flush();
      }
      Serial.print(" \n SECOND group - NO FLUSH \n\n");
      for ( int ii = 0; ii < 10; ii++ ) {
        Serial.println("If begin(baud) is called after serial data is already incoming, any 0 data bit may be mistakenly detected as the first start bit, resulting in corrupted reception. If started out of sync, the receiver needs an idle time of 9 bits between a stop bit and the next start bit to get into sync. Certain 100% bandwidth utilization patterns may never sync, which is a fundamental limitation of serial communication.This simple example shows how to use both the UART and USB Serial at the same time. Both are monitored for incoming bytes, and when either receives data, the results are printed to both.This simple example shows how to use both the UART and USB Serial at the same time. It may also be used while the serial port is active. ");
      }
    }
    void loop() {
      // put your main code here, to run repeatedly:
    
    }
    Output from T_4.1 where last line looks SHORT and TENTH line missing?
    Restarting T_4.1 this did not REPRO - Both sets of TEN lines match:
    Code:
    If begin(baud) is called after serial data is already incoming, any 0 data bit may be mistakenly detected as the first start bit, resulting in corrupted reception. If started out of sync, the receiver needs an idle time of 9 bits between a stop bit and the next start bit to get into sync. Certain 100% bandwidth utilization patterns may never sync, which is a fundamental limitation of serial communication.This simple example shows how to use both the UART and USB Serial at the same time. Both are monitored for incoming bytes, and when either receives data, the results are printed to both.This simple example shows how to use both the UART and USB Serial at the same time. It may also be used while the serial port is active. 
    If begin(baud) is called after serial data is already incoming, any 0 data bit may be mistakenly detected as the first start bit, resulting in corrupted reception. If started out of sync, the receiver needs an idle time of 9 bits between a stop bit and the next start bit to get into sync. Certain 100% bandwidth utilization patterns may never sync, which is a fundamental limitation of serial communication.This simple example shows how to use both the UART and USB Serial at the same time. Both are monitored for incoming bytes, and when either receives data, the results are printed to both.This simple example shows how to use both the UART and USB Serial at the same time. It may also be used while the serial port is active. 
    If begin(baud) is called after serial data is already incoming, any 0 data bit may be mistakenly detected as the first start bit, resulting in corrupted reception. If started out of sync, the receiver needs an idle time of 9 bits between a stop bit and the next start bit to get into sync. Certain 100% bandwidth utilization patterns may never sync, which is a fundamental limitation of serial communication.This simple example shows how to use both the UART and USB Serial at the same time. Both are monitored for incoming bytes, and when either receives data, the results are printed to both.This simple example shows how to use both the UART and USB Serial at the same time. It may also be used while the serial port is active. 
    If begin(baud) is called after serial data is already incoming, any 0 data bit may be mistakenly detected as the first start bit, resulting in corrupted reception. If started out of sync, the receiver needs an idle time of 9 bits between a stop bit and the next start bit to get into sync. Certain 100% bandwidth utilization patterns may never sync, which is a fundamental limitation of serial communication.This simple example shows how to use both the UART and USB Serial at the same time. Both are monitored for incoming bytes, and when either receives data, the results are printed to both.This simple example shows how to use both the UART and USB Serial at the same time. It may also be used while the serial port is active. 
    If begin(baud) is called after serial data is already incoming, any 0 data bit may be mistakenly detected as the first start bit, resulting in corrupted reception. If started out of sync, the receiver needs an idle time of 9 bits between a stop bit and the next start bit to get into sync. Certain 100% bandwidth utilization patterns may never sync, which is a fundamental limitation of serial communication.This simple example shows how to use both the UART and USB Serial at the same time. Both are monitored for incoming bytes, and when either receives data, the results are printed to both.This simple example shows how to use both the UART and USB Serial at the same time. It may also be used while the serial port is active. 
    If begin(baud) is called after serial data is already incoming, any 0 data bit may be mistakenly detected as the first start bit, resulting in corrupted reception. If started out of sync, the receiver needs an idle time of 9 bits between a stop bit and the next start bit to get into sync. Certain 100% bandwidth utilization patterns may never sync, which is a fundamental limitation of serial communication.This simple example shows how to use both the UART and USB Serial at the same time. Both are monitored for incoming bytes, and when either receives data, the results are printed to both.This simple example shows how to use both the UART and USB Serial at the same time. It may also be used while the serial port is active. 
    If begin(baud) is called after serial data is already incoming, any 0 data bit may be mistakenly detected as the first start bit, resulting in corrupted reception. If started out of sync, the receiver needs an idle time of 9 bits between a stop bit and the next start bit to get into sync. Certain 100% bandwidth utilization patterns may never sync, which is a fundamental limitation of serial communication.This simple example shows how to use both the UART and USB Serial at the same time. Both are monitored for incoming bytes, and when either receives data, the results are printed to both.This simple example shows how to use both the UART and USB Serial at the same time. It may also be used while the serial port is active. 
    If begin(baud) is called after serial data is already incoming, any 0 data bit may be mistakenly detected as the first start bit, resulting in corrupted reception. If started out of sync, the receiver needs an idle time of 9 bits between a stop bit and the next start bit to get into sync. Certain 100% bandwidth utilization patterns may never sync, which is a fundamental limitation of serial communication.This simple example shows how to use both the UART and USB Serial at the same time. Both are monitored for incoming bytes, and when either receives data, the results are printed to both.This simple example shows how to use both the UART and USB Serial at the same time. It may also be used while the serial port is active. 
    If begin(baud) is called after serial data is already incoming, any 0 data bit may be mistakenly detected as the first start bit, resulting in corrupted reception. If started out of sync, the receiver needs an idle time of 9 bits between a stop bit and the next start bit to get into sync. Certain 100% bandwidth utilization patterns may never sync, which is a fundamental limitation of serial communication.This simple example shows how to use both the UART and USB Serial at the same time. Both are monitored for incoming bytes, and when either receives data, the results are printed to both.This simple example shows how to use both the UART and USB Serial at the same time. It may also be used while the serial port is active. 
    If begin(baud) is called after serial data is already incoming, any 0 data bit may be mistakenly detected as the first start bit, resulting in corrupted reception. If started out of sync, the receiver needs an idle time of 9 bits between a stop bit and the next start bit to get into sync. Certain 100% bandwidth utilization patterns may never sync, which is a fundamental limitation of serial communication.This simple example shows how to use both the UART and USB Serial at the same time. Both are monitored for incoming bytes, and when either receives data, the results are printed to both.This simple example shows how to use both the UART and USB Serial at the same time. It may also be used while the serial port is active. 
     
     SECOND group - NO FLUSH 
    
    If begin(baud) is called after serial data is already incoming, any 0 data bit may be mistakenly detected as the first start bit, resulting in corrupted reception. If started out of sync, the receiver needs an idle time of 9 bits between a stop bit and the next start bit to get into sync. Certain 100% bandwidth utilization patterns may never sync, which is a fundamental limitation of serial communication.This simple example shows how to use both the UART and USB Serial at the same time. Both are monitored for incoming bytes, and when either receives data, the results are printed to both.This simple example shows how to use both the UART and USB Serial at the same time. It may also be used while the serial port is active. 
    If begin(baud) is called after serial data is already incoming, any 0 data bit may be mistakenly detected as the first start bit, resulting in corrupted reception. If started out of sync, the receiver needs an idle time of 9 bits between a stop bit and the next start bit to get into sync. Certain 100% bandwidth utilization patterns may never sync, which is a fundamental limitation of serial communication.This simple example shows how to use both the UART and USB Serial at the same time. Both are monitored for incoming bytes, and when either receives data, the results are printed to both.This simple example shows how to use both the UART and USB Serial at the same time. It may also be used while the serial port is active. 
    If begin(baud) is called after serial data is already incoming, any 0 data bit may be mistakenly detected as the first start bit, resulting in corrupted reception. If started out of sync, the receiver needs an idle time of 9 bits between a stop bit and the next start bit to get into sync. Certain 100% bandwidth utilization patterns may never sync, which is a fundamental limitation of serial communication.This simple example shows how to use both the UART and USB Serial at the same time. Both are monitored for incoming bytes, and when either receives data, the results are printed to both.This simple example shows how to use both the UART and USB Serial at the same time. It may also be used while the serial port is active. 
    If begin(baud) is called after serial data is already incoming, any 0 data bit may be mistakenly detected as the first start bit, resulting in corrupted reception. If started out of sync, the receiver needs an idle time of 9 bits between a stop bit and the next start bit to get into sync. Certain 100% bandwidth utilization patterns may never sync, which is a fundamental limitation of serial communication.This simple example shows how to use both the UART and USB Serial at the same time. Both are monitored for incoming bytes, and when either receives data, the results are printed to both.This simple example shows how to use both the UART and USB Serial at the same time. It may also be used while the serial port is active. 
    If begin(baud) is called after serial data is already incoming, any 0 data bit may be mistakenly detected as the first start bit, resulting in corrupted reception. If started out of sync, the receiver needs an idle time of 9 bits between a stop bit and the next start bit to get into sync. Certain 100% bandwidth utilization patterns may never sync, which is a fundamental limitation of serial communication.This simple example shows how to use both the UART and USB Serial at the same time. Both are monitored for incoming bytes, and when either receives data, the results are printed to both.This simple example shows how to use both the UART and USB Serial at the same time. It may also be used while the serial port is active. 
    If begin(baud) is called after serial data is already incoming, any 0 data bit may be mistakenly detected as the first start bit, resulting in corrupted reception. If started out of sync, the receiver needs an idle time of 9 bits between a stop bit and the next start bit to get into sync. Certain 100% bandwidth utilization patterns may never sync, which is a fundamental limitation of serial communication.This simple example shows how to use both the UART and USB Serial at the same time. Both are monitored for incoming bytes, and when either receives data, the results are printed to both.This simple example shows how to use both the UART and USB Serial at the same time. It may also be used while the serial port is active. 
    If begin(baud) is called after serial data is already incoming, any 0 data bit may be mistakenly detected as the first start bit, resulting in corrupted reception. If started out of sync, the receiver needs an idle time of 9 bits between a stop bit and the next start bit to get into sync. Certain 100% bandwidth utilization patterns may never sync, which is a fundamental limitation of serial communication.This simple example shows how to use both the UART and USB Serial at the same time. Both are monitored for incoming bytes, and when either receives data, the results are printed to both.This simple example shows how to use both the UART and USB Serial at the same time. It may also be used while the serial port is active. 
    If begin(baud) is called after serial data is already incoming, any 0 data bit may be mistakenly detected as the first start bit, resulting in corrupted reception. If started out of sync, the receiver needs an idle time of 9 bits between a stop bit and the next start bit to get into sync. Certain 100% bandwidth utilization patterns may never sync, which is a fundamental limitation of serial communication.This simple example shows how to use both the UART and USB Serial at the same time. Both are monitored for incoming bytes, and when either receives data, the results are printed to both.This simple example shows how to use both the UART and USB Serial at the same time. It may also be used while the serial port is active. 
    If begin(baud) is called after serial data is already incoming, any 0 data bit may be mistakenly detected as the first start bit, resulting in corrupted reception. If started out of sync, the receiver needs an idle time of 9 bits between a stop bit anther receives data, the results are printed to both.This simple example shows how to use both the UART and USB Serial at the same time. It may also be used while the serial port is active.

  7. #7
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    27,074
    Also tried it several times with Windows 10. Every time I see this:

    Click image for larger version. 

Name:	capture.png 
Views:	16 
Size:	94.2 KB 
ID:	27484

    Admittedly, I just opened the serial monitor on a Windows 10 machine and then took the same Teensy 4.1 which I had just programmed on Linux and plugged it into the Windows machine. Unplugged and reconnected the USB cable several times, always with the serial monitor responding as you can see in the screen capture.

    Willing to try more... but waiting for more detail like exactly which Teensy model and operating system to use for reproducing this issue.

  8. #8
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    16,492
    First code may be printing before Sermon is online on the machine at hand with just a 1 sec delay()

    Line seems to have about 730 characters.

    The FAST USB T_4.1 seems to be overwhelming the SerMon on repeat

    Moved the second loop that would fail to LOOP on 2 sec wait between with 100us delay to prints and it is running fine - 30 minutes of output no observed missing text errors.
    10 us delay was not enough in those sets of 10. Added index print to help line counting:
    Code:
    void setup() {
      // put your setup code here, to run once:
      delay(1000);
      while ( !Serial );
      for ( int ii = 0; ii < 10; ii++ ) {
        Serial.println("If begin(baud) is called after serial data is already incoming, any 0 data bit may be mistakenly detected as the first start bit, resulting in corrupted reception. If started out of sync, the receiver needs an idle time of 9 bits between a stop bit and the next start bit to get into sync. Certain 100% bandwidth utilization patterns may never sync, which is a fundamental limitation of serial communication.This simple example shows how to use both the UART and USB Serial at the same time. Both are monitored for incoming bytes, and when either receives data, the results are printed to both.This simple example shows how to use both the UART and USB Serial at the same time. It may also be used while the serial port is active. ");
        Serial.flush();
      }
    }
    void loop() {
      // put your main code here, to run repeatedly:
      delay(2000);
      Serial.print(" \n SECOND group - NO FLUSH \n\n");
      for ( int ii = 0; ii < 10; ii++ ) {
        Serial.print( ii );
        Serial.println(" If begin(baud) is called after serial data is already incoming, any 0 data bit may be mistakenly detected as the first start bit, resulting in corrupted reception. If started out of sync, the receiver needs an idle time of 9 bits between a stop bit and the next start bit to get into sync. Certain 100% bandwidth utilization patterns may never sync, which is a fundamental limitation of serial communication.This simple example shows how to use both the UART and USB Serial at the same time. Both are monitored for incoming bytes, and when either receives data, the results are printed to both.This simple example shows how to use both the UART and USB Serial at the same time. It may also be used while the serial port is active. ");
        delayMicroseconds( 100 );
      }
    }

  9. #9
    Quote Originally Posted by PaulStoffregen View Post
    Seems to work every time with Teensy 4.1 used with Ubuntu 20.04 running Arduino 1.8.19 + Teensyduino 1.56.

    Click image for larger version. 

Name:	screenshot.png 
Views:	19 
Size:	17.1 KB 
ID:	27485
    Attachment 27482
    thank you all for your answers !!!

    Teensy 3.2
    Arduino 1.8.7
    Teensyduino 1.45

    Running on MAC

    Thanks

  10. #10
    Senior Member
    Join Date
    Nov 2012
    Posts
    1,900
    You need to update your versions of the Arduino IDE and Teensyduino. Currently, they are Arduino 1.8.19 and TeensyDuino 1.56.
    Which MAC? (might be important)

    Pete

  11. #11
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    27,074
    Teensyduino 1.45 was released in December 2018.

  12. #12
    Quote Originally Posted by el_supremo View Post
    You need to update your versions of the Arduino IDE and Teensyduino. Currently, they are Arduino 1.8.19 and TeensyDuino 1.56.
    Which MAC? (might be important)

    Pete
    Updated and it works!!
    Thanks. for you help!

  13. #13
    Sorry, I re-open this thread because it doesn't work!!!!

    Now Teensyduino 1.56 Arduino 1.8.19. On MAC (10.14.6, iMac LAte 2015) USB-> serial converter FTDI232.

    With this code:
    Code:
    void setup() {
    Serial.begin(9600);
    delay(1000);
    Serial.print("If begin(baud) is called after serial data is already incoming, any 0 data bit may be mistakenly detected as the first start bit, resulting in corrupted reception. If started out of sync, the receiver needs an idle time of 9 bits between a stop bit and the next start bit to get into sync. Certain 100% bandwidth utilization patterns may never sync, which is a fundamental limitation of serial communication.This simple example shows how to use both the UART and USB Serial at the same time. Both are monitored for incoming bytes, and when either receives data, the results are printed to both.This simple example shows how to use both the UART and USB Serial at the same time. It may also be used while the serial port is active. ");
    //
      for ( int ii = 0; ii < 10; ii++ ) 
      {
        Serial.println("If begin(baud) is called after serial data is already incoming, any 0 data bit may be mistakenly detected as the first start bit, resulting in corrupted reception. If started out of sync, the receiver needs an idle time of 9 bits between a stop bit and the next start bit to get into sync. Certain 100% bandwidth utilization patterns may never sync, which is a fundamental limitation of serial communication.This simple example shows how to use both the UART and USB Serial at the same time. Both are monitored for incoming bytes, and when either receives data, the results are printed to both.This simple example shows how to use both the UART and USB Serial at the same time. It may also be used while the serial port is active. ");
    //Serial.flush();  /no change !
    delayMicroseconds( 100 );
      }
    }

    Code:
    If begin(baud) is called after serial data is already incoming, any 0 data bit may be mistakenly detected as the first start bit, resulting in corrupted reception. If started out of sync, the receiver needs an idle time of 9 bits between a stop bit and the next start bit to get into sync. Certain 100% bandwidth utilization patterns may never sync, which is a fundamental limitation of serial communication.This simple example shows how to use both the UART and USB Serial at the same time. Both are monitored for incoming bytes, and when either receives data, the results are printed to both.This simple example shows how to use both the UART and USB Serial at the same time. It may also be used while the serial port is active. If begin(baud) is called after serial data is already incoming, any 0 data bit may be mistakenly detected as the first start bit, resulting in corrupted reception. If started out of sync, the receiver needs an idle time of 9 bits between a stop bit and the next start bit to get into sync. Certain 100% bandwidth utilization patterns may never sync, which is a fundamental limitation of serial communication.This simple example shows how to use both the UART and USB Serial at the same time. Both are monitored for incoming bytes, and when either receives data, the results are printed to both.This simple example shows how to use both the UART and USB Serial at the same time. It may also be used while the serial port is active. 
    If begin(baud) is called after serial data is already incoming, any 0 data bit may be mistakenly detected as the first start bit, resulting in corrupted reception. If started out of sync, the receiver needs an idle time of 9 bits between a stop bit and the next start bit to get into sync. Certain 100% bandwidth utilization patterns may never sync, which is a fundamental limitation of serial communication.This simple example shows how to use both the UART and USB Serial at the same time. Both are monitored for incoming bytes, and when either receives data, the results are printed to both.This simple example shows how to use both the UART and USB Serial at the same time. It may also be used while the serial port is active. 
    If begin(baud) is called after serial data is already incoming, any 0 data bit may be mistakenly detected as the first start bit, resulting in corrupted reception. If started out of sync, the receiver needs an idle time of 9 bits between a stop bit and the next start bit to get into sync. Certain 100% bandwidth utilization patterns may never sync, which is a fundamental limitation of serial communication.This simple example shows how to use both the UART and USB Serial at the same time. Both are monitored for incoming bytes, and when either receives data, the results are printed to both.This simple example shows how to use both the UART and USB Serial at the same time. It may also be used while the serial port is active. 
    If begin(baud) is called after serial data is already incoming, any 0 data bit may be mistakenly detected as the first start bit, resulting in corrupted reception. If started out of sync, the receiver needs an idle time of 9 bits between a stop bit and the next start bit to get into sync. Certain 100% bandwidth utilization patterns may never sync, which is a fundamental limitation of serial communication.This simple example shows how to use both the UART and USB Serial at the same time. Both are monitored for incoming bytes, and when either receives data, the results are printed to both.This simple example shows how to use both the UART and USB Serial at the same time. It may also be used while the serial port is active. 
    If begin(baud) is called after serial data is already incoming, any 0 data bit may be mistakenly detected as the first start bit, resulting in corrupted reception. If started out of sync, the receiver needs an idle time of 9 bits between a stop bit and the next start bit to get into sync. Certain 100% bandwidth utilization patterns may never sync, which is a fundamental limitation of serial communication.This simple example shows how to use both the UART and USB Serial at the same time. Both are monitored for incoming bytes, and when either receives data, the results are printed to both.This simple example shows how to use both the UART and USB Serial at the same time. It may also be used while the serial port is active. 
    If begin(baud) is called after serial data is already incoming, any 0 data bit may be mistakenly detected as the first start bit, resulting in corrupted reception. If started out of sync, the receiver needs an idle time of 9 bits between a stop bit and the next start bit to get into sync. Certain 100% bandwidth utilization patterns may never sync, which is a fundamental limitation of serial communication.This simple example shows how to use both the UART and USB Serial at the same time. Both are monitored for incoming bytes, and when either receives data, the results are printed to both.This simple example shows how to use both the UART and USB Serial at the same time. It may also be used while the serial port is active. 
    If begin(baud) is called after serial data is already incoming, any 0 data bit may be mistakenly detected as the first start bit, resulting in corrupted reception. If started out of sync, the receiver needs an idle time of 9 bits between a stop bit and the next start bit to get into sync. Certain 100% bandwidth utilization patterns may never sync, which is a fundamental limitation of serial communication.This simple example shows how to use both the UART and USB Serial at the same time. Both are monitored for incoming bytes, and when either receives data, the results are printed to both.This simple example shows how to use both the UART and USB Serial at the same time. It may also be used while the serial port is active. 
    If begin(baud) is called after serial data is already incoming, any 0 data bit may be mistakenly detected as the first start bit, resulting in corrupted reception. If started out of sync, the receiver needs an idle time of 9 bits between a stop bit and the next start bit to get into sync. Certain 100% bandwidth utilization patterns may never sync, which is a fundamental limitation of serial communication.This simple example shows how to use both the UART and USB Serial at the same time. Both are monitored for incoming bytes, and when either receives data, the results are printed to both.This simple example shows how to use both the UART and USB Serial at the same time. It may also be used while the serial port is active. 
    If begin(baud) is called after serial data is already incoming, any 0 data bit may be mistakenly detected as the first start bit, resulting in corrupted reception. If started out of sync, the receiver needs an idle time of 9 bits between a stop bit and the next start bit to get into sync. Certain 100% bandwidth utilization patterns may never sync, which is a fundamental limitation of serial communication.This simple example shows how to use both the UART and USB Serial at the same time. Both are monitored for incoming bytes, and when either receives data, the results are printed to both.This simple example shows how to use both the UART and USB Serial at the same time. It may also be used while the serial port is active. 
    If begin(baud) is called after serial data is already incoming, any 0 data bit may be mistakenly detected as the first start bit, resulting in corrupted reception. If started out of sync, the receiver needs an idle time of 9 bits between a stop bit and the next start bit to get into sync. Certain 100% bandwidth utilization patterns may never sync, which is a fundamental limitation of serial communication.This simple example shows how to use both the UART and USB Serial at the same time. Both are monitored for incoming bytes, and when either receives data, the results are printed to both.This simple example shows how to use both the UART and USB Serial at the same time. It may also be used while the serial port is active.
    Only the first reply is complete !!! After it stops at the same place !!!

    Try to extend the delay to 1000 or/and flush, no change !

    Same result with Teensy 3.6 , Teensy 4 and Teensy 2.
    Last edited by 2n3055; 02-11-2022 at 06:53 PM.

  14. #14
    Senior Member
    Join Date
    Nov 2012
    Posts
    1,900
    That's because the first time you print that line, you use Serial.print not Serial.println.

    Pete

  15. #15
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    27,074
    Quote Originally Posted by 2n3055 View Post
    On MAC (10.14.6, iMac LAte 2015) USB-> serial converter FTDI232.
    I don't understand what a FTDI USB-Serial converter has to do with any of this. You're using Serial.print(), which transmits with USB virtual serial built into Teensy. That communicates directly to your Mac over the USB cable plugged into Teensy. To use hardware like a FTDI USB-Serial converter, you would wire that converter to TX1, RX1, GND and then use Serial1.print() rather than Serial.print(). But your code isn't using Serial1 at all.

    Pete called it with Serial.print() vs Serial.print().

    And regarding "After it stops at the same place !!!", the output you showed has the text printed 10 times. That seems to correspond perfectly with "for ( int ii = 0; ii < 10; ii++ )" that runs the Serial.println() function 10 times.

    From everything we can see (no photos, no idea how FTDI hardware is connected) everything you've shown seems to be working as it should.

  16. #16
    Quote Originally Posted by PaulStoffregen View Post
    I don't understand what a FTDI USB-Serial converter has to do with any of this. You're using Serial.print(), which transmits with USB virtual serial built into Teensy. That communicates directly to your Mac over the USB cable plugged into Teensy. To use hardware like a FTDI USB-Serial converter, you would wire that converter to TX1, RX1, GND and then use Serial1.print() rather than Serial.print(). But your code isn't using Serial1 at all.

    Pete called it with Serial.print() vs Serial.print().

    And regarding "After it stops at the same place !!!", the output you showed has the text printed 10 times. That seems to correspond perfectly with "for ( int ii = 0; ii < 10; ii++ )" that runs the Serial.println() function 10 times.

    From everything we can see (no photos, no idea how FTDI hardware is connected) everything you've shown seems to be working as it should.

    Sorry my mistake !!
    I haven't see the first serial.print !

    Topic closed !!

    Sorry and 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
  •