Teensy 4.0 First Beta Test

Status
Not open for further replies.
The reverse lines per second seems to be working at the same rate on PC: PC sends 19K strings to T4 sketch that counts \n and then the string to Serial2 once per second:

Code:
count= 10976993, lines per second=18893.
[COLOR="#FF0000"]count= 10996057, lines per second=[/COLOR]19064.  // [COLOR="#FF0000"]PC SENDS THIS[/COLOR]
count= 11014347, lines per second=18290.
count= 11032841, lines per second=18494.
count= 11051516, lines per second=[COLOR="#FF0000"]18675[/COLOR]. // [COLOR="#FF0000"]T4 calculates and appends this with print[/COLOR]
count= 11070233, lines per second=18717.

PC code uses same lps_test code with 'S' for send as param 2 - will post later.

There is some ECHO anomaly above with println('.'); is generally correct but with code as follows { #if 1 versus #if 0} I get a lot of this:
Code:
count= 10969835, lines per second=18854
count= 10988580, lines per second=187[COLOR="#FF0000"]45[/COLOR]

[COLOR="#FF0000"]45
[/COLOR]count= 11007214, lines per second=186[COLOR="#FF0000"]34[/COLOR]

[COLOR="#FF0000"]34
[/COLOR]count= 11026041, lines per second=18827

Output above using TyCommander - similar from using IDE SerMon - so seems to be a bug somewhere as T_3.5 gets it Serial2 then it sends out USB … will send text OUT Serial to PC and have it print instead:
Code:
count= 10465392, lines per second=19022
22
count= 10484416, lines per second=19024
count= 10503446, lines per second=19030
30
count= 10522287, lines per second=18841
count= 10540880, lines per second=18593
93
count= 10559403, lines per second=18523
23
count= 10578191, lines per second=18788
count= 10596470, lines per second=18279
79
count= 10615171, lines per second=18701
01
count= 10634039, lines per second=18868
count= 10652267, lines per second=18228

Code:
uint32_t count, prior_count;
uint32_t prior_msec;
uint32_t count_per_second;

void setup() {
  Serial.begin(1000000);
  Serial2.begin(2000000);
  //  while (!Serial) ;
  count = 10000000;
  prior_count = count;
  count_per_second = 0;
  prior_msec = millis();
}
void yield() {}
void loop() {
  char c;
  int ii = 0;
  char buf[100];
  while (Serial.available()) {
    c = Serial.read();
    if (c == '\n') {
      count = count + 1;
      uint32_t msec = millis();
      if (msec - prior_msec > 1000) {
        prior_msec = prior_msec + 1000;
        count_per_second = count - prior_count;
        prior_count = count;
        buf[ii] = 0;
        Serial2.print(buf);
#if 1 // this is showing echo on print of last digits of count_per_second and newlines
        Serial2.println(count_per_second);
#else
        Serial2.print(count_per_second);
        Serial2.println('.');
#endif
        ii = 0;
      }
    }
    else {
      buf[ii++] = c;
    }
  }
}
 
Here's a taste of the coming USB optimizations....

I haven't committed this on github yet (but it does require the new schedule_transfer fix which I committed only an hour ago). Tihs still has substantial bugs. No need to report the issues, I'm aware and this is still very much a work in progress. But if you're having too much fun running benchmarks, look what this does to the lines/sec speed. :D

At least until it locks up. It will always eventually freeze up with never ending Serial4 "spew". But usually it runs for quite some time so you can see the sort of speed that's possible.
 

Attachments

  • usb_serial.c
    10.9 KB · Views: 99
Here's a taste of the coming USB optimizations....

I haven't committed this on github yet (but it does require the new schedule_transfer fix which I committed only an hour ago). Tihs still has substantial bugs. No need to report the issues, I'm aware and this is still very much a work in progress. But if you're having too much fun running benchmarks, look what this does to the lines/sec speed. :D

At least until it locks up. It will always eventually freeze up with never ending Serial4 "spew". But usually it runs for quite some time so you can see the sort of speed that's possible.

Now I think you are having fun with USB optimizations :)
 
@PaulStoffregen and others

WOW!!!!

Before it hangs getting somewhere 100K lps! 95-113K to be closer to what I am seeing...
 
FWIW, the theoretical maximum for 480 Mbit/sec USB is 1521371 lines/sec.

I'm seeing about 10% of that here (~150K lines/sec), before it locks up. Still so much more is possible!
 
8) - Yup runs pretty fast :D
Last line before it hung: count=12309685, lines/sec=173172

Windows 10... This is also using Paul's first post for test output to Serial monitor:
Serial4 shows lots of 00400080 messages, which is expected as per post...
 
Win10 here shows 99K with lps_test.exe, SerMon and TyComm.

TyComm seems to be getting overwhelmed at times? And fading after some peaks over 100-120K.

Not news I suspect, but this didn't affect the Reverse lines per sec - with T4 receiving from PC's exe test still at 19K

I've got other tasks today …
 
OK All

I broke down and actually installed unbutu along side my windows 7 install on a old laptop. I got Arduino 1.8.9 installed and now have no idea how to install teensyduino or the udev-rules file. Anyone care to share the install steps.

Found this:
Code:
cd Desktop
sudo cp 49-teensy.rules /etc/udev/rules.d/
but the following doesnt make sense:
Code:
tar -xvzf teensy_linux64.tar.gz
./teensy &
since i just downloaded teensyduino.linux64

EDIT2: Found it all on https://www.pjrc.com/teensy/td_download.html#linux_issues

EDIT: Happy Happy Joy Joy - loaded Blink to T4B1 and it worked!
 
Last edited:
Hi @mjs513...

I am not the biggest Linux expert, but been playing with it for a few years (mainly on secondary machines and or RPI or BBBK or, UP boards...).

What I do is to install Arduino and Teensyduino...

Sounds like you already part way there...

What I typically do is use Firefox to download Teensyduino...
Then I open a command prompt and get to the download directory: <CTRL><ALT>T

Then you need to mark the file the Teensyduino file you downloaded as executable: chmod +x <teensyduino file name>
Note: Tab key works great for filling in things, so I just type teen<tab> and it hopefully gets the full file name
Then I simply type: ./teensy<tab> ... fills in name, hit enter and hopefully it runs...

Forgot to mention sometimes, whn you have all of those .tar.gz or .xz or ...
I let the gui handle for me. Use their file browser, and double click on it... maybe opens another window... Until it gets down to underlying directory. I then drag and drop the directory to some location like the desktop
 
Hi @mjs513...

I am not the biggest Linux expert, but been playing with it for a few years (mainly on secondary machines and or RPI or BBBK or, UP boards...).

What I do is to install Arduino and Teensyduino...

Sounds like you already part way there...

What I typically do is use Firefox to download Teensyduino...
Then I open a command prompt and get to the download directory: <CTRL><ALT>T

Then you need to mark the file the Teensyduino file you downloaded as executable: chmod +x <teensyduino file name>
Note: Tab key works great for filling in things, so I just type teen<tab> and it hopefully gets the full file name
Then I simply type: ./teensy<tab> ... fills in name, hit enter and hopefully it runs...

Forgot to mention sometimes, whn you have all of those .tar.gz or .xz or ...
I let the gui handle for me. Use their file browser, and double click on it... maybe opens another window... Until it gets down to underlying directory. I then drag and drop the directory to some location like the desktop

Thanks Kurt - Got everything installed and did a test run with blink on the T4B1 and it worked. I need to get a notebook and start writing this stuff down :) Sometimes windows does things easier at least for me. At least now I can try out some of this stuff on Linux if I want
 
Thanks Kurt - Got everything installed and did a test run with blink on the T4B1 and it worked. I need to get a notebook and start writing this stuff down :) Sometimes windows does things easier at least for me. At least now I can try out some of this stuff on Linux if I want

You are welcome, glad you got it up and running...
Been there... Not sure if any of it would be beneficial, but my first Linux install was for an RPI2 and then I went through trying several different boards.... While I was doing it, I would forget things, so I kept adding notes to myself about different things in my Raspberry PI project, which included porting some of my Hexapod code and the like to run on RPI...)

The notes are in the Readme file of the project: https://github.com/KurtE/Raspberry_Pi
 
Been experimenting with the lockup problem. Many times I thought I found something useful, only to have a particularly long run turn out to be dumb luck.

One thing I've noticed that really does seem to have a major impact is the CPU speed. It's *much* happier if I overclock. Just did a run where it kept printing for an hour with the CPU running at 720 MHz. Running slower, like 528 MHz or the default 396 MHz seems to cause a lockup pretty quickly.
 
Strange upload behavior with T4B2:

I just installed 1.8.9 and 1.47-beta1 on linux64 (ubuntu 16.04). Sketches upload/run just fine on T4B2. I get latest cores/ from github. Sketches still upload/run fine. I comment out first line in printf.h to disable debug printf, and now T4B2 sketches won't upload unless I press the program button. If I uncomment the first line in printf.h, then uploads/run work again.

I have 32-bit linux (16.04), 1.8.8 and latest cores/ on a laptop, and T4B2 uploads/runs sketches just fine with printf disabled. So I don't know if it's difference with 1.8.8 or with 32vs64-bit linux, or ?? NOT

EDIT: installed 1.8.8 on linux64 and it has the same behavior as 1.8.9.

Code:
Teensy did not respond to a USB-based request to enter program mode.
       An error occurred while uploading the sketch
       Please press the PROGRAM MODE BUTTON on your Teensy to upload your sketch

Ooops, i was mistaken, i see the same upload failure on my linux laptop.
 
Last edited:
Strange upload behavior with T4B2:

I just installed 1.8.9 and 1.47-beta1 on linux64 (ubuntu 16.04). Sketches upload/run just fine on T4B2. I get latest cores/ from github. Sketches still upload/run fine. I comment out first line in printf.h to disable debug printf, and now T4B2 sketches won't upload unless I press the program button. If I uncomment the first line in printf.h, then uploads/run work again.

I have 32-bit linux (16.04), 1.8.8 and latest cores/ on a laptop, and T4B2 uploads/runs sketches just fine with printf disabled. So I don't know if it's difference with 1.8.8 or with 32vs64-bit linux, or ??

EDIT: installed 1.8.8 on linux64 and it has the same behavior as 1.8.9.

Code:
Teensy did not respond to a USB-based request to enter program mode.
       An error occurred while uploading the sketch
       Please press the PROGRAM MODE BUTTON on your Teensy to upload your sketch

Ooops, i was mistaken, i see the same upload failure on my linux laptop.
Interesting i just downloaded everything fresh and am getting this error on linux:
Code:
/opt/arduino-1.8.9/hardware/teensy/avr/cores/teensy4/startup.c:336:3: warning: implicit declaration of function 'printf_debug' [-Wimplicit-function-declaration]
   printf_debug("\nFault irq %d\n", addr & 0x1FF);
   ^
I used the linux64 bit version.

EDIT: Just for the record i forgot to update the core from Github - so used to being on windows. But yep you are right
 
Last edited:
lpt_test.exe ran here some large number of lines/sec msgs - I asked for 10M iterations of filling a 4K buffer and it completed. Looks like ~790 buffers per second would be 12.6K seconds or 3.3 hours for a 33 byte message and 98K messages per second.

Just started it again and passed 1.5 million buffers transferred.

It only seems fragile on the start and stop - or using a SerMon/TyComm - perhaps the way they manage buffers - or the PC buffering the USB spew - and transmit everything to GUI - lps_test.exe only pushes one line per 4K buffer and the cmdline UI seems to be keeping up cycling between 96-99K lines/sec.

Sketch msg output is framed between >> 'msg' << and the # at line start is the 4K buffer index::
Code:
#1038769 : __>> [COLOR="#FF0000"]count=136501379, lines/sec=98804[/COLOR] <<__

<update> :: 34 minutes later still running from 1.5M to 3.17M - stable running isn't the issue - now at 3.3M filled 4K buffers of ~33 byte messages
#3175450 : __>> count=393562881, lines/sec=97683 <<__

On my T4 - I've been doing a button press partly that it isn't working perhaps - but mostly it is easier than stopping an open Serial USB Client. So will expect that to work later.

Indeed IDE Serial Monitor is hacing memory issues as I foudn this:
Code:
Exception in thread "AWT-EventQueue-0" java.lang.OutOfMemoryError: Java heap space
	at javax.swing.text.GapContent.allocateArray(GapContent.java:94)
	at javax.swing.text.GapVector.resize(GapVector.java:214)
	at javax.swing.text.GapVector.shiftEnd(GapVector.java:229)
	at javax.swing.text.GapContent.shiftEnd(GapContent.java:345)
	at javax.swing.text.GapVector.open(GapVector.java:201)
	at javax.swing.text.GapVector.replace(GapVector.java:142)
	at javax.swing.text.GapContent.insertString(GapContent.java:132)
	at javax.swing.text.AbstractDocument.handleInsertString(AbstractDocument.java:723)
	at javax.swing.text.AbstractDocument.insertString(AbstractDocument.java:707)
	at javax.swing.text.PlainDocument.insertString(PlainDocument.java:130)
	at javax.swing.JTextArea.append(JTextArea.java:477)
	at processing.app.AbstractTextMonitor.updateTextArea(AbstractTextMonitor.java:185)
	at processing.app.AbstractTextMonitor.lambda$message$0(AbstractTextMonitor.java:175)
	at processing.app.AbstractTextMonitor$$Lambda$149/2589222.run(Unknown Source)
	at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
	at java.awt.EventQueue.dispatchEventImpl(EventQueue.java: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$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:728)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:205)
	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
Exception in thread "AWT-EventQueue-0" java.lang.OutOfMemoryError: Java heap space
	at javax.swing.text.GapContent.allocateArray(GapContent.java:94)
	at javax.swing.text.GapVector.resize(GapVector.java:214)
	at javax.swing.text.GapVector.shiftEnd(GapVector.java:229)
	at javax.swing.text.GapContent.shiftEnd(GapContent.java:345)
	at javax.swing.text.GapVector.open(GapVector.java:201)
	at javax.swing.text.GapVector.replace(GapVector.java:142)
	at javax.swing.text.GapContent.insertString(GapContent.java:132)
	at javax.swing.text.AbstractDocument.handleInsertString(AbstractDocument.java:723)
	at javax.swing.text.AbstractDocument.insertString(AbstractDocument.java:707)
	at javax.swing.text.PlainDocument.insertString(PlainDocument.java:130)
	at javax.swing.JTextArea.append(JTextArea.java:477)
	at processing.app.AbstractTextMonitor.updateTextArea(AbstractTextMonitor.java:185)
	at processing.app.AbstractTextMonitor.lambda$message$0(AbstractTextMonitor.java:175)
	at processing.app.AbstractTextMonitor$$Lambda$149/2589222.run(Unknown Source)
	at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
	at java.awt.EventQueue.dispatchEventImpl(EventQueue.java: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$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:728)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:205)
	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
Exception in thread "AWT-EventQueue-0" java.lang.OutOfMemoryError: Java heap space
	at javax.swing.text.GapContent.allocateArray(GapContent.java:94)
	at javax.swing.text.GapVector.resize(GapVector.java:214)
	at javax.swing.text.GapVector.shiftEnd(GapVector.java:229)
	at javax.swing.text.GapContent.shiftEnd(GapContent.java:345)
	at javax.swing.text.GapVector.open(GapVector.java:201)
	at javax.swing.text.GapVector.replace(GapVector.java:142)
	at javax.swing.text.GapContent.insertString(GapContent.java:132)
	at javax.swing.text.AbstractDocument.handleInsertString(AbstractDocument.java:723)
	at javax.swing.text.AbstractDocument.insertString(AbstractDocument.java:707)
	at javax.swing.text.PlainDocument.insertString(PlainDocument.java:130)
	at javax.swing.JTextArea.append(JTextArea.java:477)
	at processing.app.AbstractTextMonitor.updateTextArea(AbstractTextMonitor.java:185)
	at processing.app.AbstractTextMonitor.lambda$message$0(AbstractTextMonitor.java:175)
	at processing.app.AbstractTextMonitor$$Lambda$149/2589222.run(Unknown Source)
	at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
	at java.awt.EventQueue.dispatchEventImpl(EventQueue.java: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$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:728)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:205)
	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
Exception in thread "AWT-EventQueue-0" java.lang.OutOfMemoryError: Java heap space
	at javax.swing.text.GapContent.allocateArray(GapContent.java:94)
	at javax.swing.text.GapVector.resize(GapVector.java:214)
	at javax.swing.text.GapVector.shiftEnd(GapVector.java:229)
	at javax.swing.text.GapContent.shiftEnd(GapContent.java:345)
	at javax.swing.text.GapVector.open(GapVector.java:201)
	at javax.swing.text.GapVector.replace(GapVector.java:142)
	at javax.swing.text.GapContent.insertString(GapContent.java:132)
	at javax.swing.text.AbstractDocument.handleInsertString(AbstractDocument.java:723)
	at javax.swing.text.AbstractDocument.insertString(AbstractDocument.java:707)
	at javax.swing.text.PlainDocument.insertString(PlainDocument.java:130)
	at javax.swing.JTextArea.append(JTextArea.java:477)
	at processing.app.AbstractTextMonitor.updateTextArea(AbstractTextMonitor.java:185)
	at processing.app.AbstractTextMonitor.lambda$message$0(AbstractTextMonitor.java:175)
	at processing.app.AbstractTextMonitor$$Lambda$149/2589222.run(Unknown Source)
	at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
	at java.awt.EventQueue.dispatchEventImpl(EventQueue.java: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$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:728)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:205)
	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
Exception in thread "AWT-EventQueue-0" java.lang.OutOfMemoryError: Java heap space
Exception in thread "AWT-EventQueue-0" java.lang.OutOfMemoryError: Java heap space
Exception in thread "AWT-EventQueue-0" java.lang.OutOfMemoryError: Java heap space
Exception in thread "AWT-EventQueue-0" java.lang.OutOfMemoryError: Java heap space
Exception in thread "AWT-EventQueue-0" java.lang.OutOfMemoryError: Java heap space
Exception in thread "AWT-EventQueue-0" java.lang.OutOfMemoryError: Java heap space
Exception in thread "AWT-EventQueue-0" java.lang.OutOfMemoryError: Java heap space
Exception in thread "AWT-EventQueue-0" java.lang.OutOfMemoryError: Java heap space
Exception in thread "AWT-EventQueue-0" java.lang.OutOfMemoryError: Java heap space
Exception in thread "AWT-EventQueue-0" java.lang.OutOfMemoryError: Java heap space
Exception in thread "AWT-EventQueue-0" java.lang.OutOfMemoryError: Java heap space
Exception in thread "AWT-EventQueue-0" java.lang.OutOfMemoryError: Java heap space
Exception in thread "AWT-EventQueue-0" java.lang.OutOfMemoryError: Java heap space
Exception in thread "AWT-EventQueue-0" java.lang.OutOfMemoryError: Java heap space
Exception in thread "AWT-EventQueue-0" java.lang.OutOfMemoryError: Java heap space
Exception in thread "AWT-EventQueue-0" java.lang.OutOfMemoryError: Java heap space
Exception in thread "AWT-EventQueue-0" java.lang.OutOfMemoryError: Java heap space
Exception in thread "AWT-EventQueue-0" java.lang.OutOfMemoryError: Java heap space
Exception in thread "AWT-EventQueue-0" java.lang.OutOfMemoryError: Java heap space
Exception in thread "AWT-EventQueue-0" java.lang.OutOfMemoryError: Java heap space
Exception in thread "AWT-EventQueue-0" java.lang.OutOfMemoryError: Java heap space
Exception in thread "AWT-EventQueue-0" java.lang.OutOfMemoryError: Java heap space
Exception in thread "AWT-EventQueue-0" java.lang.OutOfMemoryError: Java heap space
Exception in thread "AWT-EventQueue-0" java.lang.OutOfMemoryError: Java heap space
Exception in thread "AWT-EventQueue-0" java.lang.OutOfMemoryError: Java heap space
Exception in thread "AWT-EventQueue-0" java.lang.OutOfMemoryError: Java heap space
Exception in thread "AWT-EventQueue-0" java.lang.OutOfMemoryError: Java heap space
Exception in thread "AWT-EventQueue-0" java.lang.OutOfMemoryError: Java heap space
Exception in thread "AWT-EventQueue-0" java.lang.OutOfMemoryError: Java heap space
Exception in thread "AWT-EventQueue-0" java.lang.OutOfMemoryError: Java heap space
Exception in thread "AWT-EventQueue-0" java.lang.OutOfMemoryError: Java heap space
Exception in thread "AWT-EventQueue-0" java.lang.OutOfMemoryError: Java heap space
Exception in thread "AWT-EventQueue-0" java.lang.OutOfMemoryError: Java heap space
Exception in thread "AWT-EventQueue-0" java.lang.OutOfMemoryError: Java heap space
Exception in thread "AWT-EventQueue-0" java.lang.OutOfMemoryError: Java heap space
Exception in thread "AWT-EventQueue-0" java.lang.OutOfMemoryError: Java heap space
Exception in thread "AWT-EventQueue-0" java.lang.OutOfMemoryError: Java heap space
Exception in thread "AWT-EventQueue-0" java.lang.OutOfMemoryError: Java heap space
Exception in thread "AWT-EventQueue-0" java.lang.OutOfMemoryError: Java heap space
Exception in thread "AWT-EventQueue-0" java.lang.OutOfMemoryError: Java heap space
Exception in thread "AWT-EventQueue-0" java.lang.OutOfMemoryError: Java heap space
 
Last edited:
Finished 10M buffers of 4096 bytes no issue:
#9999998 : __>> count=1208566513, lines/sec=95234 <<__
#9999999 : __>> count=1208566630, lines/sec=95234 <<__
------ elapsed time 12248.974 secs for -644378624 bytes

After that has ended - it won't run again. It closes the port and exits after the counted number.

Ignore the # bytes showing a signed number overflowing after the wrong math - the time seems right.

<Update>: I altered the lpt_test.exe params to fill a buffer with incoming messages a number of time, close the port - pause - open the port and repeat as requested.
This on my Windows machine was causing pretty regular failures in a matter of seconds.
With TeensyLoader open with the sketch HEX I could push button and repeat.

The buffer filling initial loops is enough to get it up to speed - or to a steady speed.

I didn't find a MAGIC combination where it always failed - but the key was to interrupt the steady state transfer - then (reconnect)/restart.

The .EXE just discards the buffer after selecting one ~32 byte segment to display - so its steady state can keep up. A Serial Monitor tries to capture and buffer and display all the lines while managing garbage collection on buffers outside the record region.

I had in the Surge code to try to emulate pauses - but as done it just slowed the lines/second read rate. So I opted for clear runs up to speed then deliberate timed breaks like I see when the EXE finished to cmdline and restarted.

It shows the problem in a matter of 10-20 seconds.

Paul - if this sounds like a useful tool for repro as you test let me know.
 
Last edited:
FYI, using Paul's usb_serial.c and USB lines sketch with 1.8.9 and latest github cores with debug printf disabled, on linux with USB hub using raw capture

stty -F /dev/ttyACM0 115200
cat /dev/ttyACM0 > /tmp/tmp


with ctrl-c after 5 or so seconds. I see these kind of results:
Code:
...
count=12605624, lines/sec=357821
count=12605625, lines/sec=357821
count=12605626, lines/sec=357821
count=12605627, lines/sec=357821
count=12605628, lines/sec=357821
...

                tail -n 300000 /tmp/tmp | awk -F = '{print $3}' | stats
                299996 pts min 272055.000000 max 331454.000000 avrg 324035.955976 cov 0.060600 rmse 19636.624451
                299997 pts min 339058.000000 max 357114.000000 avrg 343308.184155 cov 0.022313 rmse 7660.108338
                299999 pts min 311777.000000 max 311777.000000 avrg 311777.000000 cov 0.000000 rmse 0.000000
                299997 pts min 358774.000000 max 358973.000000 avrg 358936.047984 cov 0.000216 rmse 77.382167
Even with this raw capture, i sometimes see corrupt lines in /tmp/tmp. But roughly seeing 340,000 lines/second (11220 KBs).

FWIW, USBsend to serial_listen prints lots of ...... but eventually hangs or when you unplug USB says
Code:
error reading from /dev/ttyACM0
Total bytes read: 120629504
Speed 12062.95 kbytes/sec
On win10x64 + USB hub with serial_read.exe COM8, unplug T4B2 USB and get 2391.65 KBs
On macos, unplug USB and get 8034.84 KBs
on linux64, 4757.2 KBs
on linux32 laptop, 10813.57 KBs
 
Last edited:
Wow, looks like the Arduino serial monitor is a more of a factor than I had hoped it would be. :(

12063 kbytes/sec agrees pretty well with low-level timing measurements I've been making. In this scope screenshot, the yellow pulses are the time inside schedule_transfer(), and the other pulses show which cases that code executed.

file.png

So when other factors aren't holding things up, we're able to call schedule_transfer() for another 64 byte packet approx every 5 microseconds. That's a raw speed of about 12.8 Mbyte/sec, generating the data and getting it onto the endpoint's queue.

Something definitely isn't quite right with the scheduling of transfer descriptors onto the endpoint queue heads.

I'm out of time for now. Going to the Latch-Up conference this weekend. Probably won't be able to do more until Sunday night.
 
@mjs513 - I wonder what the TelemetryViewer would do with higher data rates? It seemed to handle the 9DOF data as fast as it was getting it before? It didn't have a text viewer class - but with some sine or other data - like a count up then down - from T4 I wonder what it would do. Not sure I ever set up a template for that - but IIRC you did.
 
@mjs513 - I wonder what the TelemetryViewer would do with higher data rates? It seemed to handle the 9DOF data as fast as it was getting it before? It didn't have a text viewer class - but with some sine or other data - like a count up then down - from T4 I wonder what it would do. Not sure I ever set up a template for that - but IIRC you did.

Tim - telemetry viewviewer will pretty much print anything you send it but its java based which may experience the same as the Sermon but from what I remember it did keep up with the 9dof stuff pretty good with al the data we sent. The x-axis is just a time axis so don't think that is going to work.
 
Tim - telemetry viewviewer will pretty much print anything you send it but its java based which may experience the same as the Sermon but from what I remember it did keep up with the 9dof stuff pretty good with al the data we sent. The x-axis is just a time axis so don't think that is going to work.

Yes, it is Java - but seemed to handle data streams without buffer issues like full text GUI output.
Yes, time axis - so I thought a set of sine data fed out and maybe a count up and down might plot out usably - maybe run the line/sec counter and just feed out the lower digits in some fashion ((count & 0x3ff00)>>8) would cycle to full value over 1-3 seconds depending on the output rate and not be ever increasing - then once per sec push the Sketch value out a Serial# port to see the actual value.
 
Yes, it is Java - but seemed to handle data streams without buffer issues like full text GUI output.
Yes, time axis - so I thought a set of sine data fed out and maybe a count up and down might plot out usably - maybe run the line/sec counter and just feed out the lower digits in some fashion ((count & 0x3ff00)>>8) would cycle to full value over 1-3 seconds depending on the output rate and not be ever increasing - then once per sec push the Sketch value out a Serial# port to see the actual value.

You can try and see what happens. Not sure if its going to be a good comparison to other benchmenks since you are changing the prints and adding char text and snprintf(text,.... But you might be interesting to see.

I am struggling here CANFD. Can 2.0 works fine on pin 0/1 and loopback test for CANFD works as well. I get a Tx msg successfully transmitted but nothing on the Click board. May have to wait for the B3 board to do a more realistic test.
 
Benchmarking

@PaulStoffregen and others

While poking STM32duino looking for stuff on CANFD I came across a couple of benchmarking sketches: Dhrystone, Whetstone-double precision and Whetstone-single precision. I copied them over and ran them on the T4B2 they did compile and run no issue. Just not sure what they all may mean - never saw them before except for PCs. I am attaching for reference but I would like to get a reading (Paul) on the validity for using them with the Teensies.

View attachment Benchmarking.zip

I also found this post on the Arduino Forum Re: Benchmark STM32 vs ATMega328 (nano) vs SAM3X8E (due) vs MK20DX256 (teensy 3.2) It also has data for T3.5 as well.
 
Last edited:
Status
Not open for further replies.
Back
Top