RawHID.recv() hangs after updating to Teensyduino 1.4.9 or higher for Teensy 4.0

@KurtE and @defragster
Finally catching up to you guys now that all my other distractions seem to be coming to a finish. So I tried the sketches from the PR using the current usb.c and usb_rawhid.c files in the core and after about 20 receives it hung as expected, surprised got that far. Used 2 t4s' for the test. After that I updated the files per the PR and all seems to be working as advertised. Just started to duplicate @defragsters long duration run and currently at:
Code:
RawHid Serial: L:419456 R:13588: Seq:13588  Heap: 20200660
Know I am late to this one but wanted to give it a try myself.
 
I took the latest last night and added the line in usb.c - not sure what changed - but All is well!
RawHid Serial: L:14348288 R:290207: Seq:290207 Heap: 20200660


I tweaked the RAWHid sketch to print each msg to Serial1 - and dropped the print of Heap on each until the same message is sent out Serial - and dropped Blink with delays for a Toggle:
Code:
    //blink(2);
    digitalWriteFast(13, !digitalReadFast(13) );
    Serial1.printf("L:%u R:%u: Seq:%d\n", loop_count, receive_count, last_seq_num);
Gives::
Code:
L:14114694 R:285481: Seq:285481
L:14114745 R:285482: Seq:285482
L:14114796 R:285483: Seq:285483
[B]L:14114816 R:285483: Seq:285483  Heap: 20200660[/B]
L:14114817 R:285484: Seq:285484
L:14114838 R:285485: Seq:285485
L:14114889 R:285486: Seq:285486
L:14114940 R:285487: Seq:285487

Then after a longer interval instead of 0x7f went with 0x7ff - and did a longer delay::
Code:
  if ((loop_count & 0x7ff) == 0) {
    Serial.printf("L:%u R:%u: Seq:%d  Heap: %x\n", loop_count, receive_count, last_seq_num, (uint32_t)_sbrk(0));
    Serial1.printf("L:%u R:%u: Seq:%d  Heap: %x\n", loop_count, receive_count, last_seq_num, (uint32_t)_sbrk(0));
    delay(120);
  }
Giving this to the Host::
Code:
RawHid Serial: L:14225408 R:287720: Seq:287720  Heap: 20200660
RawHid Serial: L:14227456 R:287761: Seq:287761  Heap: 20200660
RawHid Serial: L:14229504 R:287802: Seq:287802  Heap: 20200660
RawHid Serial: L:14231552 R:287844: Seq:287844  Heap: 20200660

So three quickly blinking Teensy 4.0's have run over a quarter million messages and counting.
 
@KurtE and @defragster:
Thank you! I have been wrestling with using a Teensy4 controller to timestamp events, using the RawHID.recv() as a "keep alive" signal from the host.
I was not able to simplify the overall application down to a small, self-contained test and so refrained from posting.
Applying your patch to the 1.52beta has enabled my application to now run successfully for over 12 hours (and still running).
-Tom
 
I just had time to get back to the project and wanted to chime in that @KurtE's branch does indeed work with my full project. Thank you all for the great work!
 
Thanks for the efforts on this issue over the past few weeks!

@defragster I missed the last time you mentioned me, but I was hoping that @prnthp's snippet was similar enough such that it would suffice for resolving this issue.

I cloned https://github.com/KurtE/cores.git into Arduino/hardware/teensy/avr/, and still experienced a crash on the Teensy 4.0.

I'll get a snippet ready that's more similar to my application.
 
Thanks for the efforts on this issue over the past few weeks!

@defragster I missed the last time you mentioned me, but I was hoping that @prnthp's snippet was similar enough such that it would suffice for resolving this issue.

I cloned https://github.com/KurtE/cores.git into Arduino/hardware/teensy/avr/, and still experienced a crash on the Teensy 4.0.

I'll get a snippet ready that's more similar to my application.

Better test could be cores from Beta TD 1.52 with just the PR file changes? That is what worked for me - with KurtE's test - may not be different - but then any more edits would be against that.

Not sure when Paul might release a beta 2 of 1.52 with those or similar changes made?
 
Back
Top