Teensy 4.0 Released

I tried to build for the teensy 4.0 I just received, and here is the output

In file included from /home/merlin/Arduino/libraries/SmartMatrix/src/SmartMatrix3.h:127:0,
                 from /home/merlin/Arduino/libraries/SmartMatrix/src/SmartLEDShieldV4.h:5,
                 from /home/merlin/arduino/libraries/SmartMatrix/examples/FeatureDemo/FeatureDemo.ino:6:
/home/merlin/Arduino/libraries/SmartMatrix/src/SmartMatrixMultiplexedRefreshTeensy_Impl.h: In constructor 'SmartMatrix3RefreshMultiplexed<refreshDepth, matrixWidth, matrixHeight, panelType, optionFlags>::SmartMatrix3RefreshMultiplexed(uint8_t, SmartMatrix3RefreshMultiplexed<refreshDepth, matrixWidth, matrixHeight, panelType, optionFlags>::rowDataStruct*)':
/home/merlin/Arduino/libraries/SmartMatrix/src/SmartMatrixMultiplexedRefreshTeensy_Impl.h:38:40: error: 'TIMER_FREQUENCY' was not declared in this scope
 #define NS_TO_TICKS(X)      (uint32_t)(TIMER_FREQUENCY * ((X) / 1000000000.0))
                                        ^
/home/merlin/Arduino/libraries/SmartMatrix/src/SmartMatrixMultiplexedRefreshTeensy_Impl.h:50:32: note: in expansion of macro 'NS_TO_TICKS'
 #define MIN_BLOCK_PERIOD_TICKS NS_TO_TICKS(MIN_BLOCK_PERIOD_NS)
                                ^
/home/merlin/Arduino/libraries/SmartMatrix/src/SmartMatrixMultiplexedRefreshTeensy_Impl.h:139:34: note: in expansion of macro 'MIN_BLOCK_PERIOD_TICKS'
     timerPairIdle.timer_period = MIN_BLOCK_PERIOD_TICKS;
                                  ^
/home/merlin/Arduino/libraries/SmartMatrix/src/SmartMatrixMultiplexedRefreshTeensy_Impl.h: In static member function 'static void SmartMatrix3RefreshMultiplexed<refreshDepth, matrixWidth, matrixHeight, panelType, optionFlags>::calculateTimerLUT()':
/home/merlin/Arduino/libraries/SmartMatrix/src/SmartMatrixMultiplexedRefreshTeensy_Impl.h:47:26: error: 'TIMER_FREQUENCY' was not declared in this scope
 #define TICKS_PER_ROW   (TIMER_FREQUENCY/refreshRate/MATRIX_SCAN_MOD)
                          ^
/home/merlin/Arduino/libraries/SmartMatrix/src/SmartMatrixMultiplexedRefreshTeensy_Impl.h:48:36: note: in expansion of macro 'TICKS_PER_ROW'
 #define IDEAL_MSB_BLOCK_TICKS     (TICKS_PER_ROW/2)
                                    ^
/home/merlin/Arduino/libraries/SmartMatrix/src/SmartMatrixMultiplexedRefreshTeensy_Impl.h:233:30: note: in expansion of macro 'IDEAL_MSB_BLOCK_TICKS'
     uint16_t msbBlockTicks = IDEAL_MSB_BLOCK_TICKS + MSB_BLOCK_TICKS_ADJUSTMENT_INCREMENT;
                              ^
/home/merlin/Arduino/libraries/SmartMatrix/src/SmartMatrixMultiplexedRefreshTeensy_Impl.h: In static member function 'static void SmartMatrix3RefreshMultiplexed<refreshDepth, matrixWidth, matrixHeight, panelType, optionFlags>::setRefreshRate(uint8_t)':
/home/merlin/Arduino/libraries/SmartMatrix/src/SmartMatrixMultiplexedRefreshTeensy_Impl.h:53:32: error: 'TIMER_FREQUENCY' was not declared in this scope
 #define MIN_REFRESH_RATE    (((TIMER_FREQUENCY/65535)/MATRIX_SCAN_MOD/2) + 1)
                                ^
/home/merlin/Arduino/libraries/SmartMatrix/src/SmartMatrixMultiplexedRefreshTeensy_Impl.h:291:25: note: in expansion of macro 'MIN_REFRESH_RATE'
     if(newRefreshRate > MIN_REFRESH_RATE)
                         ^
In file included from /home/merlin/Arduino/libraries/SmartMatrix/src/SmartMatrix3.h:128:0,
                 from /home/merlin/Arduino/libraries/SmartMatrix/src/SmartLEDShieldV4.h:5,
                 from /home/merlin/arduino/libraries/SmartMatrix/examples/FeatureDemo/FeatureDemo.ino:6:
/home/merlin/Arduino/libraries/SmartMatrix/src/SmartMatrixAPA102RefreshTeensy_Impl.h: In static member function 'static void SmartMatrixAPA102Refresh<refreshDepth, matrixWidth, matrixHeight, panelType, optionFlags>::begin()':
/home/merlin/Arduino/libraries/SmartMatrix/src/SmartMatrixAPA102RefreshTeensy_Impl.h:165:55: error: 'SPI0_PUSHR' was not declared in this scope
     dmaClockOutDataApa.destination((volatile uint8_t&)SPI0_PUSHR);
                                                       ^
/home/merlin/Arduino/libraries/SmartMatrix/src/SmartMatrixAPA102RefreshTeensy_Impl.h:167:47: error: 'DMAMUX_SOURCE_SPI0_TX' was not declared in this scope
     dmaClockOutDataApa.triggerAtHardwareEvent(DMAMUX_SOURCE_SPI0_TX);
                                               ^
In file included from /var/local/arduino-1.8.9-teensyduino-1.47/hardware/teensy/avr/cores/teensy4/core_pins.h:32:0,
                 from /var/local/arduino-1.8.9-teensyduino-1.47/hardware/teensy/avr/cores/teensy4/wiring.h:38,
                 from /var/local/arduino-1.8.9-teensyduino-1.47/hardware/teensy/avr/cores/teensy4/WProgram.h:45,
                 from /tmp/arduino_build_363732/pch/Arduino.h:6:
/home/merlin/Arduino/libraries/SmartMatrix/src/SmartMatrixAPA102RefreshTeensy_Impl.h:170:65: error: 'ROW_CALCULATION_ISR_PRIORITY' was not declared in this scope
     NVIC_SET_PRIORITY(IRQ_DMA_CH0 + dmaClockOutDataApa.channel, ROW_CALCULATION_ISR_PRIORITY);
                                                                 ^
/var/local/arduino-1.8.9-teensyduino-1.47/hardware/teensy/avr/cores/teensy4/imxrt.h:8201:104: note: in definition of macro 'NVIC_SET_PRIORITY'
 #define NVIC_SET_PRIORITY(irqnum, priority)  (*((volatile uint8_t *)0xE000E400 + (irqnum)) = (uint8_t)(priority))
                                                                                                        ^
In file included from /home/merlin/Arduino/libraries/SmartMatrix/src/SmartMatrix3.h:128:0,
                 from /home/merlin/Arduino/libraries/SmartMatrix/src/SmartLEDShieldV4.h:5,
                 from /home/merlin/arduino/libraries/SmartMatrix/examples/FeatureDemo/FeatureDemo.ino:6:
/home/merlin/Arduino/libraries/SmartMatrix/src/SmartMatrixAPA102RefreshTeensy_Impl.h:173:5: error: 'FTM2_SC' was not declared in this scope
     FTM2_SC = 0;
     ^
/home/merlin/Arduino/libraries/SmartMatrix/src/SmartMatrixAPA102RefreshTeensy_Impl.h:174:5: error: 'FTM2_CNT' was not declared in this scope
     FTM2_CNT = 0;
     ^
/home/merlin/Arduino/libraries/SmartMatrix/src/SmartMatrixAPA102RefreshTeensy_Impl.h:175:5: error: 'FTM2_MOD' was not declared in this scope
     FTM2_MOD = APA_TICKS_PER_FRAME;
     ^
/home/merlin/Arduino/libraries/SmartMatrix/src/SmartMatrixAPA102RefreshTeensy_Impl.h:48:32: error: 'APA_TIMER_FREQUENCY' was not declared in this scope
 #define APA_TICKS_PER_FRAME   (APA_TIMER_FREQUENCY/refreshRate)
                                ^
/home/merlin/Arduino/libraries/SmartMatrix/src/SmartMatrixAPA102RefreshTeensy_Impl.h:175:16: note: in expansion of macro 'APA_TICKS_PER_FRAME'
     FTM2_MOD = APA_TICKS_PER_FRAME;
                ^
/home/merlin/Arduino/libraries/SmartMatrix/src/SmartMatrixAPA102RefreshTeensy_Impl.h:191:28: warning: there are no arguments to 'FTM_SC_CLKS' that depend on a template parameter, so a declaration of 'FTM_SC_CLKS' must be available [-fpermissive]
     FTM2_SC = FTM_SC_CLKS(1) | FTM_SC_PS(APA_LATCH_TIMER_PRESCALE) | FTM_SC_TOIE;
                            ^
/home/merlin/Arduino/libraries/SmartMatrix/src/SmartMatrixAPA102RefreshTeensy_Impl.h:191:66: warning: there are no arguments to 'FTM_SC_PS' that depend on a template parameter, so a declaration of 'FTM_SC_PS' must be available [-fpermissive]
     FTM2_SC = FTM_SC_CLKS(1) | FTM_SC_PS(APA_LATCH_TIMER_PRESCALE) | FTM_SC_TOIE;
                                                                  ^
/home/merlin/Arduino/libraries/SmartMatrix/src/SmartMatrixAPA102RefreshTeensy_Impl.h:191:70: error: 'FTM_SC_TOIE' was not declared in this scope
     FTM2_SC = FTM_SC_CLKS(1) | FTM_SC_PS(APA_LATCH_TIMER_PRESCALE) | FTM_SC_TOIE;
                                                                      ^
/home/merlin/Arduino/libraries/SmartMatrix/src/SmartMatrixAPA102RefreshTeensy_Impl.h:193:27: error: 'IRQ_FTM2' was not declared in this scope
     attachInterruptVector(IRQ_FTM2, apaRowShiftCompleteISR<refreshDepth, matrixWidth, matrixHeight, panelType, optionFlags>);
                           ^
/home/merlin/Arduino/libraries/SmartMatrix/src/SmartMatrixAPA102RefreshTeensy_Impl.h: In function 'void apaRowShiftCompleteISR()':
/home/merlin/Arduino/libraries/SmartMatrix/src/SmartMatrixAPA102RefreshTeensy_Impl.h:233:5: error: 'SPI0_RSER' was not declared in this scope
     SPI0_RSER = 0;
     ^
/home/merlin/Arduino/libraries/SmartMatrix/src/SmartMatrixAPA102RefreshTeensy_Impl.h:235:5: error: 'SPI0_SR' was not declared in this scope
     SPI0_SR = SPI_SR_TCF | SPI_SR_EOQF | SPI_SR_TFUF | SPI_SR_TFFF | SPI_SR_RFOF | SPI_SR_RFDF;
     ^
/home/merlin/Arduino/libraries/SmartMatrix/src/SmartMatrixAPA102RefreshTeensy_Impl.h:235:15: error: 'SPI_SR_TCF' was not declared in this scope
     SPI0_SR = SPI_SR_TCF | SPI_SR_EOQF | SPI_SR_TFUF | SPI_SR_TFFF | SPI_SR_RFOF | SPI_SR_RFDF;
               ^
/home/merlin/Arduino/libraries/SmartMatrix/src/SmartMatrixAPA102RefreshTeensy_Impl.h:235:28: error: 'SPI_SR_EOQF' was not declared in this scope
     SPI0_SR = SPI_SR_TCF | SPI_SR_EOQF | SPI_SR_TFUF | SPI_SR_TFFF | SPI_SR_RFOF | SPI_SR_RFDF;
                            ^
/home/merlin/Arduino/libraries/SmartMatrix/src/SmartMatrixAPA102RefreshTeensy_Impl.h:235:42: error: 'SPI_SR_TFUF' was not declared in this scope
     SPI0_SR = SPI_SR_TCF | SPI_SR_EOQF | SPI_SR_TFUF | SPI_SR_TFFF | SPI_SR_RFOF | SPI_SR_RFDF;
                                          ^
/home/merlin/Arduino/libraries/SmartMatrix/src/SmartMatrixAPA102RefreshTeensy_Impl.h:235:56: error: 'SPI_SR_TFFF' was not declared in this scope
     SPI0_SR = SPI_SR_TCF | SPI_SR_EOQF | SPI_SR_TFUF | SPI_SR_TFFF | SPI_SR_RFOF | SPI_SR_RFDF;
                                                        ^
/home/merlin/Arduino/libraries/SmartMatrix/src/SmartMatrixAPA102RefreshTeensy_Impl.h:235:70: error: 'SPI_SR_RFOF' was not declared in this scope
     SPI0_SR = SPI_SR_TCF | SPI_SR_EOQF | SPI_SR_TFUF | SPI_SR_TFFF | SPI_SR_RFOF | SPI_SR_RFDF;
                                                                      ^
/home/merlin/Arduino/libraries/SmartMatrix/src/SmartMatrixAPA102RefreshTeensy_Impl.h:235:84: error: 'SPI_SR_RFDF' was not declared in this scope
     SPI0_SR = SPI_SR_TCF | SPI_SR_EOQF | SPI_SR_TFUF | SPI_SR_TFFF | SPI_SR_RFOF | SPI_SR_RFDF;
                                                                                    ^
/home/merlin/Arduino/libraries/SmartMatrix/src/SmartMatrixAPA102RefreshTeensy_Impl.h:239:17: error: 'SPI_RSER_TFFF_RE' was not declared in this scope
     SPI0_RSER = SPI_RSER_TFFF_RE | SPI_RSER_TFFF_DIRS;
                 ^
/home/merlin/Arduino/libraries/SmartMatrix/src/SmartMatrixAPA102RefreshTeensy_Impl.h:239:36: error: 'SPI_RSER_TFFF_DIRS' was not declared in this scope
     SPI0_RSER = SPI_RSER_TFFF_RE | SPI_RSER_TFFF_DIRS;
                                    ^
/home/merlin/Arduino/libraries/SmartMatrix/src/SmartMatrixAPA102RefreshTeensy_Impl.h:244:5: error: 'FTM2_SC' was not declared in this scope
     FTM2_SC &= ~FTM_SC_TOF;
     ^
/home/merlin/Arduino/libraries/SmartMatrix/src/SmartMatrixAPA102RefreshTeensy_Impl.h:244:17: error: 'FTM_SC_TOF' was not declared in this scope
     FTM2_SC &= ~FTM_SC_TOF;
                 ^
In file included from /home/merlin/Arduino/libraries/SmartMatrix/src/SmartMatrix3.h:127:0,
                 from /home/merlin/Arduino/libraries/SmartMatrix/src/SmartLEDShieldV4.h:5,
                 from /home/merlin/arduino/libraries/SmartMatrix/examples/FeatureDemo/FeatureDemo.ino:6:
/home/merlin/Arduino/libraries/SmartMatrix/src/SmartMatrixMultiplexedCalcTeensy_Impl.h: In static member function 'static void SmartMatrix3<refreshDepth, matrixWidth, matrixHeight, panelType, optionFlags>::matrixCalculations(bool)':
/home/merlin/Arduino/libraries/SmartMatrix/src/SmartMatrixMultiplexedRefreshTeensy_Impl.h:53:32: error: 'TIMER_FREQUENCY' was not declared in this scope
 #define MIN_REFRESH_RATE    (((TIMER_FREQUENCY/65535)/MATRIX_SCAN_MOD/2) + 1)
                                ^
/home/merlin/Arduino/libraries/SmartMatrix/src/SmartMatrixMultiplexedCalcTeensy_Impl.h:111:47: note: in expansion of macro 'MIN_REFRESH_RATE'
             if(!initial && calc_refreshRate > MIN_REFRESH_RATE) {
                                               ^
/home/merlin/Arduino/libraries/SmartMatrix/src/SmartMatrixMultiplexedRefreshTeensy_Impl.h:53:32: error: 'TIMER_FREQUENCY' was not declared in this scope
 #define MIN_REFRESH_RATE    (((TIMER_FREQUENCY/65535)/MATRIX_SCAN_MOD/2) + 1)
                                ^
/home/merlin/Arduino/libraries/SmartMatrix/src/SmartMatrixMultiplexedCalcTeensy_Impl.h:160:35: note: in expansion of macro 'MIN_REFRESH_RATE'
             if(calc_refreshRate > MIN_REFRESH_RATE) {
                                   ^
/home/merlin/Arduino/libraries/SmartMatrix/src/SmartMatrixMultiplexedCalcTeensy_Impl.h: In member function 'void SmartMatrix3<refreshDepth, matrixWidth, matrixHeight, panelType, optionFlags>::setRefreshRate(uint8_t)':
/home/merlin/Arduino/libraries/SmartMatrix/src/SmartMatrixMultiplexedRefreshTeensy_Impl.h:53:32: error: 'TIMER_FREQUENCY' was not declared in this scope
 #define MIN_REFRESH_RATE    (((TIMER_FREQUENCY/65535)/MATRIX_SCAN_MOD/2) + 1)
                                ^
/home/merlin/Arduino/libraries/SmartMatrix/src/SmartMatrixMultiplexedCalcTeensy_Impl.h:216:25: note: in expansion of macro 'MIN_REFRESH_RATE'
     if(newRefreshRate > MIN_REFRESH_RATE)
                         ^
In file included from /home/merlin/Arduino/libraries/SmartMatrix/src/SmartMatrix3.h:140:0,
                 from /home/merlin/Arduino/libraries/SmartMatrix/src/SmartLEDShieldV4.h:5,
                 from /home/merlin/arduino/libraries/SmartMatrix/examples/FeatureDemo/FeatureDemo.ino:6:
/home/merlin/Arduino/libraries/SmartMatrix/src/SmartMatrixCoprocessorSend_Impl.h: In static member function 'static void SmartMatrix3CoprocessorSend<refreshDepth, matrixWidth, matrixHeight, panelType, optionFlags>::setRefreshRate(uint8_t)':
/home/merlin/Arduino/libraries/SmartMatrix/src/SmartMatrixCoprocessorSend_Impl.h:40:41: error: 'TIMER_FREQUENCY' was not declared in this scope
 #define COPROCESSOR_MIN_REFRESH_RATE (((TIMER_FREQUENCY/65535)/MATRIX_SCAN_MOD) + 1)
                                         ^
/home/merlin/Arduino/libraries/SmartMatrix/src/SmartMatrixCoprocessorSend_Impl.h:139:25: note: in expansion of macro 'COPROCESSOR_MIN_REFRESH_RATE'
     if(newRefreshRate > COPROCESSOR_MIN_REFRESH_RATE)
                         ^
In file included from /home/merlin/Arduino/libraries/SmartMatrix/src/SmartMatrix3.h:140:0,
                 from /home/merlin/Arduino/libraries/SmartMatrix/src/SmartLEDShieldV4.h:5,
                 from /home/merlin/arduino/libraries/SmartMatrix/examples/FeatureDemo/FeatureDemo.ino:6:
/home/merlin/Arduino/libraries/SmartMatrix/src/SmartMatrixCoprocessorSend_Impl.h: In static member function 'static void SmartMatrix3CoprocessorSend<refreshDepth, matrixWidth, matrixHeight, panelType, optionFlags>::begin()':
/home/merlin/Arduino/libraries/SmartMatrix/src/SmartMatrixCoprocessorSend_Impl.h:170:67: error: 'SPI0_PUSHR' was not declared in this scope
     dmaClockOutDataCoprocessorSend.destination((volatile uint8_t&)SPI0_PUSHR);
                                                                   ^
/home/merlin/Arduino/libraries/SmartMatrix/src/SmartMatrixCoprocessorSend_Impl.h:172:59: error: 'DMAMUX_SOURCE_SPI0_TX' was not declared in this scope
     dmaClockOutDataCoprocessorSend.triggerAtHardwareEvent(DMAMUX_SOURCE_SPI0_TX);
                                                           ^
/home/merlin/Arduino/libraries/SmartMatrix/src/SmartMatrixCoprocessorSend_Impl.h:178:5: error: 'FTM2_SC' was not declared in this scope
     FTM2_SC = 0;
     ^
/home/merlin/Arduino/libraries/SmartMatrix/src/SmartMatrixCoprocessorSend_Impl.h:179:5: error: 'FTM2_CNT' was not declared in this scope
     FTM2_CNT = 0;
     ^
/home/merlin/Arduino/libraries/SmartMatrix/src/SmartMatrixCoprocessorSend_Impl.h:180:5: error: 'FTM2_MOD' was not declared in this scope
     FTM2_MOD = COPROCESSOR_TICKS_PER_ROW;
     ^
In file included from /home/merlin/Arduino/libraries/SmartMatrix/src/SmartMatrix3.h:140:0,
                 from /home/merlin/Arduino/libraries/SmartMatrix/src/SmartLEDShieldV4.h:5,
                 from /home/merlin/arduino/libraries/SmartMatrix/examples/FeatureDemo/FeatureDemo.ino:6:
/home/merlin/Arduino/libraries/SmartMatrix/src/SmartMatrixCoprocessorSend_Impl.h:35:42: error: 'F_BUS' was not declared in this scope
 #define COPROCESSOR_TIMER_FREQUENCY     (F_BUS/16)
                                          ^
/home/merlin/Arduino/libraries/SmartMatrix/src/SmartMatrixCoprocessorSend_Impl.h:38:38: note: in expansion of macro 'COPROCESSOR_TIMER_FREQUENCY'
 #define COPROCESSOR_TICKS_PER_ROW   (COPROCESSOR_TIMER_FREQUENCY/refreshRate/MATRIX_SCAN_MOD)
                                      ^
/home/merlin/Arduino/libraries/SmartMatrix/src/SmartMatrixCoprocessorSend_Impl.h:180:16: note: in expansion of macro 'COPROCESSOR_TICKS_PER_ROW'
     FTM2_MOD = COPROCESSOR_TICKS_PER_ROW;
                ^
In file included from /home/merlin/Arduino/libraries/SmartMatrix/src/SmartMatrix3.h:140:0,
                 from /home/merlin/Arduino/libraries/SmartMatrix/src/SmartLEDShieldV4.h:5,
                 from /home/merlin/arduino/libraries/SmartMatrix/examples/FeatureDemo/FeatureDemo.ino:6:
/home/merlin/Arduino/libraries/SmartMatrix/src/SmartMatrixCoprocessorSend_Impl.h:184:5: error: 'FTM2_C0V' was not declared in this scope
     FTM2_C0V = 100;
     ^
/home/merlin/Arduino/libraries/SmartMatrix/src/SmartMatrixCoprocessorSend_Impl.h:188:43: warning: there are no arguments to 'PORT_PCR_MUX' that depend on a template parameter, so a declaration of 'PORT_PCR_MUX' must be available [-fpermissive]
         CORE_PIN3_CONFIG |= PORT_PCR_MUX(3) | PORT_PCR_DSE | PORT_PCR_SRE;  \
                                           ^
/home/merlin/Arduino/libraries/SmartMatrix/src/SmartMatrixCoprocessorSend_Impl.h:192:5: note: in expansion of macro 'ENABLE_LATCH_PWM_OUTPUT'
     ENABLE_LATCH_PWM_OUTPUT();
     ^
/home/merlin/Arduino/libraries/SmartMatrix/src/SmartMatrixCoprocessorSend_Impl.h:188:47: error: 'PORT_PCR_DSE' was not declared in this scope
         CORE_PIN3_CONFIG |= PORT_PCR_MUX(3) | PORT_PCR_DSE | PORT_PCR_SRE;  \
                                               ^
/home/merlin/Arduino/libraries/SmartMatrix/src/SmartMatrixCoprocessorSend_Impl.h:192:5: note: in expansion of macro 'ENABLE_LATCH_PWM_OUTPUT'
     ENABLE_LATCH_PWM_OUTPUT();
     ^
/home/merlin/Arduino/libraries/SmartMatrix/src/SmartMatrixCoprocessorSend_Impl.h:188:62: error: 'PORT_PCR_SRE' was not declared in this scope
         CORE_PIN3_CONFIG |= PORT_PCR_MUX(3) | PORT_PCR_DSE | PORT_PCR_SRE;  \
                                                              ^
/home/merlin/Arduino/libraries/SmartMatrix/src/SmartMatrixCoprocessorSend_Impl.h:192:5: note: in expansion of macro 'ENABLE_LATCH_PWM_OUTPUT'
     ENABLE_LATCH_PWM_OUTPUT();
     ^
/home/merlin/Arduino/libraries/SmartMatrix/src/SmartMatrixCoprocessorSend_Impl.h:196:28: warning: there are no arguments to 'FTM_SC_CLKS' that depend on a template parameter, so a declaration of 'FTM_SC_CLKS' must be available [-fpermissive]
     FTM2_SC = FTM_SC_CLKS(1) | FTM_SC_PS(COPROCESSOR_LATCH_TIMER_PRESCALE) | FTM_SC_TOIE;
                            ^
/home/merlin/Arduino/libraries/SmartMatrix/src/SmartMatrixCoprocessorSend_Impl.h:196:74: warning: there are no arguments to 'FTM_SC_PS' that depend on a template parameter, so a declaration of 'FTM_SC_PS' must be available [-fpermissive]
     FTM2_SC = FTM_SC_CLKS(1) | FTM_SC_PS(COPROCESSOR_LATCH_TIMER_PRESCALE) | FTM_SC_TOIE;
                                                                          ^
/home/merlin/Arduino/libraries/SmartMatrix/src/SmartMatrixCoprocessorSend_Impl.h:196:78: error: 'FTM_SC_TOIE' was not declared in this scope
     FTM2_SC = FTM_SC_CLKS(1) | FTM_SC_PS(COPROCESSOR_LATCH_TIMER_PRESCALE) | FTM_SC_TOIE;
                                                                              ^
/home/merlin/Arduino/libraries/SmartMatrix/src/SmartMatrixCoprocessorSend_Impl.h:198:27: error: 'IRQ_FTM2' was not declared in this scope
     attachInterruptVector(IRQ_FTM2, coprocessorSendRowShiftCompleteISR<refreshDepth, matrixWidth, matrixHeight, panelType, optionFlags>);
                           ^
/home/merlin/Arduino/libraries/SmartMatrix/src/SmartMatrixCoprocessorSend_Impl.h: In function 'void coprocessorSendRowShiftCompleteISR()':
/home/merlin/Arduino/libraries/SmartMatrix/src/SmartMatrixCoprocessorSend_Impl.h:240:5: error: 'SPI0_RSER' was not declared in this scope
     SPI0_RSER = 0;
     ^
/home/merlin/Arduino/libraries/SmartMatrix/src/SmartMatrixCoprocessorSend_Impl.h:242:5: error: 'SPI0_SR' was not declared in this scope
     SPI0_SR = SPI_SR_TCF | SPI_SR_EOQF | SPI_SR_TFUF | SPI_SR_TFFF | SPI_SR_RFOF | SPI_SR_RFDF;
     ^
/home/merlin/Arduino/libraries/SmartMatrix/src/SmartMatrixCoprocessorSend_Impl.h:242:15: error: 'SPI_SR_TCF' was not declared in this scope
     SPI0_SR = SPI_SR_TCF | SPI_SR_EOQF | SPI_SR_TFUF | SPI_SR_TFFF | SPI_SR_RFOF | SPI_SR_RFDF;
               ^
/home/merlin/Arduino/libraries/SmartMatrix/src/SmartMatrixCoprocessorSend_Impl.h:242:28: error: 'SPI_SR_EOQF' was not declared in this scope
     SPI0_SR = SPI_SR_TCF | SPI_SR_EOQF | SPI_SR_TFUF | SPI_SR_TFFF | SPI_SR_RFOF | SPI_SR_RFDF;
                            ^
/home/merlin/Arduino/libraries/SmartMatrix/src/SmartMatrixCoprocessorSend_Impl.h:242:42: error: 'SPI_SR_TFUF' was not declared in this scope
     SPI0_SR = SPI_SR_TCF | SPI_SR_EOQF | SPI_SR_TFUF | SPI_SR_TFFF | SPI_SR_RFOF | SPI_SR_RFDF;
                                          ^
/home/merlin/Arduino/libraries/SmartMatrix/src/SmartMatrixCoprocessorSend_Impl.h:242:56: error: 'SPI_SR_TFFF' was not declared in this scope
     SPI0_SR = SPI_SR_TCF | SPI_SR_EOQF | SPI_SR_TFUF | SPI_SR_TFFF | SPI_SR_RFOF | SPI_SR_RFDF;
                                                        ^
/home/merlin/Arduino/libraries/SmartMatrix/src/SmartMatrixCoprocessorSend_Impl.h:242:70: error: 'SPI_SR_RFOF' was not declared in this scope
     SPI0_SR = SPI_SR_TCF | SPI_SR_EOQF | SPI_SR_TFUF | SPI_SR_TFFF | SPI_SR_RFOF | SPI_SR_RFDF;
                                                                      ^
/home/merlin/Arduino/libraries/SmartMatrix/src/SmartMatrixCoprocessorSend_Impl.h:242:84: error: 'SPI_SR_RFDF' was not declared in this scope
     SPI0_SR = SPI_SR_TCF | SPI_SR_EOQF | SPI_SR_TFUF | SPI_SR_TFFF | SPI_SR_RFOF | SPI_SR_RFDF;
                                                                                    ^
/home/merlin/Arduino/libraries/SmartMatrix/src/SmartMatrixCoprocessorSend_Impl.h:246:17: error: 'SPI_RSER_TFFF_RE' was not declared in this scope
     SPI0_RSER = SPI_RSER_TFFF_RE | SPI_RSER_TFFF_DIRS;
                 ^
/home/merlin/Arduino/libraries/SmartMatrix/src/SmartMatrixCoprocessorSend_Impl.h:246:36: error: 'SPI_RSER_TFFF_DIRS' was not declared in this scope
     SPI0_RSER = SPI_RSER_TFFF_RE | SPI_RSER_TFFF_DIRS;
                                    ^
/home/merlin/Arduino/libraries/SmartMatrix/src/SmartMatrixCoprocessorSend_Impl.h:252:5: error: 'FTM2_SC' was not declared in this scope
     FTM2_SC &= ~FTM_SC_TOF;
     ^
/home/merlin/Arduino/libraries/SmartMatrix/src/SmartMatrixCoprocessorSend_Impl.h:252:17: error: 'FTM_SC_TOF' was not declared in this scope
     FTM2_SC &= ~FTM_SC_TOF;
                 ^
In file included from /home/merlin/Arduino/libraries/SmartMatrix/src/SmartMatrix3.h:127:0,
                 from /home/merlin/Arduino/libraries/SmartMatrix/src/SmartLEDShieldV4.h:5,
                 from /home/merlin/arduino/libraries/SmartMatrix/examples/FeatureDemo/FeatureDemo.ino:6:
/home/merlin/Arduino/libraries/SmartMatrix/src/SmartMatrixCoprocessorCalc_Impl.h: In static member function 'static void SmartMatrixCoprocessorCalc<refreshDepth, matrixWidth, matrixHeight, panelType, optionFlags>::matrixCalculations(bool)':
/home/merlin/Arduino/libraries/SmartMatrix/src/SmartMatrixMultiplexedRefreshTeensy_Impl.h:53:32: error: 'TIMER_FREQUENCY' was not declared in this scope
 #define MIN_REFRESH_RATE    (((TIMER_FREQUENCY/65535)/MATRIX_SCAN_MOD/2) + 1)
                                ^
/home/merlin/Arduino/libraries/SmartMatrix/src/SmartMatrixCoprocessorCalc_Impl.h:99:47: note: in expansion of macro 'MIN_REFRESH_RATE'
             if(!initial && calc_refreshRate > MIN_REFRESH_RATE) {
                                               ^
/home/merlin/Arduino/libraries/SmartMatrix/src/SmartMatrixMultiplexedRefreshTeensy_Impl.h:53:32: error: 'TIMER_FREQUENCY' was not declared in this scope
 #define MIN_REFRESH_RATE    (((TIMER_FREQUENCY/65535)/MATRIX_SCAN_MOD/2) + 1)
                                ^
/home/merlin/Arduino/libraries/SmartMatrix/src/SmartMatrixCoprocessorCalc_Impl.h:148:35: note: in expansion of macro 'MIN_REFRESH_RATE'
             if(calc_refreshRate > MIN_REFRESH_RATE) {
                                   ^
/home/merlin/Arduino/libraries/SmartMatrix/src/SmartMatrixCoprocessorCalc_Impl.h: In member function 'void SmartMatrixCoprocessorCalc<refreshDepth, matrixWidth, matrixHeight, panelType, optionFlags>::setRefreshRate(uint8_t)':
/home/merlin/Arduino/libraries/SmartMatrix/src/SmartMatrixMultiplexedRefreshTeensy_Impl.h:53:32: error: 'TIMER_FREQUENCY' was not declared in this scope
 #define MIN_REFRESH_RATE    (((TIMER_FREQUENCY/65535)/MATRIX_SCAN_MOD/2) + 1)
                                ^
/home/merlin/Arduino/libraries/SmartMatrix/src/SmartMatrixCoprocessorCalc_Impl.h:204:25: note: in expansion of macro 'MIN_REFRESH_RATE'
     if(newRefreshRate > MIN_REFRESH_RATE)
                         ^
/home/merlin/Arduino/libraries/SmartMatrix/src/SmartMatrixAPA102Calc_Impl.h: In member function 'void SmartMatrixApaCalc<refreshDepth, matrixWidth, matrixHeight, panelType, optionFlags>::setRefreshRate(uint8_t)':
/home/merlin/Arduino/libraries/SmartMatrix/src/SmartMatrixMultiplexedRefreshTeensy_Impl.h:53:32: error: 'TIMER_FREQUENCY' was not declared in this scope
 #define MIN_REFRESH_RATE    (((TIMER_FREQUENCY/65535)/MATRIX_SCAN_MOD/2) + 1)
                                ^
/home/merlin/Arduino/libraries/SmartMatrix/src/SmartMatrixAPA102Calc_Impl.h:179:25: note: in expansion of macro 'MIN_REFRESH_RATE'
     if(newRefreshRate > MIN_REFRESH_RATE)
                         ^
In file included from /home/merlin/Arduino/libraries/SmartMatrix/src/Layer_Background.h:117:0,
                 from /home/merlin/Arduino/libraries/SmartMatrix/src/SmartMatrix3.h:48,
                 from /home/merlin/Arduino/libraries/SmartMatrix/src/SmartLEDShieldV4.h:5,
                 from /home/merlin/arduino/libraries/SmartMatrix/examples/FeatureDemo/FeatureDemo.ino:6:
/home/merlin/Arduino/libraries/SmartMatrix/src/Layer_Background_Impl.h: In instantiation of 'void SMLayerBackground<RGB, optionFlags>::drawString(int16_t, int16_t, const RGB&, const char*) [with RGB = rgb24; unsigned int optionFlags = 0u; int16_t = short int]':
/home/merlin/arduino/libraries/SmartMatrix/examples/FeatureDemo/FeatureDemo.ino:704:104:   required from here

Thanks everyone for contributing to this effort. From what I understand so far, this isn’t going to be an easy port, and Teensy 4.0 is very unlikely to be compatible with the SmartLED shield. I’m working on something that will allow driving HUB75 panels from any micro with an SPI port, so indirectly I’m working on Teensy 4.0 support, and that’s my priority for now.

Has Paul ported the OctoWS2812 driver to T4.0? That used a timer and DMA combo similar to SmartMatrix so if that is ported it might be a good reference.

Hello Louis

If you refer to OctoWS2811, I have compiled it for Teensy 4.0, and there are errors, specifically GPIOD_PSOR and GPIOD_PCOR.

The Github has not been updated for a year.

Today I received the two units of Teensy 4.0 that I ordered, I will see if I try things, anyway I already consulted in the PJRC forums and about DMA there is little information.

Some (unfortunate) info on the Teensy 4.0 pins here:

I think the most adjacent parallel bits on any one port is six with this Teensy. You’ll have to do some rearranging of your commands to send 7 or eight bit words

With the Teensy 3.x SmartMatrix Library, I need to be able to toggle 7 pins with DMA: 6x RGB pins, 1x CLK. Only having 6 pins available means a much larger redesign of how SmartMatrix Library would work on the Teensy 4.0. Right now it’s looking like the best way of getting Teensy 4.0 to drive large RGB panels at a high frame rate is to use the ESP32-based “co-processor” I’m slowly working on.

Sigh, thanks for the update. Now, if you’re going to use a co-processor, how about using an FPGA which will got must faster than an ESP32 ever will?

FPGAs are expensive as far as I can tell. If you can find me a FPGA with a similar amount of RAM as an ESP32 and comparable price point, I’m interested.

I’m actually making progress on the coprocessor! As of this afternoon, I have a sketch receiving SPI with the APA102 protocol at 4MHz using DMA (I2S In peripheral), writing to a 48bpp SmartMatrix buffer (taking advantage of the GBC bits in the APA102 protocol), refreshing a 64x64 panel at >120Hz 36-bit color. This is running on an ESP32 Pico board, with just a 5V->3.3V level shifter for external circuitry. There’s enough RAM to refresh a 128x64 panel if I add a SmartLED Shield circuit with address latch externally.

128x128 is a stretch goal I’m saving for later. It might be possible, but not easy.

fair point on FPGA price, I’m not up to date on that.
But to be honest, 128x64 is not bad, but likely underwhelming. It’s the size of a single panel now, and with just two of them I can do 128x128.
Now, it’s true that with FastLED::NeoMatrix, which I happen to know the author, of :slight_smile: you can tile multiple APA102 matrices into a bigger logical matrix.
Maybe it’s the best/cheapest we can do for now, one ESP32 per 128x64 panel.

Good to know that about FastLED::NeoMatrix, I will have to give that feature a try.

Maybe it’s the best/cheapest we can do for now, one ESP32 per 128x64 panel.

Do we know of any other microcontroller besides the ESP32 that can refresh a 128x64 panel (with decent color depth and refresh rate)? Do we know of any micro that can refresh a 128x128 panel (or two 128x64 panels)? Raspberry Pi is a Single Board Computer, not a microcontroller, and a much different higher point and larger form factor, and larger complexity.

I think supporting 128x64 is pretty good, and it doesn’t need to be any larger, at least not until a larger panel comes out. Most people aren’t pushing the limits of pixel count like you are :slight_smile:

I was able to drive 2 128x64 panels (i.e. 128x128 total) with a teensy 3.6 but the refresh rate was bad, so I agree that 128x64 seems the highest we can reasonably do between those 2 CPUs.
When I’m not travelling, I want to look into running my code on rPi (I’ve already confirmed rPi runs 128x128 without sweating), but having some integrated solution where an ESP32 backpack can be connected to a 128x64 panel and give an APA102 output, would also be an attractive solution.

You can use an NXP RT1020, it is a Cortex M7 at 500Mhz. Much more powerful than an ESP32 (160-240Mhz), it is an ARM processor and you have a free and professional development environment (MCUXpresso).

Discarding the Teensy 4.0 does not mean not being able to use the NXP RT microcontroller series. Only you have to design your own board with the microcontroller, an LQFP144, which is not difficult to weld, or if you order them to manufacture the ready made board (with the microcontroller already soldered), it will be much simpler.

https://www.mouser.es/ProductDetail/NXP-Semiconductors/MIMXRT1021DAG5A?qs=sGAEpiMZZMu0J0Wcc3HWIhG9ph%252BpHUB507uZXgfZiGm94s1Ut5Nvtg%3D%3D

I have my own design based on a MIMXRT1021DAG5A, it is also very cheap compared to ST STM32H7. Since it has no flash memory, you can boot from QSPI, SD card or hyperflash. You can also add an external SDRAM of up to 256Mbit to load and run the program from RAM, which is even faster.

I enclose my scheme with the RT1020, in order to use the Smartmatrix, porting it to MCUXpresso, which seems to me a much better development environment than Arduino.

Some more details from PJRC on how even a larger Teensy 4-series part with more pins brought out may not (or possibly could) support DMA driving GPIO pins:

The GPIO registers in these newer chips do not support 8 or 16 bit access.

However, having 8 or 16 consecutive bits of a FlexIO peripheral might be useful…

I’m not familiar with FlexIO, so I don’t know what that implies. I’m mostly putting this here for anyone that comes across this thread and wants to drive GPIO with DMA from a Teensy 4.x, I don’t have any plans to add Teensy 4.x support to SmartMatrix Library as of now.

1 Like
1 Like

Here’s an update to the T4.0 driver along with some test results for bigger resolutions (up to 256x256):

I would like to get this working with the SmartMatrix library soon.

What is the preferred way to do that? I think it would be compatible with the existing code for the layer classes but I am not planning to support hardware other than the v4 shield or have the code be compatible with T3.x, so I don’t think it makes sense to merge it into the existing SmartMatrix3.h and SmartMatrix_impl.h source.

One way would be to create an entirely new library for T4 which replicates the Layer class files. Or the new T4 code could be included in the original library but would be new files named something like SmartMatrix_t4.h. Or Louis may prefer that I don’t use the SmartMatrix name.

Great work on this, I’m really impressed with the results you posted!

The “teensylc” branch is set up to allow different hardware types. I think the best thing to do is try to follow what I did to add support for the teensy lc and ESP32 and add a class for the Teensy 4.0 with your code. I’m really limited on time right now but happy to help out where I can.

I’ll have to think about how to handle the hardware definition file. For now, don’t try to edit the existing V4 shield file. Make a new file named V4T4 or something unique to the use case of a modified V4 shield with Teensy 4 in it.

1 Like

Maybe a reminder to rename the master branch as ‘oldstable’ (git branch) and then integrate teensylc into master after putting a last commit in teensylc with a README pointing out that people should go to master instead?
All in all it should take 10-15mn hopefully?

1 Like

Teensy 4.0/4.1 support update:
@easone is refactoring his code into SmartMatrix Library, and with his help I finalized a shield design that will support both Teensy 4.0/4.1 and I’m ordering prototypes. It’s based off of SmartLED Shield for Teensy 3 V4, and looks identical. We’ll post more updates in this thread.

2 Likes

I see that t 4.1 is out now. Looking forward to the new shield.

1 Like

By the way, I wanted to give a shout out to @lemuroid (Mark Estes), the code wizard behind the most arduino 2D demos I’ve found:

1 Like