Forum Rule: Always post complete source code & details to reproduce any issue!
Page 3 of 3 FirstFirst 1 2 3
Results 51 to 60 of 60

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

  1. #51
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    10,907
    Quote Originally Posted by KurtE View Post
    @Paul - I put in a PR for you to look at. The PR shows my current two test apps running on two T4 processors
    Current ones send a sequence number for first 4 bytes and compare to the previous number and if different prints that one out.

    https://github.com/PaulStoffregen/cores/pull/455
    Updated to that PR code and still running after overnight run:
    RawHid Serial: L:8641792 R:279691: Seq:279691 Heap: 20200660

  2. #52
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    Location
    New York
    Posts
    4,797
    @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.

  3. #53
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    10,907
    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
    L:14114816 R:285483: Seq:285483  Heap: 20200660
    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.

  4. #54
    Junior Member
    Join Date
    Jan 2020
    Location
    TriCities region, eastern Washington
    Posts
    1
    @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

  5. #55
    Junior Member prnthp's Avatar
    Join Date
    Oct 2019
    Posts
    15
    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!

  6. #56
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    10,907
    That is good news.

  7. #57
    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.

  8. #58
    Scratch that last comment, I did not checkout branch t4_rawhid. I will report back with status after giving this at hour to run.

  9. #59
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    10,907
    Quote Originally Posted by mstrthealias View Post
    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?

  10. #60
    It appears to be stable after checking out the t4_rawhid branch. Thanks!

Posting Permissions

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