Teensy 4.0 + Adafruit 64x32 matrixes

I just got a Smartled V5 shield from Crowdsupply and I’m trying to use it with a Teensy 4.0 and an
Adafruit 64x32 4mm RGB matrix display.

I downloaded the SmartLed library via the Arduino library manager, and I’m using Arduino 1.8.13 and TeensyDunio 1.54 beta 5.

I opened SmartLed → FeatureDemo and I uncommented the line:

#include <MatrixHardware_Teensy4_ShieldV5.h> // SmartLED Shield for Teensy 4 (V5)

I also set kMatrixHeight to be 64. I did not modify kPanelType which is SM_PANELTYPE_HUB75_32ROW_MOD16SCAN. I get random sets of dots on the screen, but I don’t seem to get an organized display.

I know the display works because I have used it with the Adafruit Matrix Portal that I got in Adabox 016 (along with the display).

So obviously, I need to modify the configuration to match the display. Could somebody tell me what are the appropriate values to set for COLOR_DEPTH, kMatrixWidth, kMatrixHeight, kRefreshDepth, kDmaBufferRows, kPantelType, kMatrixOptions, kBackgroundLayerOptions, kScrollingLayerOptions and kIndexedLayerOptions for this display?

I also have the Adafruit 64x32 3mm RGB matrix display from Adafruit.

Thanks in advance.

Hi Michael,

Your display is 64 pixels wide and 32 pixels high. From the defaults you just need to change kMatrixWidth to 64:

uint16_t kMatrixWidth = 64;       // Set to the width of your display, must be a multiple of 8
uint16_t kMatrixHeight = 32;      // Set to the height of your display

If you want to use it as 64 pixels high and 32 pixels wide, use matrix.setRotation(rotation90); or matrix.setRotation(rotation270); in the sketch.

If you’re still seeing issues, please include photos or video of what’s on the display and how you’re connecting the Teensy to the shield and the shield to the panel

1 Like

I was able to get both the teensy 4.0 and 4.1 to work with the new v5. With some external memory added to the teensy 4.1, and a bit of help from Marc Merlin, I was able to drive 128 x 192 with reasonable framerate.

One thing I did notice when getting it up and running at 128 x 64 was that my panel layout that worked on the v4 with teensy 3.6 had to be reversed for the new setup.

Awesome! That’s a lot larger than my 96x96 setup, I’d love to see some video when you get a chance.

Thanks for pointing that out. You inspired me to go on a documentation spree today and I added a bunch of documentation to the Wiki (mostly in the Features page which is now probably too long and needs to be split up into multiple pages), and added a relevant section.

Note: the stacking direction was reversed in the teensylc and teensy4 branches prior to the release of SmartMatrix Library 4.0. The stacking direction is still reversed for the ESP32 Platform as of SmartMatrix Library 4.0.3, and will be fixed at some point in the future.

I also added that paragraph to the README

1 Like

After some amount of debugging, and starting at the documentation, I finally got it working with a Teensy 4.0. There were a couple of issues:

  • Evidently the original Teensy 4.0 that I attached had some issues with my soldering. I put another Teensy 4.0 on and it was fine, once I attached it correctly.
  • Originally, I was attaching the Teensy underneath the Smartled shield, instead of on top of it. It took me awhile to realize the pictures showed this orientation. Could you please post larger pictures? On my large monitor (3440x1440) the posted pictures are just too small to see in detail how to attach it.
  • In addition, it took me awhile to realize that when I was using the 2x8 cable, I needed to connect it from the top and not from the bottom (otherwise I would connect the wrong rows). Yes you have it in the documentation, but I evidently missed it.
  • Note, with the 4mm pitch 64x32 display I bought from Adafruit, the Smartled shield will not attach directly to the 2x8 pins, and I had to use the 2x8 cable to attach the display to the shield (and get the orientation wrong). The 3mm pitch 64x32 display fits directly on the shield.
  • I discovered in using the 3mm pitch 64x32 display, that I have 2 red LEDs that don’t display.

Thanks for the help. Sorry, it took me awhile to get back to trying to get it to work.

Glad you got it working, thanks for the feedback

Glad you got this to work! There is a feature in the SmartMatrix library to allow placing the background layer frame buffer into the Teensy 4.1 external memory. This isn’t documented anywhere (yet) but all you need to do is include this define before the SMARTMATRIX_ALLOCATE_BACKGROUND_LAYER macro:


#define SMARTMATRIX_USE_PSRAM

This will add the keyword EXTMEM to the array that holds the two background layer bitmap buffers which will place them into PSRAM (instead of normal DTCM RAM). This only works on Teensy 4.1 with an external RAM chip soldered to the bottom pads.

For a 128x192 matrix with color storage depth 24 bit, the background layer buffers occupy 147456 bytes so doing this would free up a nice chunk of memory for other variables. Of course the downside is that the PSRAM is slower than the onboard memory.

Thanks, but this will have to wait.

Background: My 4.1 board with EXTMEM kept crashing. So troubleshooting began. Removed references to ETXMEM. Still having issues. Tried a 4.0 board. no issues. Removed the RAM from 4.1 to see if that was the source of the problem. Still crashed. Tried another virgin 4.1 board, still crashed. I am not smart enough to figure out why. Anyway, the RAM chip is gone and the 4.1 crash at 128 x 128 is unresolved. 4.1 works fine at 128 x 64. The good news is that 4.0 is now my hero with this adaptor board.

While pushing the buffers to the RAM is interesting in a quest to see how big we could make this sucker, it will have to wait for me until there is a fix for the 4.1 crashes. Currently have 4.0 pushing 128 x 160 without lockup or need for EXTMEM so working to tweak the patterns with that hardware setup. There are a few that have issues when the size gets beyond 128. Aurora cube and my implementation of fire are 2 examples of such.

Can you describe the “crashes” in more detail?

Can you narrow the issue down to a simple reproducible test case? Do simple sketches like Featuredemo work at the higher resolutions or do they also crash?

IT compiles fine and loads and boots, and runs. It can run for hours but then it stops with a blank display. Serial link is dead as well (does not take commands over serial).
Watched it over several days with serial running, not related to any single pattern or type of pattern.
Tested on 2 different 4.1 teensys. both had the issue.

Meanwhile 4.0 runs the same code without issue.

Will try to recreate with one of the more simple demos.