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

Thread: Teensy 3.6 + Octo LED Performance

  1. #1
    Senior Member
    Join Date
    Jul 2014
    Posts
    109

    Teensy 3.6 + Octo LED Performance

    I am experimenting with my new 3.6 and a very large array of LEDs (using the Octo shield). When I upload the Rainbow script from the Octo library example files, everything seems to freeze when I get to about 10,400 LEDs. For the Movie2Serial + Video Display script, it happens around 9,600. Is this what you guys would expect with the new Teensy or should I be troubleshooting something else? It seems to freeze at the same point even when I turn the brightness on the LEDs way down via the code.

  2. #2
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    18,355
    Yes, there does seem to be some sort of bug when more than 1365 LEDs per pin are used. I've put this one my list of issues to investigate.

    But even when this limitation is fixed, you still won't be able to use this many LEDs with VideoDisplay using 30 Hz video files, at least not with a single Teensy. There are 2 important hardware limits which no amount of software can solve.

    First, each LED requires 30 us, because it has 24 bits of data transmitted at 800 kbit/sec. To update the LEDs, 1100 per pin is the absolute maximum number of LEDs you can use and still achieve 30 Hz update.

    12 Mbit/sec USB is the other limit. 1100 LEDs per pin requires 26400 bytes of data per frame. That's 792 kbytes/sec to sustain 30 Hz. The best case scenario for 12 Mbit/sec USB is approx 1.1 Mbyte/sec. In practice, running over about 70% to 80% of the possible bandwidth risks all sorts of issues.

    I will work on fixing the 1365/pin limit. But when it's fixed, that many LEDs per pin will only really be usable when the animation is done locally on the Teensy, and only at slower refresh rates due to the 800 kHz data rate.

  3. #3
    Senior Member
    Join Date
    Jul 2014
    Posts
    109
    I was just thinking about this problem again. Let's forget about all other issues besides the 12Mbit/sec USB limit. If my computer has 4 USB ports, does that mean all I can ever hope for is 4x1100x8 LEDs? If I use one of those ports to run a multi USB hub with ten ports does that mean I now have capacity for 4x1100x17 LEDs? If so, is there a limit to how many hubs I can connect (sorry this is probably a really stupid question to you guys)?

  4. #4
    Senior Member
    Join Date
    Jul 2014
    Posts
    109
    sorry, i think that second estimate should have been 13x1100x8

  5. #5
    Senior Member
    Join Date
    Jul 2014
    Posts
    109
    Anybody out there?

  6. #6
    Member crees's Avatar
    Join Date
    Dec 2016
    Location
    Utah
    Posts
    80
    It depends on the USB hub and hardware but most ports and hubs are USB 2 (480 Mbps) so it would be able to handle quite a few USB 1 devices at 12Mbps. Your limit will be on how well your software can detect and send to multiple serial instances. Perhaps consider an artnet or sACN method over ethernet. I have mine set at 680 pixels per SPI but I can use two teensy 3.2 controllers to control over 10k pixels.

  7. #7
    Senior Member
    Join Date
    Jul 2014
    Posts
    109
    Thanks Crees. If USB2 is 480 Mbps, why does Paul reference 12 Mbps above? Is that a restriction of the Teensy’s USB connection?

    Artnet and sACN are a bit of a mystery to me. Do you have any information on your setup (like a blog or website)? I would love to be able to control that many ws2812s from my computer with only two Teensy’s.

  8. #8
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    18,355
    TL;DR: use a Multi-TT type USB hub.

    Quote Originally Posted by BuffaloFan32 View Post
    If my computer has 4 USB ports, does that mean all I can ever hope for is 4x1100x8 LEDs?
    On most PCs its even worse than that. Most have only a single USB2 controller, so when you transmit 12 Mbit/sec on 1 port the others are blocked from simultaneously transmitting.

    If I use one of those ports to run a multi USB hub with ten ports does that mean I now have capacity for 4x1100x17 LEDs?
    Sort of. Multi-TT hubs are the key. They let your PC send the data at 480 Mbit/sec and the hubs take care of doing the actual sending at 12 Mbit/sec.

    But beware of cheap Single-TT hubs. They can only transmit to 1 downstream device at a time.

    You're probably not going to get that many simultaneous streams into the USB2 bandwidth limit. But yes, within the 480 Mbit/sec bandwidth limit (fugure about 33% protocol overhead, and a max usage of 80% bandwidth), multi-TT hubs will allow efficient transmission from your PC to many downstream Teensy boards.

    To get another 480 Mbit/sec, you need another USB2 controller. Even if your PC has 10 USB ports, they're probably all on the same controller and share the same bandwidth. Yes, I know that sounds very surprising, but even high end PCs are made from chips designed for consumers where low cost reigns supreme. Some motherboards do have other controller chips for some of their ports, but even on those high-end boards, you can expect many ports to share 1 controller's bandwidth!

    If you add a PCIe card, it usually adds another controller, but all the ports on that are usually share bandwidth. There are some notable exceptions, but unless are card specifically says each port has dedicated bandwidth you can assume they're all shared. Remember, USB is so popular mostly because of its low cost!

    Also, USB 3.0 superspeed (5 or 10 Gbit/sec) is *NOT* an answer. There aren't any TTs (Transaction Translators) between superspeed and full (12 Mbit/sec) speed. All USB 3.0 ports and hub actually have a pair of undirectional channels for superspeed and a parallel half duplux channel for USB 2.0. Any 12 Mbit/sec devices you connect will use the 2.0 channel, either directly or through TTs in hubs. 12 Mbit/sec is *never* translated up to 5 or 10 Gbit/sec.


    Quote Originally Posted by BuffaloFan32 View Post
    If USB2 is 480 Mbps, why does Paul reference 12 Mbps above? Is that a restriction of the Teensy’s USB connection?
    Yes, currently all Teensy models have only 12 Mbit/sec speed on their USB device ports.

    Teensy 3.6 has a 2nd port which supports 480 Mbit/sec, but currently software support is only for USB host mode. It doesn't support device mode at this time.

    In the not-too-distant future (likely 2019) we'll probably have boards with 480 Mbit/sec USB device....

  9. #9
    Senior Member
    Join Date
    Jul 2014
    Posts
    109
    Thanks Paul, I think I understand this issue better now but I do have a question about this:

    Quote Originally Posted by PaulStoffregen View Post
    multi-TT hubs will allow efficient transmission from your PC to many downstream Teensy boards.
    What do you mean by 'many downstream Teensy boards?' 480/12 = 40 Teensys? I cannot find a multi TT hub that has more than 7 outlets. If I understand your post correctly, this means i can have 7 fully functional boards. Even if I connect other hubs to other USB ports on my computer, they probably won't work at the same time. Is that correct? Can you daisy chain multi TT hubs together?

Posting Permissions

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