0

Teensy errors using Adafruit RGBMatrixPanel library
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Teensy errors using Adafruit RGBMatrixPanel library

by queenidog on Fri Jun 18, 2021 8:54 am

I get a number of errors compiling programs for the Teensy 3.2, using Adafruit's RGBMatrixPanel library. I'm using the library with a large (5feet x 2feet) 16x32 pixel LED matrix. It works fine with any program where I use the library on an Atmega 328 (same MPU as UNO).

But replacing the 328 with the Teensy I get the following errors, that seem to be very common with the Teensy (according to Google search). There is a comment from Lady Ada on Github about this error and the TFT library.

The Arduino sketch, an example program from the RGBMatrixPanel library FOLLOWS the error listing.


ERROR LISTING
Arduino: 1.8.13 (Windows 10), TD: 1.53, Board: "Teensy 3.2 / 3.1, Serial, 96 MHz (overclock), Faster, US English"

ScrollTestFELibV11TeensyTEst:35: warning: overflow in implicit constant conversion

textMin = sizeof(str1) * -6,//-12 def, -6 makes text appear faster (less space) -12 needed for text size 2

^

D:\ArduinoSketch\libraries\RGBmatrixPanel\RGBmatrixPanel.cpp: In member function 'void RGBmatrixPanel::init(uint8_t, uint8_t, uint8_t, uint8_t, uint8_t, uint8_t, uint8_t, boolean, uint8_t)':

D:\ArduinoSketch\libraries\RGBmatrixPanel\RGBmatrixPanel.cpp:141:13: error: cannot convert 'volatile uint8_t* {aka volatile unsigned char*}' to 'volatile PortType* {aka volatile long unsigned int*}' in assignment

latport = portOutputRegister(digitalPinToPort(lat));

^

D:\ArduinoSketch\libraries\RGBmatrixPanel\RGBmatrixPanel.cpp:143:13: error: cannot convert 'volatile uint8_t* {aka volatile unsigned char*}' to 'volatile PortType* {aka volatile long unsigned int*}' in assignment

oeport = portOutputRegister(digitalPinToPort(oe));

^

D:\ArduinoSketch\libraries\RGBmatrixPanel\RGBmatrixPanel.cpp:145:13: error: cannot convert 'volatile uint8_t* {aka volatile unsigned char*}' to 'volatile PortType* {aka volatile long unsigned int*}' in assignment

addraport = portOutputRegister(digitalPinToPort(a));

^

D:\ArduinoSketch\libraries\RGBmatrixPanel\RGBmatrixPanel.cpp:147:13: error: cannot convert 'volatile uint8_t* {aka volatile unsigned char*}' to 'volatile PortType* {aka volatile long unsigned int*}' in assignment

addrbport = portOutputRegister(digitalPinToPort(b));

^

D:\ArduinoSketch\libraries\RGBmatrixPanel\RGBmatrixPanel.cpp:149:13: error: cannot convert 'volatile uint8_t* {aka volatile unsigned char*}' to 'volatile PortType* {aka volatile long unsigned int*}' in assignment

addrcport = portOutputRegister(digitalPinToPort(c));

^

D:\ArduinoSketch\libraries\RGBmatrixPanel\RGBmatrixPanel.cpp: In constructor 'RGBmatrixPanel::RGBmatrixPanel(uint8_t, uint8_t, uint8_t, uint8_t, uint8_t, uint8_t, uint8_t, boolean, uint8_t)':

D:\ArduinoSketch\libraries\RGBmatrixPanel\RGBmatrixPanel.cpp:189:13: error: cannot convert 'volatile uint8_t* {aka volatile unsigned char*}' to 'volatile PortType* {aka volatile long unsigned int*}' in assignment

addrdport = portOutputRegister(digitalPinToPort(d));

^

D:\ArduinoSketch\libraries\RGBmatrixPanel\RGBmatrixPanel.cpp: In member function 'void RGBmatrixPanel::updateDisplay()':

D:\ArduinoSketch\libraries\RGBmatrixPanel\RGBmatrixPanel.cpp:721:21: error: 'LOOPTIME' was not declared in this scope

t = (nRows > 8) ? LOOPTIME : (LOOPTIME * 2);

^

D:\ArduinoSketch\libraries\RGBmatrixPanel\RGBmatrixPanel.cpp:722:20: error: 'CALLOVERHEAD' was not declared in this scope

duration = ((t + CALLOVERHEAD * 2) << plane) - CALLOVERHEAD;

^

D:\ArduinoSketch\libraries\RGBmatrixPanel\RGBmatrixPanel.cpp:842:5: error: 'pew' was not declared in this scope

pew pew pew pew pew pew pew pew

^

D:\ArduinoSketch\libraries\RGBmatrixPanel\RGBmatrixPanel.cpp:709:12: warning: unused variable 'i' [-Wunused-variable]

uint8_t i, tick, tock, *ptr;

^

D:\ArduinoSketch\libraries\RGBmatrixPanel\RGBmatrixPanel.cpp:709:15: warning: unused variable 'tick' [-Wunused-variable]

uint8_t i, tick, tock, *ptr;

^

D:\ArduinoSketch\libraries\RGBmatrixPanel\RGBmatrixPanel.cpp:709:21: warning: unused variable 'tock' [-Wunused-variable]

uint8_t i, tick, tock, *ptr;

^

Multiple libraries were found for "SPI.h"

Used: D:\ArduinoSketch\libraries\SPI

Not used: D:\ArduinoSketch\libraries\SPI-master

Not used: C:\Program Files (x86)\Arduino\hardware\teensy\avr\libraries\SPI

Multiple libraries were found for "RGBmatrixPanel.h"

Used: D:\ArduinoSketch\libraries\RGBmatrixPanel

Not used: D:\ArduinoSketch\libraries\RGB_matrix_Panel

Multiple libraries were found for "Adafruit_GFX.h"

Used: D:\ArduinoSketch\libraries\Adafruit_GFX_Library

Not used: D:\ArduinoSketch\libraries\Adafruit-GFX-Library

Error compiling for board Teensy 3.2 / 3.1.



This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.



ARDUINO SKETCH EXAMPLE

Code: Select all | TOGGLE FULL SIZE
   Vers History: V1.0   Start
                  V1.1 Made note that setRotation is 0 for Adafruit, 2 for FE

   Written by Limor Fried/Ladyada & Phil Burgess/PaintYourDragon
*/

#include <RGBmatrixPanel.h>
//#define CLK  8  // Atmega 328
//#define OE   9
//#define LAT 10
//#define A   A0
//#define B   A1
//#define C   A2
#define CLK  15  // Teensy 3.2
#define OE   12
#define LAT 11
#define A   A0
#define B   A1
#define C   A2

RGBmatrixPanel matrix(A, B, C, CLK, LAT, OE, false);//won't work if true

// Similar to F(), but for PROGMEM string pointers rather than literals
#define F2(progmem_ptr) (const __FlashStringHelper *)progmem_ptr
const char str1[] PROGMEM = "Hello Indian Harbour";
int16_t    textX         = matrix.width(),
           textMin       = sizeof(str1) * -6,//-12 def, -6 makes text appear faster (less space) -12 needed for text size 2
           hue           = 0;
/*****************************************/
void setup() {
  matrix.begin();
  matrix.setTextWrap(false); //true= 16 rows 2 lines  false: 8 rows,one line
  matrix.setTextSize(2);//0 or 1=upper 8 rows, 2=uses both rows,large text, 3=overscans if =2, need str size of -12
  matrix.setTextColor(matrix.Color333(7, 0, 3));
  matrix.setRotation(2);//0 for Adafruit, 2 for FE display
}
/****************************************/
void loop() {
  //byte i;
  //Clear background
  matrix.fillScreen(matrix.Color333(0, 0, 0)); // R,G,B 7 is max
  // Draw big scrolly text on top. HSV: hue, saturation, brightness (0 is off)
  //matrix.setTextColor(matrix.ColorHSV(1000, 155,250, true));//hue=500, bright green, 1000 bright blue
  matrix.setCursor(textX, 0);//1=def row space above first line of text 4=middle
  matrix.print(F2(str1));
  delay(150);//scroll speed

  // Move text left (w/wrap), increase hue
 if ((--textX) < textMin) textX = matrix.width();//need for scroll hue does not increase
  hue += 7;//prints red only if commmented out, def=7
 // if (hue >= 1536) hue -= 1536;
  // hue=500;//FE added 500 is bright green

#if !defined(__AVR__)
  // On non-AVR boards, delay slightly so screen updates aren't too quick.
  delay(20);
#endif

  // Update display
  matrix.swapBuffers(false);
}
Attachments
IMG_0544 (Medium).JPG
IMG_0544 (Medium).JPG (260.28 KiB) Viewed 117 times

queenidog
 
Posts: 19
Joined: Wed Jan 17, 2018 2:40 pm

Re: Teensy errors using Adafruit RGBMatrixPanel library

by queenidog on Fri Jun 18, 2021 10:03 am

Alternatively, instead of fixing the library to work with my Teensy, I could re-jig the MPU section of my PCB to use a different processor, eg ESP-32, which appears to have support in the RGBmatrixPanel library.

Suggestions? The hardware issue is easier for me than trying to figure out the library.

queenidog
 
Posts: 19
Joined: Wed Jan 17, 2018 2:40 pm

Re: Teensy errors using Adafruit RGBMatrixPanel library

by adafruit_support_mike on Sun Jun 27, 2021 3:15 am

That library uses some assembly code, so swapping to the ESP32 would be easier than adapting it to the Teensy's Freescale microcontroller.

adafruit_support_mike
 
Posts: 63053
Joined: Thu Feb 11, 2010 2:51 pm

Please be positive and constructive with your questions and comments.