Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 5 of 5

Thread: Teensy 3.2, OctoWS2811, and large Serial.readBytes hang

  1. #1
    Junior Member ShadowLight8's Avatar
    Join Date
    Nov 2019
    Location
    Indiana
    Posts
    3

    Teensy 3.2, OctoWS2811, and large Serial.readBytes hang

    I'm using a Teensy 3.2 with the OctoWS2811 Adaptor, connected via USB Serial to a Raspberry Pi 4 running Falcon Player v3.3 (Raspbian based) to control 2378 WS2813 LEDs being updated at 25ms intervals. The Teensy & OctoWS2811 library are configured to run the longest string of 517 LEDs, so it is having to push bits as if there were 4136 LEDs. With this configuration, I'm expecting a 2 byte header plus 12408 bytes of data being sent over USB Serial, in 64 byte packets, from the Pi to the Teensy, every 25ms.

    I'm using Serial.readBytes() to get the data, then hand it off to setPixel in the OctoWS2811 library. However, when I try to use Serial.readBytes() for a "large" number of bytes, the Teensy appears to hang or at least never return from the Serial.readBytes(). This is based on my observation that the built-in LED stops blinking with the code below.

    Condensed version:
    Code:
    // Created by Nick Anderson 7/2/2017
    #include <OctoWS2811.h>
    #define LEDPIN 13 // Teensy 3.2 LED Pin
    #define qBlink() {GPIOC_PTOR=32;} // Fast way to toggle LED on and off
    #define MAX_PIXELS_PER_STRIP 517
    
    DMAMEM int displayMemory[MAX_PIXELS_PER_STRIP * 6];
    int drawingMemory[MAX_PIXELS_PER_STRIP * 6];
    
    OctoWS2811 leds(MAX_PIXELS_PER_STRIP, displayMemory, drawingMemory, WS2811_RGB | WS2813_800kHz);
    
    void setup() {
      Serial.begin(115200);
      Serial.setTimeout(20);
      
      leds.begin();
      leds.show();
    
      pinMode(LEDPIN, OUTPUT);
      qBlink();
    }
    
    char megaBuffer[MAX_PIXELS_PER_STRIP * 8 * 3]; // 12408 currently
    int curItem = 0;
    unsigned long millisSinceBlink;
    
    void loop() {
      if (Serial.readBytes(megaBuffer, 2) == 2) {
        if (megaBuffer[0] == '<' && megaBuffer[1] == '>') {
          curItem = 0;
          while (curItem < 24) {
            Serial.readBytes(&megaBuffer[curItem * MAX_PIXELS_PER_STRIP], MAX_PIXELS_PER_STRIP);
            curItem++;
          }
          
          if (millis() - millisSinceBlink > 25) {
            millisSinceBlink = millis();
            qBlink();
          }
          
          curItem = 0;
          while (curItem < (MAX_PIXELS_PER_STRIP * 8)) {
            leds.setPixel(curItem, megaBuffer[curItem * 3], megaBuffer[curItem * 3 + 1], megaBuffer[curItem * 3 + 2]);
            curItem++;
          }
          leds.show();
        }
      }
    }
    Full code, with comments, is here https://github.com/ShadowLight8/fpp-...nsy-serial.ino

    With the default NUM_USB_BUFFERS in usb_desc.h of 12 for USB_SERIAL, attempting 517 byte reads does not work and the built-in LED does not blink.
    If I increase the NUM_USB_BUFFERS to 30, 517 byte reads to work. The built-in LED continues to blink and the WS2813 LEDs light up as expected.

    Another non-working attempt was to read all 12408 bytes I was expecting by doing:
    Code:
    Serial.readBytes(megaBuffer, MAX_PIXELS_PER_STRIP * 8 * 3);
    Ultimately, this single 12408 byte Serial.readBytes() is what I'd like to get working.

    I also tried the following code to handle timeouts and use the led to indicate that they were occurring, but it also did not work:
    Code:
    curItem = 0;
    while (curItem < MAX_PIXELS_PER_STRIP * 8 * 3) {
      n = Serial.readBytes(megaBuffer + curItem, MAX_PIXELS_PER_STRIP * 8 * 3 - curItem);
      if (millis() - millisSinceBlink > 25) {
        millisSinceBlink = millis();
        qBlink();
      }
      curItem += n;
    }
    I have looked at the OctoWS2811 VideoDisplay code, which appears to do "large" 7500 byte Serial.readBytes(). https://github.com/PaulStoffregen/Oc...deoDisplay.ino

    I've attempted to read through the teensy3/core (usb_serial.h readBytes; usb_serial.c usb_serial_read; usb_dev.c usb_rx & usb_rx_memory; usb_mem.c usb_free) to understand if I'm missing something in my code, but my C/C++ kung-fu might not be up to the task yet.

    Any assistance or suggestions of how to dig into this issue is sincerely appreciated. Thank you in advance!

    -Nick Anderson

  2. #2
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    10,066
    Does this work any better where it replaces what was tried in the second code loop

    Code:
    char megaBuffer[MAX_PIXELS_PER_STRIP * 8 * 3]; // 12408 currently
    int curItem = 0, n;
    unsigned long millisSinceBlink;
    void loop() {
      // put your main code here, to run repeatedly:
      curItem = 0;
      while (curItem < MAX_PIXELS_PER_STRIP * 8 * 3) {
        n = 0;
        if ( Serial.available() )
          n = Serial.readBytes(megaBuffer + curItem, Serial.available() );
        if (millis() - millisSinceBlink > 25) {
          millisSinceBlink = millis();
          qBlink();
        }
        curItem += n;
        if ( 0 != n ) Serial.println( n );
      }
      Serial.println( "LOOP" );
    }

  3. #3
    Junior Member ShadowLight8's Avatar
    Join Date
    Nov 2019
    Location
    Indiana
    Posts
    3
    Thanks for the reply defragster!

    I gave your suggestion a try and still encountered more or less the same result, but it did get me to find a simpler repo and it might have provided, what I think is, a clue. While trying this out, I would typically see values of 1, 64, 65, or 128 being returned, which seemed reasonable. However, during one test, it printed out that Serial.Available() had returned over 5000 bytes, which at a glance seems out of bounds. I wouldn't expect to see anything over 768 (NUM_USB_BUFFERS at 12 * 64 bytes). I started to look back over the USB code stack to understand how that could be.

    I'm a bit out of my depth, but here goes what I found:
    Serial.Available(), in usb_serial.c, gets counts from usb_rx_byte_count and the current rx_packet. usb_rx_byte_count, in usb_dev.h, effectively is usb_rx_byte_count_data which is only used in usb_dev.c. I only found one place where usb_rx_byte_count_data is increased. It's in the receive part of the usb_isr. https://github.com/PaulStoffregen/co...usb_dev.c#L997

    Here's the condensed code with serial output comments removed:
    Code:
    			} else { // receive
    				packet->len = b->desc >> 16;
    				if (packet->len > 0) {
    					packet->index = 0;
    					packet->next = NULL;
    					if (rx_first[endpoint] == NULL) {
    						rx_first[endpoint] = packet;
    					} else {
    						rx_last[endpoint]->next = packet;
    					}
    					rx_last[endpoint] = packet;
    					usb_rx_byte_count_data[endpoint] += packet->len;
    					packet = usb_malloc();
    					if (packet) {
    						b->addr = packet->buf;
    						b->desc = BDT_DESC(64,
    							((uint32_t)b & 8) ? DATA1 : DATA0);
    					} else {
    						b->desc = 0;
    						usb_rx_memory_needed++;
    					}
    				} else {
    					b->desc = BDT_DESC(64, ((uint32_t)b & 8) ? DATA1 : DATA0);
    				}
    			}
    usb_rx_byte_count_data is increased first, then usb_malloc(). If usb_malloc fails because it is out of buffers, does usb_rx_byte_count_data become overstated?

    Just to see what would happen, I did try moving the usb_rx_byte_count_data increase into the "if (packet)" block and updated my script to do a single Serial.readBytes for 12408. It worked for at least one update, maybe two.

    I feel like I'm stabbing in the dark, so any guidance would be welcomed.


    Here's the simpler repo I ended up with:
    On the Raspberry Pi 4, in one SSH window run
    cat > /dev/ttyACM0

    In another, run the following
    Code:
    #!/bin/bash
    for (( c=1; c<=10; c++ ))
    do
            cat test-frame.txt > /dev/ttyACM0
    done
    The test-frame.txt file is exactly 12410 bytes long. The first two characters are the header, <>. The rest is "~ " or 7e 20 20 repeating.

    When I ran with the code below on the Teensy, I would see 12408 returned twice before things appeared to lock up. At least the WS2813 LEDs would light up as expected.

    Code:
    void loop() {
      if (Serial.readBytes(megaBuffer, 2) == 2) {
        if (megaBuffer[0] == '<' && megaBuffer[1] == '>') {
          Serial.println( Serial.readBytes(megaBuffer, MAX_PIXELS_PER_STRIP * 8 * 3) );
    
          curItem = 0;
          while (curItem < (MAX_PIXELS_PER_STRIP * 8)) {
            leds.setPixel(curItem, megaBuffer[curItem * 3], megaBuffer[curItem * 3 + 1], megaBuffer[curItem * 3 + 2]);
            curItem++;
          }
          leds.show();
        }
      }
    }

  4. #4
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    10,066
    Mainly tested on Teensy 4 - did just run on okay a T_3.1 (about 10 times with 11,200 bytes) - because I was expecting it to have an issue with the USB stack being a work in progress - and there is a known issue with Serial.available() and internal counts/updates.

    But finding it to work with variation of the above code using a file send from TyCommander of sizes : 28, 280, 2800, 5600, 11200 bytes.

    @Paul - this is with Latest Github/CORES changes from 11? days back. - looking goof for use of :: Serial.parseInt() and Serial.available()

    Also tried it with a single FULL read request and with reading available() count until either ALL gone - or until the last counted byte would be pulled in:
    Code:
        int cntN = Serial.available();
        if ( cntN ) {
          if ( cntN + curItem > rCnt ) cntN = rCnt - curItem;
          n = Serial.readBytes(megaBuffer + curItem, rCnt );
          // n = Serial.readBytes(megaBuffer + curItem, cntN );
          // n = Serial.readBytes(megaBuffer + curItem, Serial.available() );
        }
    When the code starts it waits for entry of the Number of bytes to read, then loop() does above reads to as indicated to get those bytes, then exits and repeats.

    This is a stand alone sketch - with the test text files. Would be interesting if it works on T_3.2
    Slow 200ms blink - enter expected read size
    Quick 100ms blink - top of loop() waiting data start
    FAST - waiting for data read of indicated bytes.

  5. #5
    Junior Member ShadowLight8's Avatar
    Join Date
    Nov 2019
    Location
    Indiana
    Posts
    3
    defragster,
    I did some testing using your code. The only modification I made was to setup() where I commented out Serial lines after qBlink and just set rCnt to 12408. I also switch to n = Serial.readBytes(megaBuffer + curItem, cntN ); in the loop.

    In one SSH window, I sent a single test-frame.txt to /dev/ttyACM0
    Code:
    cat test-frame.txt > /dev/ttyACM0
    In the other SSH window, I watched the returning data. I keep the original formatting, so you'll have to scroll over to see the n and curItem value
    Code:
    fpp@FPP:~ $ cat < /dev/ttyACM0
    768 ==n and sum curItem== 768
    
    <>~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~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sum curItem== 11921
    
     ~  ~   ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~
    
    ----------------------64 ==n and sum curItem== 11985
    
      ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~
    
    ----------------------64 ==n and sum curItem== 12049
    
     ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~
    
    ----------------------64 ==n and sum curItem== 12113
    
    ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~
    
    ----------------------64 ==n and sum curItem== 12177
    
      ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~231 ==n and sum curItem== 12408
    
     ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  20 ==n and sum curItem== 20
    
     ~  ~  ~    ~~  ~ ~
    
    ----------------------3 ==n and sum curItem== 23
    
     ~
    
    ----------------------1 ==n and sum curItem== 24
    
    
    
    ----------------------1 ==n and sum curItem== 25
    
    ~
    
    ----------------------1 ==n and sum curItem== 26
    
    ~
    
    ----------------------1 ==n and sum curItem== 27
    I'm not sure where the " <<< end LOOP\n" lines went, but the code must have exited the loop since curItem was reset from 12408. At this point, there is an ongoing stream of returning data that doesn't appear to come from the test-frame.txt data. Scanning through the returning data, it's looking like it ran past a buffer somewhere since it spelled out "curItem== 102" over multiple readBytes.

    Code:
    ----------------------1 ==n and sum curItem== 358
    
    c
    
    ----------------------1 ==n and sum curItem== 359
    
    u
    
    ----------------------1 ==n and sum curItem== 360
    
    r
    
    ----------------------1 ==n and sum curItem== 361
    
    I
    
    ----------------------1 ==n and sum curItem== 362
    
    t
    
    ----------------------1 ==n and sum curItem== 363
    
    e
    
    ----------------------1 ==n and sum curItem== 364
    
    m
    
    ----------------------1 ==n and sum curItem== 365
    
    =
    
    ----------------------1 ==n and sum curItem== 366
    
    =
    
    ----------------------1 ==n and sum curItem== 367
    
    
    
    ----------------------1 ==n and sum curItem== 368
    
    1
    
    ----------------------1 ==n and sum curItem== 369
    
    0
    
    ----------------------1 ==n and sum curItem== 370
    
    2
    
    ----------------------2 ==n and sum curItem== 372

    Edit:
    I realized I should have set rCnt to 12410 to match the amount of data being sent. Ended up with similar results, but did capture the "end LOOP" this time:
    Code:
      ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~76  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~
    
    ----------------------64 ==n and sum curItem== 11659
    
     ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~ 751 ==n and sum curItem== 12410
    
    (▒iX▒
    
    ---------------------->>>>>>>>>>>>> sum curItem== 12410 <<< end LOOP
    
    
    7 ==n and sum curItem== 7
    
         ~
    
    ----------------------1 ==n and sum curItem== 8
    
    
    
    ----------------------1 ==n and sum curItem== 9
    Last edited by ShadowLight8; 11-11-2019 at 04:15 PM. Reason: Additional information added

Posting Permissions

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