What's the fastest way to have a Teensy 4 speak to multiple Teensy 4s?

StefanPetrick

Well-known member
Hi everybody!

I looks like my little LED animation projects turns out to become a full blown modular animation synthesizer. For consumer size setups with 1k LEDs one Teensy 4 will be more than enough for +-10 animation layers and complex animations.

But I have also have some people reaching out already with 10k - 40k LEDs setups. They adapted my code and have ESP32S3s running it on 2 cores + FPU now. Framerates close to one T3.6, sometimes even more leveraging some tricks.

I wonder: for a top notch (high framerate) setup - wouldn't it be the best to have multiple T4s receiving parameters from one microcontroller - and rendering the data required for the whole LED matrix - all on individual nodes fed by one single master controller which handles the distribution of the controlling parameter data so that the slave units each generate RGB data for their individual sector of the physical LEDs based on the current animation layer parameters?!

Long story short, my question is: what`s the fastest protocol I could use? I wish to have a T4 speak to some other T4s one way only, ideally simultaneously, in order to distribute all required parameters and timestamp data to multiple T4s. I want to enable physical and logical parallelizing of the rendering process itself - for high fps results.

What should I look into? SPI? I2C? CAN? Something else? What would be the prefered weapon of my choice for my specific usecase?

Requirement: I need to send +-100 times / second a data packet containing +-2kB of of control data to multiple receivers ASAP. Every µs not sped on waiting for - or receiving of - data can be spend on rendering more RGB data frames instead.

Latest experiment:
 
Last edited:
I gather you mean more than two, so if it needs to be simultaneous, then I think it would have to be serial. SPI is a possibility, but there are only 2 hardware SPI.

According to the PJRC site:
On Teensy 4 boards, the serial ports normally are limited to 6 Mbit/sec baud rate. However, maximum baud rate can be increased to 20 Mbit/sec by reconfiguring the UART clock source.

Serial has the advantage of being relatively easy to try. You can increase the RX buffer sizes from the defaults. I'm sure they can be set as high as 2K. You can read about that on the Serial Comm page of the PJRC site. At 6M baud, your comm channels would be operating at about 1/3 capacity to send 200 KB/sec, which seems okay.

You could start by doing TX/RX loopback on 1 serial port and see how it goes. When you have that working well, you can go to 2, 3, 4. Even though data is only going one way, you might want to have acknowledgements coming back from the outboard T4s. Otherwise how will you know they are keeping up?
 
If you can use a T4.1, perhaps you could do ethernet? 100Mbit ethernet isn't too slow... A switch could handle as many nodes as you need.
 
USB is the fastest way in terms of bandwidth, as it's 480 Mbit/sec and uses bus master DMA. You would need a USB hub connected to the main Teensy's USB host port.
 
Back
Top