Forum Rule: Always post complete source code & details to reproduce any issue!
Page 1 of 3 1 2 3 LastLast
Results 1 to 25 of 72

Thread: Arduino IDE2 - Serial Monitor sometimes does not work - continue from Upload Thread

  1. #1
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    11,382

    Arduino IDE2 - Serial Monitor sometimes does not work - continue from Upload Thread

    As requested by Paul,
    @Defragster - please start a new thread regarding any issues other than this problem where Arduino 2.0.2's Upload becomes disabled. Maybe edit msg #13 & msg #14 to be just a link to that new thread? Let's keep this thread only about the issue where Upload gets disabled (for reasons as-yet unknown...)
    This is a continuation of the thread (https://forum.pjrc.com/threads/71525...1-in-IDE-2-0-2)
    Oops sorry I am not @Defragster

    For those things not specific to uploads failing.
    In particular to the sometimes case where the Serial Monitor windowpane does not work, after the upload, until after you maybe change something.
    Sorry I know pretty vague, but I don't have a consistent set of steps that always reproduces this.
    But I have run into several times.

    One case of this from a couple of days ago.

    I opened a sketch. This sketch was last used on a different board. in this case, an Arduino Nano 33 IoT:
    Click image for larger version. 

Name:	Screenshot.png 
Views:	18 
Size:	554.2 KB 
ID:	29834

    I then decided I wanted to build it for Teensy 4.1, so I turned on the Teensy 4.1 and then selected it from the Toolbar drop down list.
    Something like:
    Click image for larger version. 

Name:	Screenshot2.png 
Views:	19 
Size:	143.3 KB 
ID:	29835
    I then rebuilt the sketch for the T4.1, which uploaded, but the Serial monitor was empty (was not showing anything.)
    Click image for larger version. 

Name:	Screenshot2.png 
Views:	18 
Size:	143.3 KB 
ID:	29836

    I then chose the Serial port version (not Teensy from the Tools->Port menu as shown in previous picture and the data showed up in Serial Monitor.
    I then went back and selected the Teensy Port item in the list and again the monitor window was empty.

    But then I rebuilt the sketch again, and after it rebuilt the output was showing up properly in the Serial Monitor.

    Again warning, the issue does not always happen following these steps. There are probably some subtle differences, in how I do it each time, that I am probably missing here.

    But hopefully good enough starting point.

  2. #2
    It appears to me there is some sort of buffering within the serial monitor. Data from prior "sessions" is stored somewhere, and will be presented along with any new serial data sent. However, the time frame for "presented" seems to be erratic. I deal a lot with sessions where I generate more than one screen of data (although not necessarily sent real fast). After a new upload, I often have a blank serial monitor screen. As soon as I use my scroll wheel in the SM window, all my previous session data appears.

    My other observation is that this has been this way since before 2.0.2. I quit complaining about it because I got used to it being that way. But "it ain't right".

  3. #3
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    27,395
    Quote Originally Posted by W5ZZO View Post
    But "it ain't right".
    Insight about the possible cause is nice, but what's really needed is clearly described steps to reproduce the problem. If I can't reproduce it, odds pretty slim it'll ever get fixed.

    Especially if the problem happens with Microsoft Windows, please keep in mind I mostly use Linux and sometimes MacOS for certain tasks. I'm not very familiar with Windows specific jargon and shorthand. I need extra clear description (or screenshots or video screen capture) of the exact steps to follow if it's on Windows.

    I do want to investigate and improve for 1.58 or farther future versions.

    It's also possible the root cause might be inside Arduino 2.0.2 rather than any Teensy-specific code. Whether a workaround can be found is difficult to predict. The only solution might be improvements in Arduino's code. In that case too, clear steps to reproduce the problem are also needed for them to work on it.

  4. #4
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    16,708
    Thanks @KurtE - missed that post passing ...

    Notes moved from other thread as it turned out to be diff behavior:
    OPPPS - just checked - this was done with IDE SerMon NOT_ PJRC Port selected Teensy SerMon : Update below

    - IDE 2.0.2 just restarted.
    Opened SerMon to T_4.1 and exising code printed.
    As far as behavior noted here this demonstrates it looking like the T_4.1 output is not present.
    > So different behavior - UPLOAD never grayed out. Teensy is connected - just IDE GUI aberration.

    Code:
    "C:\\Users\\Tim\\AppData\\Local\\Arduino15\\packages\\teensy\\tools\\teensy-tools\\1.57.1/teensy_size" "C:\\Users\\Tim\\AppData\\Local\\Temp\\arduino-sketch-980FD12D486BD1719B2CF41CF73CCE9B/T4MemInfo.ino.elf"
    Memory Usage on Teensy 4.1:
      FLASH: code:29692, data:8088, headers:8296   free for files:8080388
       RAM1: variables:8704, code:25000, padding:7768   free for local variables:482816
       RAM2: variables:12384  free for malloc/new:511904
    
    "C:\Users\Tim\AppData\Local\Arduino15\packages\teensy\tools\teensy-tools\1.57.1/teensy_post_compile" "-file=T4MemInfo.ino" "-path=C:\Users\Tim\AppData\Local\Temp\arduino-sketch-980FD12D486BD1719B2CF41CF73CCE9B" "-tools=C:\Users\Tim\AppData\Local\Arduino15\packages\teensy\tools\teensy-tools\1.57.1" "-board=TEENSY41" -reboot "-port=COM20" "-portlabel={serial.port.label}" "-portprotocol={serial.port.protocol}"
    It did start some short time later after I started this post - first print is old sketch then build of above?
    Code:
    C:\T_Drive\tCode\FORUM\Ser1USB_TEST\Ser1USB_TEST.ino Nov 18 2022 21:37:14
    
    C:\T_Drive\tCode\Memory\T4MemInfo\T4MemInfo.ino Nov 25 2022 20:21:55
    _stext        00000000
    _etext        000061a8 +25000b
    ...
    Looks like it is starting and printing ... but IDE is not refreshing the visible portion of the SerMon frame?

    STEPS to see it work - Click Upload and switch to 'Serial Monitor' tab soon after upload completes and 'Output' tab updates are complete.
    > if viewing while output is active it will be there

    STEPS to see confusing output: No visible output but LED OFF - all Serial.print()'s will be completed:
    > allow upload to complete and after restart LED ON then OFF
    > Switch to 'Serial Monitor' tab - and it is BLANK
    --> scroll down and GUI SerMon output draws and displays.
    // So the Output has been captured and cached - but without active output the IDE SerMon tab is not updated.
    >> Attach removed - @KurtE post shows similar <<

    This code - added LED on before !Serial then OFF after and another end print to tell one build from another:
    Code:
    // https://forum.pjrc.com/threads/33443-How-to-display-free-ram
    
    void   getFreeITCM();//  { // end of CODE ITCM, skip full 32 bits
    void setup() {
      // put your setup code here, to run once:
      pinMode( LED_BUILTIN, OUTPUT );
      digitalWrite( LED_BUILTIN, HIGH );
      Serial.begin(115200);
      while (!Serial);
      digitalWrite( LED_BUILTIN, LOW );
      Serial.println("\n" __FILE__ " " __DATE__ " " __TIME__);
      if ( CrashReport ) Serial.print ( CrashReport );
      memInfo();
      getFreeITCM();
      Serial.println("\n" __FILE__ " " __DATE__ " " __TIME__);
    }
    
    
    void loop() {
      // put your main code here, to run repeatedly:
    
    }
    
    
    #define printf Serial.printf
    
    void memInfo () {
      constexpr auto RAM_BASE   = 0x2020'0000;
                                  constexpr auto RAM_SIZE   = 512 << 10;
                                  constexpr auto FLASH_BASE = 0x6000'0000;
    #if ARDUINO_TEENSY40
      constexpr auto FLASH_SIZE = 2 << 20;
    #elif ARDUINO_TEENSY41
      constexpr auto FLASH_SIZE = 8 << 20;
    #endif
    
      // note: these values are defined by the linker, they are not valid memory
      // locations in all cases - by defining them as arrays, the C++ compiler
      // will use the address of these definitions - it's a big hack, but there's
      // really no clean way to get at linker-defined symbols from the .ld file
    
      extern char _stext[], _etext[], _sbss[], _ebss[], _sdata[], _edata[],
             _estack[], _heap_start[], _heap_end[], _itcm_block_count[], *__brkval;
    
      auto sp = (char*) __builtin_frame_address(0);
    
      printf("_stext        %08x\n",      _stext);
      printf("_etext        %08x +%db\n", _etext, _etext - _stext);
      printf("_sdata        %08x\n",      _sdata);
      printf("_edata        %08x +%db\n", _edata, _edata - _sdata);
      printf("_sbss         %08x\n",      _sbss);
      printf("_ebss         %08x +%db\n", _ebss, _ebss - _sbss);
      printf("curr stack    %08x +%db\n", sp, sp - _ebss);
      printf("_estack       %08x +%db\n", _estack, _estack - sp);
      printf("_heap_start   %08x\n",      _heap_start);
      printf("__brkval      %08x +%db\n", __brkval, __brkval - _heap_start);
      printf("_heap_end     %08x +%db\n", _heap_end, _heap_end - __brkval);
    #if ARDUINO_TEENSY41
      extern char _extram_start[], _extram_end[], *__brkval;
      printf("_extram_start %08x\n",      _extram_start);
      printf("_extram_end   %08x +%db\n", _extram_end,
             _extram_end - _extram_start);
    #endif
      printf("\n");
    
      printf("<ITCM>  %08x .. %08x\n",
             _stext, _stext + ((int) _itcm_block_count << 15) - 1);
      printf("<DTCM>  %08x .. %08x\n",
             _sdata, _estack - 1);
      printf("<RAM>   %08x .. %08x\n",
             RAM_BASE, RAM_BASE + RAM_SIZE - 1);
      printf("<FLASH> %08x .. %08x\n",
             FLASH_BASE, FLASH_BASE + FLASH_SIZE - 1);
    #if ARDUINO_TEENSY41
      extern uint8_t external_psram_size;
      if (external_psram_size > 0)
        printf("<PSRAM> %08x .. %08x\n",
               _extram_start, _extram_start + (external_psram_size << 20) - 1);
    #endif
      printf("\n");
    
      auto stack = sp - _ebss;
      printf("avail STACK %8d b %5d kb\n", stack, stack >> 10);
    
      auto heap = _heap_end - __brkval;
      printf("avail HEAP  %8d b %5d kb\n", heap, heap >> 10);
    
    #if ARDUINO_TEENSY41
      auto psram = _extram_start + (external_psram_size << 20) - _extram_end;
      printf("avail PSRAM %8d b %5d kb\n", psram, psram >> 10);
    #endif
    }
    
    
    uint32_t *ptrFreeITCM;  // Set to Usable ITCM free RAM
    uint32_t  sizeofFreeITCM; // sizeof free RAM in uint32_t units.
    uint32_t  SizeLeft_etext;
    extern char _stext[], _etext[];
    FLASHMEM void   getFreeITCM() { // end of CODE ITCM, skip full 32 bits
      Serial.println("\n\n++++++++++++++++++++++");
      SizeLeft_etext = (32 * 1024) - (((uint32_t)&_etext - (uint32_t)&_stext) % (32 * 1024));
      sizeofFreeITCM = SizeLeft_etext - 4;
      sizeofFreeITCM /= sizeof(ptrFreeITCM[0]);
      ptrFreeITCM = (uint32_t *) ( (uint32_t)&_stext + (uint32_t)&_etext + 4 );
      printf( "Size of Free ITCM in Bytes = %u\n", sizeofFreeITCM * sizeof(ptrFreeITCM[0]) );
      printf( "Start of Free ITCM = %u [%X] \n", ptrFreeITCM, ptrFreeITCM);
      printf( "End of Free ITCM = %u [%X] \n", ptrFreeITCM + sizeofFreeITCM, ptrFreeITCM + sizeofFreeITCM);
      for ( uint32_t ii = 0; ii < sizeofFreeITCM; ii++) ptrFreeITCM[ii] = 1;
      uint32_t jj = 0;
      for ( uint32_t ii = 0; ii < sizeofFreeITCM; ii++) jj += ptrFreeITCM[ii];
      printf( "ITCM DWORD cnt = %u [#bytes=%u] \n", jj, jj*4);
    }
    OPPPS - just checked - p#13 above was done with IDE SerMon NOT_ PJRC Port selected Teensy SerMon : Update below

    Changing to Teensy Ports _ Teensy-Monitor { updated just now from other IDE 2 SerMon thread }

    P#13 sketch runs and sits some long time (18.6 secs from Chime IN) with LED ON.

    Then as above changing from Output to SerMon tab - it is as above BLANK until scroll action in the SerMon tab Frame.
    // So the Output has been captured and cached - but without active output the IDE SerMon tab is not updated.

    As above first case - change from Output as upload completes - a long wait (same 18+ secs) with LED on - then Output starts and displays as expected.

    New 3rd case: Close SerMon and click Upload
    > on second chime - Chime IN, click SerMon, within 3 seconds the output is completed
    // This is the behavior repeated here - not seeing action for 18 seconds - left time to Close and ReOpen T_SerMon to see Output
    // Seems there is some "startup" handoff confusion?

    Note: Even with T_4.1 turned OFF - IDE 2 here in Win 11 has never been observed as 'Greyed' out

  5. #5
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    Location
    New York
    Posts
    8,539
    Using a 2.0.2 with the updated teensy_monitor (from the other thread), using a Micromod on a windows 10 and using Serial Port and not Teensy port I am able to duplicate the issue:
    Click image for larger version. 

Name:	Capture.PNG 
Views:	16 
Size:	15.1 KB 
ID:	29845

    As a experiment I left the IDE's Sermon open and re-uploaded the sketch and it did pick up the missing prints:
    Click image for larger version. 

Name:	Capture1.PNG 
Views:	16 
Size:	24.6 KB 
ID:	29846

    As a second experiment I added a delay(1000) after the while loop just out of curiousity and that seemed to work:
    Click image for larger version. 

Name:	Capture2.PNG 
Views:	14 
Size:	22.5 KB 
ID:	29847

    and one more test. Just used while(!Serial) and the delay(1000), still seemed to work:
    Click image for larger version. 

Name:	Capture4.PNG 
Views:	14 
Size:	22.1 KB 
ID:	29848

    As @defragster mentioned, I didn't notice any ports grayed out.

  6. #6
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    27,395
    I searched for "serial monitor" and read through titles of 61 open issues. The only one I found that seems sort of close is 1508.

    https://github.com/arduino/arduino-ide/issues/1508

    Mostly just posting this as a reminder. Hoping to get to the bottom of this problem, but will be a few days before I can do much. Busy right now testing alternate parts so we're ready for more supply chain problems anticipated to come up in over the next few months.

  7. #7
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    16,708
    First steps new sketch for repro w/T_4.1 and IDE 2.0.2:
    Code:
    void setup() {
      pinMode( LED_BUILTIN, OUTPUT );
      digitalWrite( LED_BUILTIN, HIGH );
      Serial.begin(115200);
      while (!Serial);
      digitalWrite( LED_BUILTIN, LOW );
      Serial.println("\n" __FILE__ " " __DATE__ " " __TIME__);
      Serial.print( "run secs A=" );
      Serial.println( millis()/1000.0 );
      delay(1000);               // wait for a second
      Serial.println("\n" __FILE__ " " __DATE__ " " __TIME__);
      Serial.print( "run secs B=" );
      Serial.println( millis()/1000.0 );
      showSome( 3 );
    }
    
    void loop() {
      // put your main code here, to run repeatedly:
      if ( Serial.available() )
        showSome( 3 );
      digitalWrite(LED_BUILTIN, HIGH);   // turn the LED on (HIGH is the voltage level)
      delay(1000);               // wait for a second
      digitalWrite(LED_BUILTIN, LOW);    // turn the LED off by making the voltage LOW
      delay(500);               // wait for a second
    }
    
    void showSome( int cnt ) {
      static uint nn=1;
      int ch;
      while ( (ch=Serial.read()) > -1 ) {
        Serial.print( (char)ch );
      }
      int ii;
      for ( ii=0; ii<cnt; ii++ ) {
        Serial.print( "See Me: " );
        Serial.println( ii+nn );
      }
      nn+=ii;
    }
    Seems to work properly so far starting with: Tools / Port / (IDE) Serial Port: COM20
    ->> Except once it started output buffer/display after where setup():delay(1000) is now so 'run secs B' was added after to see that next time.
    > Ctrl+U sketch builds and uploads with SerMon open - but switches away during build
    Code:
    C:\T_Drive\tCode\FORUM\serialIDE2test\serialIDE2test.ino Nov 30 2022 19:54:52
    run secs A=0.87
    
    C:\T_Drive\tCode\FORUM\serialIDE2test\serialIDE2test.ino Nov 30 2022 19:54:52
    run secs B=1.87
    See Me: 1
    See Me: 2
    See Me: 3
    Switch to: Tools / Port / teensy ports: Com 20
    Here is that 18 second startup delay - before manually timed - now shown by CODE.
    > Ctrl+U sketch builds and uploads with SerMon open - but switches away during build
    -> wait ~20 seconds with Output console in view - then see the Teensy LED start blinking before changing to 'Serial Monitor' tab:
    Code:
    C:\T_Drive\tCode\FORUM\serialIDE2test\serialIDE2test.ino Nov 30 2022 19:25:49
    run secs A=18.48
    
    C:\T_Drive\tCode\FORUM\serialIDE2test\serialIDE2test.ino Nov 30 2022 19:25:49
    run secs B=19.48
    See Me: 1
    See Me: 2
    See Me: 3
    This printing so far shows that one issue.

    Second Issue is in above state, Press T_4.1 Button for successful upload.
    > T_sermon will not reconnect - LED stays ON after upload, until SerMon is Closed and then Opened.
    { note: This is using 11/25/2022 teensy-monitor.exe }
    > See the code showSome() on Serial.available(): Sending PC output to Teensy gets no error - but the connection is not there and the LED is ON in setup().
    ->> However this time after sending OC Output once it was started showing "BUTTON PUSHED" - subsequent Button presses did Upload and connect with an 8 second delay as shown below - where the FIRST upload sat 189 seconds waiting for SerMon Close and Reopen:
    Code:
    C:\T_Drive\tCode\FORUM\serialIDE2test\serialIDE2test.ino Nov 30 2022 19:36:35
    run secs A=189.72
    
    C:\T_Drive\tCode\FORUM\serialIDE2test\serialIDE2test.ino Nov 30 2022 19:36:35
    run secs B=190.72
    See Me: 1
    See Me: 2
    See Me: 3
    BUTTON PUSHED
    See Me: 4
    See Me: 5
    See Me: 6
    
    C:\T_Drive\tCode\FORUM\serialIDE2test\serialIDE2test.ino Nov 30 2022 19:36:35
    run secs A=7.95
    
    C:\T_Drive\tCode\FORUM\serialIDE2test\serialIDE2test.ino Nov 30 2022 19:36:35
    run secs B=8.95
    See Me: 1
    See Me: 2
    See Me: 3
    
    C:\T_Drive\tCode\FORUM\serialIDE2test\serialIDE2test.ino Nov 30 2022 19:36:35
    run secs A=8.44
    
    C:\T_Drive\tCode\FORUM\serialIDE2test\serialIDE2test.ino Nov 30 2022 19:36:35
    run secs B=9.44
    See Me: 1
    See Me: 2
    See Me: 3
    
    C:\T_Drive\tCode\FORUM\serialIDE2test\serialIDE2test.ino Nov 30 2022 19:36:35
    run secs A=8.45
    
    C:\T_Drive\tCode\FORUM\serialIDE2test\serialIDE2test.ino Nov 30 2022 19:36:35
    run secs B=9.45
    See Me: 1
    See Me: 2
    See Me: 3
    ALSO NOTE: It required TWO Cut and PASTE to get all the above output, otherwise it failed to select and copy all with Mouse select.

    This func showSome( 3 ); has an added param as it seemed prior failures to update the Serial Monitor GUI tab with text { NOT seen so far } was when the initial print group over filled the tab.

  8. #8
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    16,708
    p#7 Follow Up:

    After it went working in the end of that post from 18 seconds to 8 seconds and always restarting after the Button when it first failed TWICE before posting Thise steps are no longer causing that repro situation? It always starts in 8 seconds? Closed SerMon and returned to IDE SerMon and it worked - then back to T_sermon and always starting and the time is 8 seconds.

    As shown in p#7 - the IDE SerMon connects in under 1 second, so that is different between the two.

    Extended to setup():showSome( 9 ); and removed prior delay(1000); - and so far not seen a failure of the GUI to update the tab ...

  9. #9
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    16,708
    Change in code showed this on Upload - this is with a Teensy 4.1 and TD 1.57.1 { and for Teensy updated 11/25/2022 teensy-monitor.exe }
    -->> SAME OUTPUT with IDE SERMON or T_sermon.
    Do Ctrl+U with code below, watch for LED to start blinking before switching to 'Serial Monitor' tab:
    Click image for larger version. 

Name:	skippedSM.png 
Views:	11 
Size:	13.3 KB 
ID:	29849
    See the BLANK spot instead of the sequential output? This happens with or without 'delay(1000)' in setup().
    Then hit the mouse wheel 'scroll' and - there it is:
    Code:
    C:\T_Drive\tCode\FORUM\serialIDE2test\serialIDE2test.ino Nov 30 2022 20:52:07
    run secs A=7.99
    
    C:\T_Drive\tCode\FORUM\serialIDE2test\serialIDE2test.ino Nov 30 2022 20:52:07
    run secs B=7.99
    See Me: 1
    See Me: 2
    See Me: 3
    See Me: 4
    See Me: 5
    See Me: 6
    See Me: 7
    ...
    Full code - minor edits from above that did NOT repro this { with showSome( 19 ); something happens filling a buffer segment not then 'drawn'? }:
    Code:
    void setup() {
      pinMode( LED_BUILTIN, OUTPUT );
      digitalWrite( LED_BUILTIN, HIGH );
      Serial.begin(115200);
      while (!Serial);
      digitalWrite( LED_BUILTIN, LOW );
      Serial.println("\n" __FILE__ " " __DATE__ " " __TIME__);
      Serial.print( "run secs A=" );
      Serial.println( millis()/1000.0 );
      //delay(1000);               // wait for a second
      Serial.println("\n" __FILE__ " " __DATE__ " " __TIME__);
      Serial.print( "run secs B=" );
      Serial.println( millis()/1000.0 );
      showSome( 19 );
    }
    
    void loop() {
      // put your main code here, to run repeatedly:
      if ( Serial.available() )
        showSome( 3 );
      digitalWrite(LED_BUILTIN, HIGH);   // turn the LED on (HIGH is the voltage level)
      delay(1000);               // wait for a second
      digitalWrite(LED_BUILTIN, LOW);    // turn the LED off by making the voltage LOW
      delay(500);               // wait for a second
    }
    
    void showSome( int cnt ) {
      static uint nn=1;
      int ch;
      while ( (ch=Serial.read()) > -1 ) {
        Serial.print( (char)ch );
      }
      int ii;
      for ( ii=0; ii<cnt; ii++ ) {
        Serial.print( "See Me: " );
        Serial.println( ii+nn );
      }
      nn+=ii;
    }

  10. #10
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    16,708
    Created: github.com/arduino/arduino-ide/issues/1724

    Added this note:
    Code:
    HINT Perhaps?: It is as if the output was displayed and scrolled down - only the tab was not in focus. So the 'scrolled view' 'shows' the
     lines that would have been displayed had the window scrolled down - but the tab window is instead at the top, so the 'offscreen' content
     was clipped.

  11. #11
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    16,708
    @PaulStoffregen - re p#7
    There is some issue with T_sermon on a Button Upload. Works fine ( except long startup delay noted in p#7 ) but after that Auto Upload doing a Button Press Upload it NEVER reconnects until T_sermon is Closed and opened:
    Attachment 29850

    And second Button after that sitting longer with above code:
    Code:
    C:\T_Drive\tCode\FORUM\serialIDE2test\serialIDE2test.ino Nov 30 2022 21:47:50
    run secs A=286.76
    
    C:\T_Drive\tCode\FORUM\serialIDE2test\serialIDE2test.ino Nov 30 2022 21:47:50
    run secs B=287.76
    See Me: 1
    ...
    <edi> NOTE: IDE SerMon - properly starts in under 4 seconds with Button push upload

    RE: long startup - when the output window is in the background (not in focus/view) - IDE 2 was CLOSED and restarted to get back to 18 seconds
    Code:
    C:\T_Drive\tCode\FORUM\serialIDE2test\serialIDE2test.ino Nov 30 2022 21:59:00
    run secs A=18.93
    ...
    If after Upload the Serial Monitor tab is put in focus the startup time can be 4 seconds, i.e. starts when put in focus. Versus the IDE as p#7 was 1 second in focus or not.
    > However, doing it Immediately and it took 19 seconds: 'run secs A=19.07'
    Last edited by defragster; 12-01-2022 at 06:29 AM. Reason: eidt

  12. #12
    I posted a finding on the Serial Monitor on the Arduino forums, since I could only make my proof work with using COM4 (not teensy port).
    https://forum.arduino.cc/t/ide-2-0-2...w-data/1060247
    It should work with any program that can spit out more lines that show on the window height you have set for the serial monitor in 2.0.2. In particular I was using the one I uploaded in the other thread, with two new lines stuck into setup().

    - Wes, W5ZZO

  13. #13
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    27,395
    I was able to reproduce the problem. Looks like it's not just Teensy, as I was able to see it with Arduino Leonardo.

    I created this little demo video. Does this look like the same problem everyone is seeing?



    Copy of the code used:

    Code:
    void setup() {
      pinMode(2, INPUT_PULLUP);
      Serial.begin(9600);
      while (!Serial) ; // wait for Serial Monitor
      Serial.println("Begin Program");
    }
    void loop() {
      static int count = 0;
      if (digitalRead(2) == LOW) {
        Serial.print("Button press #");
        Serial.println(++count);
        while (digitalRead(2) == LOW) 
          delay(5);
      }
    }

  14. #14
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    Location
    New York
    Posts
    8,539
    Quote Originally Posted by PaulStoffregen View Post
    I was able to reproduce the problem. Looks like it's not just Teensy, as I was able to see it with Arduino Leonardo.

    I created this little demo video. Does this look like the same problem everyone is seeing?

    .....

    Copy of the code used:

    .....
    Just for the fun of (since I had it out) I ran the sketch and confirmed it happens with a Arduino 101 board as well. Duplicates what I saw in post #5

  15. #15
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    16,708
    Quote Originally Posted by PaulStoffregen View Post
    I was able to reproduce the problem. Looks like it's not just Teensy, as I was able to see it with Arduino Leonardo.

    I created this little demo video. Does this look like the same problem everyone is seeing?

    ...
    That is 'a problem' though diff info from p#9 and reported as '/issues/1724'. It very well appears be a variant where GUI update of the buried Tab isn't properly done and accounted for when 'focus' returns to the SerMon Tab, and that SM Tab is in AutoScroll.

    Any chance the code in p#9 was run there on linux? As the screenshot shows the failure of AutoScroll but also failure to show even the '10 lines' of text output from startup.

    In doing p#9 the SM Tab was cleared before start. Doing it now and Not clearing before start the draw problem show not only no autoscroll to end of output - but then even more undrawn 'clipped' lines of the prior output.

    See the 'Hint' in p#10 - it seems Autoscroll thinks it worked drawing the 'last lines of output' but the window is stuck on the prior lines of output which are clipped/excluded from update.

    <edit> Note: Button press upload of T_4.1 when SerMon Tab has FOCUS will AutoScroll properly on sketch start with prints in setup(). The issue is when the SerMon is out of focus - i.e. anytime IDE does an upload when focus is pushed to the console 'Output' tab. Seems that 'pushing focus' leaves the SerMon window in a confused state where it is hidden and either no notified or not updated and unaware of that.
    Last edited by defragster; 12-01-2022 at 06:22 PM. Reason: works with focus

  16. #16
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    16,708
    Went to issues and updated title to: IDE SerMon fails to GUI AutoScroll on new content received when not 'in focus' #1724

    Added notes referring to arduino.cc forum and p#13:
    Code:
    See forum.arduino.cc/t/ide-2-0-2-serial-monitor-data-forgets-to-scroll-with-new-data/1060247 and forum.pjrc.com/threads/71588-Arduino-IDE2-Serial-Monitor-sometimes-does-not-work-continue-from-Upload-Thread?p=316574&viewfull=1#post316574
    
    As posted above, AutoScroll was ON and that was not noted as problem. Focus above was failure to draw 'top lines', 
    but those are OLD lines and new data below should have scrolled up and did not.
    
    So seems this should have been the real focus of this issue. Will change the title.

  17. #17
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    27,395
    I'm running the code from msg #7. I do not fully understand all the instructions and description of the problem.

    But I was able to reproduce the issue (only on Windows) where sometimes the serial monitor does not reconnect after an upload is initiated by pressing the pushbutton on Teensy.

    Quote Originally Posted by defragster View Post
    Second Issue is in above state, Press T_4.1 Button for successful upload.
    > T_sermon will not reconnect - LED stays ON after upload, until SerMon is Closed and then Opened.
    I was not able to reproduce the 8 or 18 second delay issue mention in msg #7. But much of the text describing that issue is really unclear to me. Maybe I didn't try the right thing to make it happen?

  18. #18
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    27,395
    Very strange, I can only reliably reproduce the problem once after restarting the IDE. If I close and reopen the serial monitor, it's able to reconnect after every button-triggered upload. Seems to only get stuck on the first session where the IDE has opened the serial monitor. Why, still a mystery...

  19. #19
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    16,708
    Quote Originally Posted by PaulStoffregen View Post
    Very strange, I can only reliably reproduce the problem once after restarting the IDE. If I close and reopen the serial monitor, it's able to reconnect after every button-triggered upload. Seems to only get stuck on the first session where the IDE has opened the serial monitor. Why, still a mystery...
    p#18 re #17:: Same thing with the 18 second delay on start. It happens on fresh start - then stops happening and goes to 8 seconds repeatably.

    The sketch takes input and echos it, the 18 seconds seemed to go to 8 seconds if PC output was echoed. So wasn't clear ... but the output was genuine, and it was reported before hand timed not code Millis() printed

    IIRC:
    1. Start IDE - T_4.1, T_SerMon
    2. Upload that sketch - stay on output - watch for LED Solid to start blinking
    3. Read output : saw 18 seconds
    4. repeat at #2 if seeing 18 secs as desired
    5. Use T_sermon to send something - see it echo
    6. repeat at #2 - IIRC then it was 8 seconds


    Both times too long versus IDE_SerMon - and 18 secs really odd

    ** <EDIT> : Fresh start of WINDOWS - seemed once the port was working at 8 seconds - T_SerMon was loaded and ran at 8 Seconds
    Last edited by defragster; 12-03-2022 at 04:22 PM. Reason: Fresh

  20. #20
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    Location
    New York
    Posts
    8,539
    Quote Originally Posted by defragster View Post
    p#18 re #17:: Same thing with the 18 second delay on start. It happens on fresh start - then stops happening and goes to 8 seconds repeatably.

    The sketch takes input and echos it, the 18 seconds seemed to go to 8 seconds if PC output was echoed. So wasn't clear ... but the output was genuine, and it was reported before hand timed not code Millis() printed

    IIRC:
    1. Start IDE - T_4.1, T_SerMon
    2. Upload that sketch - stay on output - watch for LED Solid to start blinking
    3. Read output : saw 18 seconds
    4. repeat at #2 if seeing 18 secs as desired
    5. Use T_sermon to send something - see it echo
    6. repeat at #2 - IIRC then it was 8 seconds


    Both times too long versus IDE_SerMon - and 18 secs really odd

    ** <EDIT> : Fresh start of WINDOWS - seemed once the port was working at 8 seconds - T_SerMon was loaded and ran at 8 Seconds
    Afternoon Tim,
    So the issue isnt with the Sermon within the IDE its from integration of Tycom serialmonitor iwith the IDE?

  21. #21
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    16,708
    Quote Originally Posted by mjs513 View Post
    Afternoon Tim,
    So the issue isnt with the Sermon within the IDE its from integration of Tycom serialmonitor iwith the IDE?
    Nothing to do with TyComm - Teensy_SerMon

    But for ref - TyCommander works perfectly normally - when used

  22. #22
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    Location
    New York
    Posts
    8,539
    Quote Originally Posted by defragster View Post
    Nothing to do with TyComm - Teensy_SerMon

    But for ref - TyCommander works perfectly normally - when used
    Was sure since you were referencing T_Sermon.

  23. #23
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    16,708
    Quote Originally Posted by PaulStoffregen View Post
    I'm running the code from msg #7. I do not fully understand all the instructions and description of the problem.

    But I was able to reproduce the issue (only on Windows) where sometimes the serial monitor does not reconnect after an upload is initiated by pressing the pushbutton on Teensy.



    I was not able to reproduce the 8 or 18 second delay issue mention in msg #7. But much of the text describing that issue is really unclear to me. Maybe I didn't try the right thing to make it happen?
    Looking at p#7 (after breakfast):
    Reading the post looks similar to p#19 steps except:
    > First run OF IDE_SerMon and see it start and work with LED Blink. Select Serial Monitor Tab and Serial online in 0.87 seconds
    > change to Teensy_SerMon - same device and code - Ctrl+U Upload completes - watch Solid LED with Output console in view
    > when LED Blinks Serial has arrived, go to T_SerMon Tab and it shows it took 18.48 seconds for T_SerMon to complete the connection

    This 18 secs was a passing anomoly - but right after IDE_SerMon completed FAST.
    Sending PC Outout to T_4.1 seemed to be the cause of the drop from 18 to 8 seconds

    REPRO just now:
    > switch to T_SerMon from IDE_SerMon as last test left it there
    > Ctrl+U fails as last build was using TyCommander for SD Card Speed Test and it Owned the port.
    > Close TyCommander and back to IDE 2 and Ctrl+U
    > Build Completes and long wait with Solid LED then to T_SerMon tab when vlinking:
    Code:
    :\T_Drive\tCode\FORUM\serialIDE2test\serialIDE2test.ino Dec  3 2022 09:45:44
    run secs A=18.61
    
    C:\T_Drive\tCode\FORUM\serialIDE2test\serialIDE2test.ino Dec  3 2022 09:45:44
    run secs B=19.61
    See Me: 1
      // ...
    See Me: 19
    > Ctrl+U again and IDE 2 switches back to Output window
    > On blinking return to T_SerMon tab
    Code:
    C:\T_Drive\tCode\FORUM\serialIDE2test\serialIDE2test.ino Dec  3 2022 09:45:44
    run secs A=18.61
      // ...
    > Send "SATURDAY" from PC to T_4.1 and it Echoes and prints 3 lines
    > Ctrl+U and on blink T_SerMon shows:
    Code:
    SATURDAY
    See Me: 20
    See Me: 21
    See Me: 22
    
    C:\T_Drive\tCode\FORUM\serialIDE2test\serialIDE2test.ino Dec  3 2022 09:51:27
    run secs A=19.06
    >Do Button Upload, requires T_SerMon Close and open
    >Ctrl+U upload again still at 18.82 seconds

    >Ctrl+U again and when Upload complete and LED solid switch to T_SerMon tab and again:
    Code:
    C:\T_Drive\tCode\FORUM\serialIDE2test\serialIDE2test.ino Dec  3 2022 09:57:49
    run secs A=18.87

  24. #24
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    16,708
    RE p#23: Moved T_4.1 from HUB to PC Front Port:
    Same 18 sec behavior follows, repeated twice and again after PC output to T_4.1
    NOTE: Machine showing it has not been restarted in 22 days.

    Quote Originally Posted by mjs513 View Post
    Was sure since you were referencing T_Sermon.
    Opps: Indeed, that 'T_' was shorthand for Teensy Ports versus IDE included SerMon. TyCommander is TyComm and was not to be used in this test.

  25. #25
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    27,395
    Indeed, so much shorthand is one of the things that also confuses me at times.

Posting Permissions

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