Teensy 4.0 First Beta Test

Status
Not open for further replies.
Just out of curiosity just checked Adafruit and its still showing OUT OF STOCK. Either I missed it or they sold out really fast :)

AdaFruit must not unpack and stock update as fast - or delivery was slower as asked them for an email too and nothing yet. They don't seem to take backorders like SFun.

SFun still showing ' Note: Some are estimated to be available by Sep 2, 2019. ' - I registered for another email on restocking.
 
Here's my 7th attempt at speeding up the serial monitor.

Indeed the memory for the fifo was leaking every time you closed and reopened the serial monitor. I added code to de-allocate the fifo data when the serial monitor closes. Some small amount of memory probably still leaks, but that's a problem I'm not able to fix at this time. Hopefully this cleanup of the fifo data make it robust enough for regular use.

I'm really hopeful this version may be stable enough to use on most Macs....

On this version, I enabled some debug printing. You'll see messages about creating and exiting the serial monitor window and listener threads. Still not sure about the proper thing to do with random interrupted exceptions. Those are expected when you close the serial monitor, but not during ordinary sustained use.
 

Attachments

  • serialmon_speedup_7th_try.zip
    403.2 KB · Views: 82
Downloaded and installed - no new messages of Note yet - general chatter - see bottom to confirm as expected. Three different sketches from recent posts - multiple uploads/resizes etc.

lps count is in the 230K region still on Win 10 - CPU % in the low to mid teens may be up a bit at times from prior.

Try #7 still shows the breakage of the lines on GUI where they really don't break:

Text Cut and Paste shows this:
Code:
..........<nl>
...........<nl>
........................................400<nl>
........................................800<nl>
........................................1200<nl>
........................................1600<nl>
........................................2000<nl>
........................................2400<nl>
........................................2800<nl>
........................................3200<nl>
........................................3600<nl>
........................................4000<nl>
........................................4400<nl>
........................................4800<nl>
........................................5200<nl>
........................................5600<nl>
........................................6000<nl>
........................................6400<nl>
........................................6800<nl>
........................................7200<nl>
........................................7600<nl>
........................................8000<nl>
........................................8400<nl>
........................................8800<nl>

Here is screen effect - highlight across broken lines:
Try7_BadnLine.jpg

Code:
TeensyPipeMonitor close
inputPipeListener exception: java.lang.InterruptedException: sleep interrupted
TeensyPipeMonitor close
inputPipeListener thread exit
T:\arduino-1.8.9t4\arduino-builder -dump-prefs -logger=machine -hardware T:\arduino-1.8.9t4\hardware -hardware C:\Users\Tim\AppData\Local\Arduino15\packages -hardware T:\tCode\hardware -tools T:\arduino-1.8.9t4\tools-builder -tools T:\arduino-1.8.9t4\hardware\tools\avr -tools  

...

Sketch uses 31808 bytes (1%) of program storage space. Maximum is 2031616 bytes.
Global variables use 35616 bytes (3%) of dynamic memory, leaving 1012960 bytes for local variables. Maximum is 1048576 bytes.
T:\arduino-1.8.9t4\hardware\teensy/../tools/teensy_post_compile -file=Try6_SerMon.ino -path=T:\TEMP\arduino_build_79011 -tools=T:\arduino-1.8.9t4\hardware\teensy/../tools -board=TEENSY40 -reboot -port=usb:0/140000/0/8/6 -portlabel=hid#vid_16c0&pid_0478 Bootloader -portprotocol=Teensy 
TeensyPipeMonitor open usb:0/140000/0/8/6
opened, dev=COM30, name=Serial
TeensyPipeMonitor close
inputPipeListener exception: java.lang.InterruptedException: sleep interrupted
TeensyPipeMonitor close
window_close
errorPipeListener thread exit
inputPipeListener thread exit
TeensyPipeMonitor ctor, port=usb:0/140000/0/8/6
disconnect
TeensyPipeMonitor open usb:0/140000/0/8/6
opened, dev=COM30, name=Serial
TeensyPipeMonitor close
inputPipeListener exception: java.lang.InterruptedException: sleep interrupted
TeensyPipeMonitor close
window_close
errorPipeListener thread exit
inputPipeListener thread exit
TeensyPipeMonitor ctor, port=usb:0/140000/0/8/6
disconnect
TeensyPipeMonitor open usb:0/140000/0/8/6
opened, dev=COM30, name=Serial
TeensyPipeMonitor close
inputPipeListener exception: java.lang.InterruptedException: sleep interrupted
TeensyPipeMonitor close
window_close
errorPipeListener thread exit
inputPipeListener thread exit
TeensyPipeMonitor ctor, port=usb:0/140000/0/8/6
disconnect
TeensyPipeMonitor open usb:0/140000/0/8/6
opened, dev=COM30, name=Serial

And abuse from 3rd sketch open close Running and when in Bootloader multiple times:
Code:
TeensyPipeMonitor close
inputPipeListener exception: java.lang.InterruptedException: sleep interrupted
TeensyPipeMonitor close
inputPipeListener thread exit
T:\arduino-1.8.9t4\arduino-builder -dump-prefs -logger=machine -hardware T:\arduino-1.8.9t4\hardware -hardware C:\Users\Tim\AppData\Local\Arduino15\packages -hardware T:\tCode\hardware -tools T:\arduino-1.8.9t4\tools-builder -tools T:\arduino-1.8.9t4\hardware\tools\avr -tools 

...

Sketch uses 12896 bytes (0%) of program storage space. Maximum is 2031616 bytes.
Global variables use 15760 bytes (1%) of dynamic memory, leaving 1032816 bytes for local variables. Maximum is 1048576 bytes.
T:\arduino-1.8.9t4\hardware\teensy/../tools/teensy_post_compile -file=lps_test.ino -path=T:\TEMP\arduino_build_998999 -tools=T:\arduino-1.8.9t4\hardware\teensy/../tools -board=TEENSY40 -reboot -port=usb:0/140000/0/8/6 -portlabel=hid#vid_16c0&pid_0478 Bootloader -portprotocol=Teensy 
TeensyPipeMonitor open usb:0/140000/0/8/6
opened, dev=COM30, name=Serial
disconnect
TeensyPipeMonitor close
inputPipeListener exception: java.lang.InterruptedException: sleep interrupted
TeensyPipeMonitor close
window_close
inputPipeListener thread exit
errorPipeListener thread exit
TeensyPipeMonitor ctor, port=usb:0/140000/0/8/6
disconnect
TeensyPipeMonitor open usb:0/140000/0/8/6
TeensyPipeMonitor close
inputPipeListener exception: java.lang.InterruptedException: sleep interrupted
TeensyPipeMonitor close
window_close
errorPipeListener thread exit
inputPipeListener thread exit
TeensyPipeMonitor ctor, port=usb:0/140000/0/8/6
disconnect
TeensyPipeMonitor open usb:0/140000/0/8/6
TeensyPipeMonitor close
inputPipeListener exception: java.lang.InterruptedException: sleep interrupted
TeensyPipeMonitor close
window_close
inputPipeListener thread exit
errorPipeListener thread exit
TeensyPipeMonitor ctor, port=usb:0/140000/0/8/6
disconnect
TeensyPipeMonitor open usb:0/140000/0/8/6
TeensyPipeMonitor close
inputPipeListener exception: java.lang.InterruptedException: sleep interrupted
TeensyPipeMonitor close
window_close
errorPipeListener thread exit
inputPipeListener thread exit
TeensyPipeMonitor ctor, port=usb:0/140000/0/8/6
disconnect
TeensyPipeMonitor open usb:0/140000/0/8/6
TeensyPipeMonitor close
inputPipeListener exception: java.lang.InterruptedException: sleep interrupted
TeensyPipeMonitor close
window_close
errorPipeListener thread exit
inputPipeListener thread exit
TeensyPipeMonitor ctor, port=usb:0/140000/0/8/6
disconnect
TeensyPipeMonitor open usb:0/140000/0/8/6
TeensyPipeMonitor close
inputPipeListener exception: java.lang.InterruptedException: sleep interrupted
TeensyPipeMonitor close
window_close
inputPipeListener thread exit
errorPipeListener thread exit
TeensyPipeMonitor ctor, port=usb:0/140000/0/8/6
disconnect
TeensyPipeMonitor open usb:0/140000/0/8/6
TeensyPipeMonitor close
inputPipeListener exception: java.lang.InterruptedException: sleep interrupted
TeensyPipeMonitor close
window_close
errorPipeListener thread exit
inputPipeListener thread exit
TeensyPipeMonitor ctor, port=usb:0/140000/0/8/6
disconnect
TeensyPipeMonitor open usb:0/140000/0/8/6
opened, dev=COM30, name=Serial
TeensyPipeMonitor close
inputPipeListener exception: java.lang.InterruptedException: sleep interrupted
TeensyPipeMonitor close
window_close
errorPipeListener thread exit
inputPipeListener thread exit
TeensyPipeMonitor ctor, port=usb:0/140000/0/8/6
disconnect
TeensyPipeMonitor open usb:0/140000/0/8/6
opened, dev=COM30, name=Serial
 
Have seen this before - it did it again.

Output scroll just STOPS:
Code:
>count=60531797, lines/sec=222967 >count=60531798, lines/sec=222967 >count=60531799, lines/sec=222967 >count=60531800, lines/sec=222967
 >count=60531801, lines/sec=222967 >count=60531802, lines/sec=222967 >count=60531803, lines/sec=222967 >count=60531804, lines/sec=222967
 >count=60531805, lines/sec=222967 >count=60531806, lines/sec=222967 >count=60531807, lines/

JAVA CPU at 2%-3%

Before it would restart with AutoScroll or mouse move scroll wheel - wasn't sure it wasn't just a big delay … This time I can not get it to resume.

Close t_sermon then re-open and it is running again? Not sure if T4 stopped or the t_sermon stopped - no blink in running code.

These messages overlap/pickup from above where the restart happened with no error or note:
Code:
TeensyPipeMonitor open usb:0/140000/0/8/6
opened, dev=COM30, name=Serial
TeensyPipeMonitor close
inputPipeListener exception: java.lang.InterruptedException: sleep interrupted
TeensyPipeMonitor close
window_close
errorPipeListener thread exit
inputPipeListener thread exit
TeensyPipeMonitor ctor, port=usb:0/140000/0/8/6
disconnect
TeensyPipeMonitor open usb:0/140000/0/8/6
opened, dev=COM30, name=Serial

<edit> restarted with LED flip on the second … variant of LPS.ino

<EDIT / UPDATE> :: It stopped again and T4 LED still blinking on the second.
> Tycommander is and has been closed
> TeensyLoader Verbose shows last message from upload at 1:18 until 2pm when I opened Verbose
> No apparent related message in any of the 4 open IDE sketch windows
> JAVA CPU% low <2% with t_sermon in background - bringing front takes to 3% then drops and still frozen

- t_sermon was just brought forward - stretched across two displays and resized then left and noticed as stopped.
Window content still scrollable with Mouse or bar slider.
Lower left check boxes respond with state but do nothing to restart
Clear output worked to clear - but not restart.

>> GOT RESTART putting TEXT in send box and pressing SEND.

No new console messages - and Nothing ORANGE or error

EDIT:: Stopped again with T4 blinking. Put text in box and hit SEND and it picked right up 11% CPU and 288 MB RAM. - and no notes in IDE consoles
 
Last edited:
Here's my 7th attempt

@PaulStoffregen
After an hour or two (edit 2 or 3) of continuous effort I couldn't manage to make 'attempt 7' crash or refuse to open the terminal window !
Gave up on the compile->load->overflow->comment thing I was doing as there was no extra symptoms not shown below.

I did get java errors, but they never seemed to cause problems. Typically when I closed the terminal window if it was overflowing I got the error. If I reopened it and turned off the autoscroll button I would just get your debug text. Not sure but possibly sometimes the java view wouldn't auto scroll itself or maybe your debug messages weren't sent yet.

Not sure what your new error code is supposed to look like so I shot this along with the output below:


the java output:

Code:
Sketch uses 12624 bytes (0%) of program storage space. Maximum is 2031616 bytes.
Global variables use 15488 bytes (1%) of dynamic memory, leaving 1033088 bytes for local variables. Maximum is 1048576 bytes.
TeensyPipeMonitor ctor, port=usb:14320000
disconnect
TeensyPipeMonitor open usb:14320000
opened, dev=/dev/cu.usbmodem61558201, name=Serial
TeensyPipeMonitor close
errorPipeListener thread exit
inputPipeListener exception: java.lang.InterruptedException: sleep interrupted
TeensyPipeMonitor close
window_close
inputPipeListener thread exit
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
	at processing.app.FifoDocument.getElement(FifoDocumen  t.java:462)
	at processing.app.FifoElementRoot.getElementIndex(Fif  oElementRoot.java:40)
	at javax.swing.text.PlainView.modelToView(PlainView.j  ava:346)
	at javax.swing.plaf.basic.BasicTextUI$RootView.modelT  oView(BasicTextUI.java:1509)
	at javax.swing.plaf.basic.BasicTextUI.modelToView(Bas  icTextUI.java:1047)
	at javax.swing.text.DefaultCaret.repaintNewCaret(Defa  ultCaret.java:1308)
	at javax.swing.text.DefaultCaret$1.run(DefaultCaret.j  ava:1287)
	at java.awt.event.InvocationEvent.dispatch(Invocation  Event.java:311)
	at java.awt.EventQueue.dispatchEventImpl(EventQueue.j  ava:758)
	at java.awt.EventQueue.access$500(EventQueue.java:97)
	at java.awt.EventQueue$3.run(EventQueue.java:709)
	at java.awt.EventQueue$3.run(EventQueue.java:703)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.ProtectionDomain$JavaSecurityAccessI  mpl.doIntersectionPrivilege(ProtectionDomain.java:  74)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:  728)
	at java.awt.EventDispatchThread.pumpOneEventForFilter  s(EventDispatchThread.java:205)
	at java.awt.EventDispatchThread.pumpEventsForFilter(E  ventDispatchThread.java:116)
	at java.awt.EventDispatchThread.pumpEventsForHierarch  y(EventDispatchThread.java:105)
	at java.awt.EventDispatchThread.pumpEvents(EventDispa  tchThread.java:101)
	at java.awt.EventDispatchThread.pumpEvents(EventDispa  tchThread.java:93)
	at java.awt.EventDispatchThread.run(EventDispatchThre  ad.java:82)
TeensyPipeMonitor ctor, port=usb:14320000
disconnect
TeensyPipeMonitor open usb:14320000
opened, dev=/dev/cu.usbmodem61558201, name=Serial
TeensyPipeMonitor close
errorPipeListener thread exit
inputPipeListener exception: java.lang.InterruptedException: sleep interrupted
TeensyPipeMonitor close
window_close
inputPipeListener thread exit
TeensyPipeMonitor ctor, port=usb:14320000
disconnect
TeensyPipeMonitor open usb:14320000
opened, dev=/dev/cu.usbmodem61558201, name=Serial
TeensyPipeMonitor close
errorPipeListener thread exit
window_close
inputPipeListener exception: java.lang.InterruptedException: sleep interrupted
TeensyPipeMonitor close
inputPipeListener thread exit
TeensyPipeMonitor ctor, port=usb:14320000
disconnect
TeensyPipeMonitor open usb:14320000
opened, dev=/dev/cu.usbmodem61558201, name=Serial
TeensyPipeMonitor close
errorPipeListener thread exit
inputPipeListener exception: java.lang.InterruptedException: sleep interrupted
TeensyPipeMonitor close
window_close
inputPipeListener thread exit
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
	at processing.app.FifoDocument.getElement(FifoDocumen  t.java:462)
	at processing.app.FifoElementRoot.getElementIndex(Fif  oElementRoot.java:40)
	at javax.swing.text.PlainView.modelToView(PlainView.j  ava:346)
	at javax.swing.plaf.basic.BasicTextUI$RootView.modelT  oView(BasicTextUI.java:1509)
	at javax.swing.plaf.basic.BasicTextUI.modelToView(Bas  icTextUI.java:1047)
	at javax.swing.text.DefaultCaret.repaintNewCaret(Defa  ultCaret.java:1308)
	at javax.swing.text.DefaultCaret$1.run(DefaultCaret.j  ava:1287)
	at java.awt.event.InvocationEvent.dispatch(Invocation  Event.java:311)
	at java.awt.EventQueue.dispatchEventImpl(EventQueue.j  ava:758)
	at java.awt.EventQueue.access$500(EventQueue.java:97)
	at java.awt.EventQueue$3.run(EventQueue.java:709)
	at java.awt.EventQueue$3.run(EventQueue.java:703)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.ProtectionDomain$JavaSecurityAccessI  mpl.doIntersectionPrivilege(ProtectionDomain.java:  74)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:  728)
	at java.awt.EventDispatchThread.pumpOneEventForFilter  s(EventDispatchThread.java:205)
	at java.awt.EventDispatchThread.pumpEventsForFilter(E  ventDispatchThread.java:116)
	at java.awt.EventDispatchThread.pumpEventsForHierarch  y(EventDispatchThread.java:105)
	at java.awt.EventDispatchThread.pumpEvents(EventDispa  tchThread.java:101)
	at java.awt.EventDispatchThread.pumpEvents(EventDispa  tchThread.java:93)
	at java.awt.EventDispatchThread.run(EventDispatchThre  ad.java:82)
TeensyPipeMonitor ctor, port=usb:14320000
disconnect
TeensyPipeMonitor open usb:14320000
opened, dev=/dev/cu.usbmodem61558201, name=Serial
TeensyPipeMonitor close
errorPipeListener thread exit
window_close
inputPipeListener exception: java.lang.InterruptedException: sleep interrupted
TeensyPipeMonitor close
inputPipeListener thread exit

The Arduino memory as shown in the video stops growing at around 700-820MB and CPU usage is around 88% while overflowing in the foreground or background but quickly drops to ~1% when the terminal window is closed. I hope your work here (this issue) is close to done :)

thanks
 
Last edited:
@bicycleguy - that is MAC right? ( dev=/dev/cu.usbmodem61558201 )

My Win only ORANGE text is this - expected - on some uploads: GUI update interrupted

My t_sermon was dead again when I came back - closed all but one IDE sketch and this is the only output in the window - no reason for it to die was reported.
Code:
Global variables use 20064 bytes (1%) of dynamic memory, leaving 1028512 bytes for local variables. Maximum is 1048576 bytes.
T:\arduino-1.8.9t4\hardware\teensy/../tools/teensy_post_compile -file=lps_test.ino -path=T:\TEMP\arduino_build_998999 -tools=T:\arduino-1.8.9t4\hardware\teensy/../tools -board=TEENSY40 -reboot -port=usb:0/140000/0/8/6 -portlabel=hid#vid_16c0&pid_0478 Bootloader -portprotocol=Teensy 
TeensyPipeMonitor open usb:0/140000/0/8/6
opened, dev=COM30, name=Serial

Upload again after that picked up running.
 
serialmon_speedup_7th_try.zip

iMac 2011 24GB ram, osx 10.13.6, arduino 1.8.9, td1.47

Plugin t4 with usb_serial_print_speed.ino already flashed.
Open arduino.
Open the serial monitor, sometime later it will stop printing lines. Close the serial monitor.

Did 53 attempts,
33% did not last longer than 15sec,
44% lasted between 15sec and 1min.
The remaining 23% lasted between 1min and 3min15sec.
Only one went past 3min.

cpu load was consistent for every attempt, arduino 25%, teensy_serialmon 85%.

no exceptions where thrown.
 
Here is screen effect - highlight across broken lines:
View attachment 17373

Ok, looks like I need to re-image my Windows 10 test machine....



I did get java errors, but they never seemed to cause problems. Typically when I closed the terminal window if it was overflowing I got the error.

Thanks for the detailed info. I believe I see what's happening, related to something still trying to access the data after the window has tried to close and I de-allocated it so your Mac wouldn't run out of memory! Doesn't happen on my Mac, but I have an idea to fix it, with dummy responses that let things finish up gracefully.


Open the serial monitor, sometime later it will stop printing lines.

This is a Mac specific problem which I can reproduce here on my Macbook Air... but not in seconds or even minutes. Sometimes it takes hours, but I have seen it happen. Looks like it's happening in the teensy_serialmon (which is Mac native using Apple's CoreFoundation API) before the data ever gets to Java.

Today I had to clean off my workbench, for inspecting PCBs and some other work. Will get the Macbook Air back in the morning and try to track this down. Feels like we're getting pretty close to having this actually work well on Macintosh....
 
Code:
 neurofun  
Open the serial monitor, sometime later it will stop printing lines.

This is a Mac specific problem which I can reproduce here on my Macbook Air... but not in seconds or even minutes. Sometimes it takes hours, but I have seen it happen. Looks like it's happening in the teensy_serialmon (which is Mac native using Apple's CoreFoundation API) before the data ever gets to Java.

Today I had to clean off my workbench, for inspecting PCBs and some other work. Will get the Macbook Air back in the morning and try to track this down. Feels like we're getting pretty close to having this actually work well on Macintosh....

I have a couple WINDOWS posts #4231 and #4333 above where the output halts with no notice to the IDE …

RE: "Here is screen effect - highlight across broken lines" - code aobve or this new variant - in case one or the other is different enough to work better.:
Code:
elapsedMillis emTick = 0;
void setup() {
  while (!Serial)    ;
  Serial.println("Starting up ... <nl>");
  for ( int ii = 2; ii < 12; ii++ ) {
    for ( int jj = 0; jj < ii; jj++ ) Serial.print(".");
    Serial.println("<nl>");
  }
  for ( int ii = 2; ii < 12; ii++ ) {
    for ( int jj = 0; jj < ii; jj++ ) {
      delayMicroseconds( 200 );
      Serial.print(".");
    }
    delayMicroseconds( 200 );
    Serial.println("<nl>");
  }
  delay ( 3000 );
}

void yield() {}
uint32_t deltaC = 0;
uint32_t count = 0;
void loop() {
  while (1) 
  {
    if (emTick < 5000) {
      delayMicroseconds( 200 );
      deltaC = count;
    }
    if (emTick > 6000) {
      deltaC = count - deltaC;
      Serial.printf("delta Count = %lu<nl>\n", deltaC);
      delay( 1000);
      emTick = 0;
      count = 0;
    }

    count++;
    //  if (!(count % 10)) Serial.printf(".");
    if (!(count % 10)) Serial.print(".");
    if ( !(count % 400) ) Serial.printf("%lu<nl>\n", count);
  }
}

Opened 2nd IDE instance running the lps.ino variant w/LED toggle - LED is toggling and the t_sermon is dead stop. It ran some short time and all the IDE console shows after upload is:
Code:
Sketch uses 13744 bytes (0%) of program storage space. Maximum is 2031616 bytes.
Global variables use 20064 bytes (1%) of dynamic memory, leaving 1028512 bytes for local variables. Maximum is 1048576 bytes.
T:\arduino-1.8.9t4\hardware\teensy/../tools/teensy_post_compile -file=lps_test.ino -path=T:\TEMP\arduino_build_560228 -tools=T:\arduino-1.8.9t4\hardware\teensy/../tools -board=TEENSY40 -reboot -port=usb:0/140000/0/8/2 -portlabel=COM37 Serial -portprotocol=Teensy 
TeensyPipeMonitor open usb:0/140000/0/8/2
opened, dev=COM37, name=Serial

[B]>>> After the Print Stops this is the start of the next Compile that restarts when upload completes[/B]
TeensyPipeMonitor close
inputPipeListener exception: java.lang.InterruptedException: sleep interrupted
TeensyPipeMonitor close
inputPipeListener thread exit
T:\arduino-1.8.9t4\arduino-builder -dump-prefs -logger=machine -hardware T:\arduino-1.8.9t4\hardware -hardware C:\Users\Tim\AppData\Local\Arduino15\packages -hardware T:\tCode\hardware -tools T:\arduino-1.8.9t4\tools-builder -tools T:\arduino-1.8.9t4\hardware\tools\avr -tools C:\Users\Tim\AppData\Local\Arduino15\packages -built-in-libraries T:\arduino-1.8.9t4\libraries -libraries T:\tCode\libraries -fqbn=teensy:avr:teensy40:usb=serial,speed=600,opt=o2std,keys=en-us -ide-version=10809 -build-path T:\TEMP\arduino_build_560228 -warnings=more -build-cache T:\TEMP\arduino_cache_977718 -verbose C:\Users\Tim\Documents\GitHub\T4_demo\pjrc_latency_test\lps_test\lps_test.ino
errorPipeListener thread exit
T:\arduino-1.8.9t4\arduino-builder -compile -logger=machine -hardware T:\arduino-1.8.9t4\hardware -hardware C:\Users\Tim\AppData\Local\Arduino15\packages -hardware T:\tCode\hardware -tools T:\arduino-1.8.9t4\tools-builder -tools T:\arduino-1.8.9t4\hardware\tools\avr -tools C:\Users\Tim\AppData\Local\Arduino15\packages -built-in-libraries T:\arduino-1.8.9t4\libraries -libraries T:\tCode\libraries -fqbn=teensy:avr:teensy40:usb=serial,speed=600,opt=o2std,keys=en-us -ide-version=10809 -build-path T:\TEMP\arduino_build_560228 -warnings=more -build-cache T:\TEMP\arduino_cache_977718 -verbose C:\Users\Tim\Documents\GitHub\T4_demo\pjrc_latency_test\lps_test\lps_test.ino
Using board 'teensy40' from platform in folder: T:\arduino-1.8.9t4\hardware\teensy\avr

Good news is the other instance working running the 'broken line dots" is fine - and it never seems to hang. It has shorter lines ".......................................17267200<nl>"

Versus the lps.ino printing {these always print perfectly} - BUT IT STOPS PRINTING like this partial line again:
>count=151784549, lines/sec=209833 >count=151784550, lines/sec=209833 >count=151784551, lines/sec=209833 >count=151784552, lines/sec=209833
>count=151784553, lines/sec=209833 >count=151784554, l

Stopped again in something under 20 minutes … just hit ENTER on the Send box and it restarted - nothing to console.
 
Last edited:
@neurofun - Please give this copy of teensy_serialmon a try on your Mac. Does it solve the mysterious stopping problem?

Inside the Arduino application, this goes into Contents/Java/hardware/tools.

I ran it here on 2 different Macs, one with the latest Mojave and a very old machine with Lion (10.7.5). But neither of my machines reproduces the problem quickly.
 

Attachments

  • teensy_serialmon_macintosh.zip
    19.3 KB · Views: 77
I have a couple WINDOWS posts #4231 and #4333 above where the output halts with no notice to the IDE …

I'll look into this next. First, need to re-image my Windows test machine & get it to boot up again...

Even though the symptoms may be very similar, I can tell you Microsoft's WIN32 API is nothing like Apple's CoreFoundation & BSD Unix APIs. There's no shared code between teensy_serialmon.exe on Windows and teensy_serialmon on Macintosh. Only the Java part is the same on both systems.

But whether the issue is in the native WIN32 part or on the Java side, I do not know yet. Will start investigating soon.
 
<edit> cross post ... okay. It is finicky - but at least I knwo you saw the messages ...
@neurofun - Please give this copy of teensy_serialmon a try on your Mac. Does it solve the mysterious stopping problem?

Inside the Arduino application, this goes into Contents/Java/hardware/tools.

I ran it here on 2 different Macs, one with the latest Mojave and a very old machine with Lion (10.7.5). But neither of my machines reproduces the problem quickly.

That isn't expected to fix stoppage on Windows?

I put a seconds counter on the end of the string so I'd know the run time - and it has not stopped as fast as it was before - current run 37 minutes …
 
With TWO IDE instances - I had one running the 'broken dot lines' and the other the LPS variant that was last uploaded.

So I pushed the Button on 'broken dot' T4 and in 8 seconds it died … at the end of the full line:
>count=12167329, lines/s=270444 >count=12167330, lines/s=270444 >count=12167331, lines/s=270444 >count=12167332, lines/s=270444 8
>count=121

That other one is now at 2627 seconds and counting after a couple restarts for looking about that high - so I restarted it … then looking back at 8 second unit … it was running - either it was on a long pause, or when I uploaded to other T4 it woke up? Leaving them alone for now - will watch that if either hung after Zzz's.

Indeed the one hung again at 15 seconds … Button on the Other one started the hung one?

<updated>
INDEED:: Third try powering both on at the same time one hung at 24 secs - the other was running at 54. I Button hit the 54 sec T4 and while it was programmed the 24 sec T4 jumped to 54 seconds.

Note - initial hangs were under one IDE instance - I was just trying to double the odds of catching it - and also test Twin IDE serMon.

>> Also: these strings both exhibit the 'vertical pixel jiggle' - the line shift on scroll not always making the same place to write - other output string don't exhibit that - maybe it is the speed of print that makes it obvious.

Current code with LED Toggle and printed second is this:
Code:
uint32_t count, prior_count;
uint32_t prior_msec;
uint32_t count_per_second;

bool flip = true;
void setup() {
  Serial.begin(1000000); // edit for highest baud your board can use
  while (!Serial) ;
  count = 10000000; // starting with 8 digits gives consistent chars/line
  prior_count = count;
  count_per_second = 0;
  prior_msec = millis();
  pinMode( LED_BUILTIN, OUTPUT );
  digitalWriteFast( LED_BUILTIN, flip );
}

void loop() {
  while (1) {
    Serial.print(" >count=");
    Serial.print(count);
    Serial.print(", lines/s=");
    Serial.print(count_per_second);
    if ( !(count % 4) ) {
      Serial.print(' ');
      Serial.println(millis()/1000);
    }
    count = count + 1;
    uint32_t msec = millis();
    if (msec - prior_msec > 1000) {
      flip = !flip;
      digitalWriteFast( LED_BUILTIN, flip );
      prior_msec = prior_msec + 1000;
      count_per_second = count - prior_count;
      prior_count = count;
    }
  }
}

>> Just noticed twin IDE t_sermon's are both showing ~275K lines per second - up from 230K when running one - of course 3 of the four are on the same 'line' now.
 
Last edited:
serialmon_speedup_7th_try.zip - teensy_serialmon_macintosh.zip

@neurofun - Please give this copy of teensy_serialmon a try on your Mac. Does it solve the mysterious stopping problem?

Inside the Arduino application, this goes into Contents/Java/hardware/tools.

I ran it here on 2 different Macs, one with the latest Mojave and a very old machine with Lion (10.7.5). But neither of my machines reproduces the problem quickly.

Ran the test on 2 Macs,
iMac 2011 24GB ram, osx 10.13.6, arduino 1.8.9, td1.47
MacBook Pro, early 2011, i7 2.0GHz, 8GB ram, osx 10.12.6, arduino 1.8.9, td1.47

The results are identical to my previous test, posted higher up on this page. https://forum.pjrc.com/threads/54711-Teensy-4-0-First-Beta-Test?p=214032&viewfull=1#post214032
iow, no noticeable change in behaviour.
 
The results are identical to my previous test
...
iow, no noticeable change in behaviour.

I'm afraid I'm running out of ideas to improve things on your Mac (and hopefully all Macintosh machines). Any chance you can tell me some info about what's happening when the output stops printing? Is the "teensy_serialmon" program still running? Not sure if Mac's Activity Monitor will show it if not using any CPU time. You might have to try "ps -aux | grep teensy_serialmon" in Terminal to check if the process is still running.

Could you try running teensy_serialmon in a Terminal window? To run it, type "./teensy_serialmon usb:########" where the eight "#" are the address for the USB port with Teensy. You'll see that address in the lower right corner of the Arduino window. Does it keep printing in the Terminal window, or also stop?

The original teensy_serialmon would stop on my Macbook Air, usually within 30 to 60 minutes. I ran it for an hour last night, before putting the Mac away and trying to get Windows going and updated.
 
Can you run "ls -l teensy_serialmon" and verify the size of the file? Just to make sure this really is the new version?

I'm really stuck now. The old version did this on my Mac, usually after 30 minutes but it would eventually stop. So far I've only run the new one about a hour... then I starting trying to set up to test Windows, but got bogged down in that Windows machine doing extremely slow Windows update.

Maybe I'll set the Macbook Air test up on a shelf somewhere, so I can let it run much longer....
 
Can you run "ls -l teensy_serialmon" and verify the size of the file? Just to make sure this really is the new version?

I am sure it is the new version since I ran it straight from the download folder.
Code:
iMac27-i5:~ xxx$ cd /Users/xxx/Downloads 
iMac27-i5:Downloads xxx$ ls -l teensy_serialmon
-rwxr-xr-x@ 1 xxx  staff  50192 Aug 29 01:26 teensy_serialmon
 
@PaullStoffregen - Not sure if this is related to your latest changes for windows... I think I am running attempt 6? ...

But I had a sketch running for a long time, which was not at that point doing anything to the serial monitor. But then hit the key to do an upload and the build failed with:
Code:
TeensyPipeMonitor close
inputPipeListener exception: java.lang.InterruptedException: sleep interrupted
TeensyPipeMonitor close
inputPipeListener thread exit
D:\arduino-1.8.9\arduino-builder -dump-prefs -logger=machine -hardware D:\arduino-1.8.9\hardware -hardware C:\Users\kurte\AppData\Local\Arduino15\packages -hardware C:\Users\kurte\Documents\Arduino\hardware -tools D:\arduino-1.8.9\tools-builder -tools D:\arduino-1.8.9\hardware\tools\avr -tools C:\Users\kurte\AppData\Local\Arduino15\packages -built-in-libraries D:\arduino-1.8.9\libraries -libraries C:\Users\kurte\Documents\Arduino\libraries -fqbn=teensy:avr:teensy40:usb=serial,speed=600,opt=o2std,keys=en-us -ide-version=10809 -build-path C:\Users\kurte\AppData\Local\Temp\arduino_build_94708 -warnings=all -build-cache C:\Users\kurte\AppData\Local\Temp\arduino_cache_576151 -verbose C:\Users\kurte\Documents\Arduino\Teensy Tests\SSD1351_graphicstest\SSD1351_graphicstest.ino
errorPipeListener thread exit
FindFirstFile C:\Users\kurte\AppData\Local\Temp\arduino_build_94708: The system cannot find the file specified.

Error compiling for board Teensy 4.0.
TeensyPipeMonitor open usb:0/140000/0/3/1/1
FifoDocument.getText *****NEGATIVE NUMBER ERROR*****
opened, dev=COM32, name=Serial

Actually at this point I believe Norton had decided to cleanup my temp directory and removed the build directory... As If I then try to compile again:
Code:
TeensyPipeMonitor close
inputPipeListener exception: java.lang.InterruptedException: sleep interrupted
TeensyPipeMonitor close
inputPipeListener thread exit
D:\arduino-1.8.9\arduino-builder -dump-prefs -logger=machine -hardware D:\arduino-1.8.9\hardware -hardware C:\Users\kurte\AppData\Local\Arduino15\packages -hardware C:\Users\kurte\Documents\Arduino\hardware -tools D:\arduino-1.8.9\tools-builder -tools D:\arduino-1.8.9\hardware\tools\avr -tools C:\Users\kurte\AppData\Local\Arduino15\packages -built-in-libraries D:\arduino-1.8.9\libraries -libraries C:\Users\kurte\Documents\Arduino\libraries -fqbn=teensy:avr:teensy40:usb=serial,speed=600,opt=o2std,keys=en-us -ide-version=10809 -build-path C:\Users\kurte\AppData\Local\Temp\arduino_build_94708 -warnings=all -build-cache C:\Users\kurte\AppData\Local\Temp\arduino_cache_576151 -verbose C:\Users\kurte\Documents\Arduino\Teensy Tests\SSD1351_graphicstest\SSD1351_graphicstest.ino
errorPipeListener thread exit
FindFirstFile C:\Users\kurte\AppData\Local\Temp\arduino_build_94708: The system cannot find the file specified.

Error compiling for board Teensy 4.0.
TeensyPipeMonitor open usb:0/140000/0/3/1/1
opened, dev=COM32, name=Serial
So need to restart Arduino...
 
@Paul - both T4's running that p#4240 lps.ino still this AM - was like 20K seconds … 6 hours.

Restarted both - both ran again a couple of minutes.

Restarted both again - one stopped at 2 seconds while the other ran. Instead of upload I just unpowered the running T4 and immediately the stalled T4 picked up running.

two things:
> If it fails on Windows it can fail early with regularity in less than 30 seconds from power on
> when it fails - it seems another teensy USB event can wake it: Incoming USB, 2nd Teensy upload, 2nd Teensy power down

<edit/Update.
Spent some short time in between other stuff trying to see REPRO - they didn't happen as much - restarted both IDE's and T4's Just found the one stalled with this at 2851 seconds:
Code:
 >count=778225137, lines/s=277153 >count=778225138, lines/s=277153 >count=778225139, lines/s=277153 >count=778225140, lines/s=277153 2851
 >count=778225141, lines/s=277153 >count=778225142, lines/s=277153 >count=778225143, lines

When I powered down the running T4 - the instant it went off the second T4 picked up running some hundreds of seconds in advance. If I had captured the counts I could say if it thought it was running lines that just were not making it to the GUI output, but that is hindsight.

>> Two more restarts failed at 1708 seconds then the next hanging at 405 seconds. This is with twin IDEs to Twin T4's on SerMon. The one that started at the same time as the one stopped now at 405 seconds is still running at 8657 seconds. So it just goes 'to sleep' while the T4 runs as it evidenced by the LED blinking toggle each second.

Interesting? Again two IDE instances - one T4 each - above hang persisted 405 versus 8657 seconds only the running one was over 13,000 now. Wondering how else to WAKE the sleeping t_sermon in case it pointed to the problem - I closed the running t-Sermon and immediately the Sleeping t_sermon awoke to running. Not sure if the T4 USB has gone to sleep [ due to some PC interaction ] or if the PC code is asleep and not processing USB from the T4?
<edit> - just got one sleeping and repeated the above - it may be the 2nd t-sermon coming back open after closing that restarts the first t_sermon from sleep - it was that this time.
Additionally I put in code on the one second toggle to do this and it detects closing of t_sermon as expected - but this code did NOT trigger when the t_sermon goes to sleeping - so Serial is seen as active:
Code:
    if (msec - prior_msec > 1000) {
      flip = !flip;
      digitalWriteFast( LED_BUILTIN, flip );
      if ( !Serial ) {
        delay( 50 );
        flip = !flip;
        digitalWriteFast( LED_BUILTIN, flip );
      }
// ...

Only other thing I can try to add would be enable the Serial4 PRINT_DEBUG_STUFF to see if any debug messages come about as the IDE T-sermon goes sleeping?

<Update:> Not sure if this adds anything - after running 8 hours one of the two T4's output to t_sermon froze again at 28,000+ seconds while the other was running over 30K seconds.
There is a third unpowered T4 on the same hub. I powered that T4 and when it came online the frozen/sleeping t_sermon woke up.
> That T4 is not connected to any SerMon - TLoader is active - but just waking up and adding the device to the active USB list resulted in the return to operation of the sleeping T4 t_sermon.
Nothing compelling looking on either IDE instance as far as Error or info messages - both look about like this with various restarts in the past day:
Code:
Opening Teensy Loader...

"T:\\arduino-1.8.9t4\\hardware\\teensy/../tools/arm/bin/arm-none-eabi-size" -A "T:\\TEMP\\arduino_build_244486/Try6_SerMon.ino.elf"
Sketch uses 32704 bytes (1%) of program storage space. Maximum is 2031616 bytes.
Global variables use 35872 bytes (3%) of dynamic memory, leaving 1012704 bytes for local variables. Maximum is 1048576 bytes.
T:\arduino-1.8.9t4\hardware\teensy/../tools/teensy_post_compile -file=Try6_SerMon.ino -path=T:\TEMP\arduino_build_244486 -tools=T:\arduino-1.8.9t4\hardware\teensy/../tools -board=TEENSY40 -reboot -port=usb:0/140000/0/8/6 -portlabel=hid#vid_16c0&pid_0478 Bootloader -portprotocol=Teensy 
TeensyPipeMonitor open usb:0/140000/0/8/6
opened, dev=COM30, name=Serial
disconnect
opened, dev=COM30, name=Serial
disconnect
opened, dev=COM30, name=Serial
disconnect
opened, dev=COM30, name=Serial
disconnect
opened, dev=COM30, name=Serial
disconnect
opened, dev=COM30, name=Serial
FifoDocument.getText *****NEGATIVE NUMBER ERROR*****
TeensyPipeMonitor close
inputPipeListener exception: java.lang.InterruptedException: sleep interrupted
TeensyPipeMonitor close
window_close
errorPipeListener thread exit
inputPipeListener thread exit
TeensyPipeMonitor ctor, port=usb:0/140000/0/8/6
disconnect
TeensyPipeMonitor open usb:0/140000/0/8/6
opened, dev=COM30, name=Serial
disconnect
opened, dev=COM30, name=Serial
disconnect
opened, dev=COM30, name=Serial
TeensyPipeMonitor close
inputPipeListener exception: java.lang.InterruptedException: sleep interrupted
TeensyPipeMonitor close
window_close
errorPipeListener thread exit
inputPipeListener thread exit
TeensyPipeMonitor ctor, port=usb:0/140000/0/8/6
disconnect
TeensyPipeMonitor open usb:0/140000/0/8/6
opened, dev=COM30, name=Serial
disconnect
opened, dev=COM30, name=Serial
disconnect
opened, dev=COM30, name=Serial
disconnect
opened, dev=COM30, name=Serial
 
Last edited:
@Paul - perhaps this is on your list - part of update to USB Stack - but Serial.available() when it gets a first count of incoming characters does not update for additional incoming characters.

Noted in this thread with repro sketches: Teensy-4-0-Serial-available()-stops-incrementing
@noisymime - went into code a bit and :: 'best as I can tell, the serial RX interrupt is being disabled '

If is breaking a group of users: Teensy-4-0-Speeduino-compile-fail
'Yeah, so I'm just going to put the Teensy 4 aside for a little bit. It's got some semi-serious bugs in the serial comms that need to be worked out'
 
@Paul - posted test of pull request code change to get lowest MCU voltage on T4 <=24MHz


Put that same speed drop to 24 MHz on T4 into the LPS.ino test that was hitting at/over 250K lps and at 24 MHz the T4 is showing 37K lps - that same modified LP.ino test code on T_3.6 at 256 MHz gives 27K lps.

--- results are approx. because there are two T4 instances running and they feed on each other.
>> 24 MHz the T4 is showing 37K lps
>> 120 (and 180) MHz the T4 is showing 147K lps
>> 240 MHz the T4 is showing 225K lps { Jumps to 280K with two instances of t_sermon }

That result at 240 MHz matches the throughput at 600 MHz, so that suggests it has room to increase - even if a PC can't handle it, and shows the T4 isn't really working hard with current USB even in its current state.
 
Lost a couple more days... things have been crazy busy here... but back on this now.

Committed a fix for the NullPointerException error bicycleguy reported in msg #4232.

https://github.com/PaulStoffregen/A...mmit/17560d86681f835426dab0fdf545a422c2b42f07

Next up, I'm going to test with Windows and see if I can reproduce the incomplete lines defragster reported in msg #4230, with code on msg #4220.

I had to return that Mac which sometimes reproduced the teensy_serialmon stopping problem. Hoping I can get it back later today for more testing.
 
Status
Not open for further replies.
Back
Top