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

Thread: Teensy 4.0 + RGB Matrix Shield V5 does not compile

  1. #1
    Junior Member
    Join Date
    Mar 2021
    Posts
    3

    Teensy 4.0 + RGB Matrix Shield V5 does not compile

    I bought a Teensy 4.0 and RGB Matrix Shield (V5) from Adafruit. I loaded the SmartMatrix library. I selected the FeatureDemo example. It compiles with no errors (have not connected to shield yet).
    When I select the MatrixClock example, it compiles with the following errors:

    Arduino: 1.8.13 (Windows 10), TD: 1.54-beta4, Board: "Teensy 4.0, Serial, 600 MHz, Faster, US English"

    In file included from C:\Users\Tom\AppData\Local\Temp\arduino_modified_s ketch_854829\MatrixClock.ino:28:0:
    D:\_Arduino\libraries\SmartMatrix\src/MatrixHardware_Teensy4_ShieldV5.h:41:17: note: #pragma message: MatrixHardware: SmartLED Shield for Teensy 4 (V5)
    #pragma message "MatrixHardware: SmartLED Shield for Teensy 4 (V5)"
    ^
    In file included from C:\Users\Tom\AppData\Local\Temp\arduino_modified_s ketch_854829\MatrixClock.ino:33:0:
    D:\_Arduino\libraries\SmartMatrix\src/SmartMatrix.h:40:21: note: #pragma message: SmartMatrix Library version 4.000.003
    # pragma message "SmartMatrix Library version 4.000.003"
    ^
    C:\Program Files (x86)\Arduino\libraries\TimeLib\DateStrings.cpp: In function 'char* monthStr(uint8_t)':
    C:\Program Files (x86)\Arduino\libraries\TimeLib\DateStrings.cpp:76 :66: error: 'strcpy_P' was not declared in this scope
    strcpy_P(buffer, (PGM_P)pgm_read_word(&(monthNames_P[month])));
    ^
    C:\Program Files (x86)\Arduino\libraries\TimeLib\DateStrings.cpp: In function 'char* dayStr(uint8_t)':
    C:\Program Files (x86)\Arduino\libraries\TimeLib\DateStrings.cpp:90 :61: error: 'strcpy_P' was not declared in this scope
    strcpy_P(buffer, (PGM_P)pgm_read_word(&(dayNames_P[day])));
    ^
    Multiple libraries were found for "MatrixHardware_Teensy4_ShieldV5.h"
    Used: D:\_Arduino\libraries\SmartMatrix
    Not used: D:\_Arduino\libraries\SmartMatrix-master
    Multiple libraries were found for "TimeLib.h"
    Used: C:\Program Files (x86)\Arduino\libraries\TimeLib
    Not used: C:\Program Files (x86)\Arduino\libraries\Time
    Not used: C:\Program Files (x86)\Arduino\hardware\teensy\avr\libraries\Time
    Error compiling for board Teensy 4.0.

    Example code, as edited for proper Teensy and Shield attached.

    I do not understand what I am doing wrong.

    Thanks for any help.

    Tom
    Attached Files Attached Files

  2. #2
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    24,099
    Maybe delete the copy in D:\_Arduino\libraries\SmartMatrix, so Arduino will then use D:\_Arduino\libraries\SmartMatrix-master.

    Or just move it somewhere else on your computer were Arduino doesn't look for libraries.


    Quote Originally Posted by TomMynar View Post
    Multiple libraries were found for "MatrixHardware_Teensy4_ShieldV5.h"
    Used: D:\_Arduino\libraries\SmartMatrix
    Not used: D:\_Arduino\libraries\SmartMatrix-master

  3. #3
    Are you actually using the SmartLED shield (https://docs.pixelmatix.com/SmartMatrix/shieldref.html?) You said you have the Adafruit RGB Matrix Shield, but that's only for Arduino-compatible boards, not Teensy 4.0.

    Unfortunately the MatrixClock example from SmartMatrix Library is old and has not been ported to Teensy 4.0. It was intended to be used with an external DS1307 RTC module connected to Teensy 3.x via I2C.

    For Teensy 4.0, I recommend sticking with the FeatureDemo example, that's the one that was tested most thoroughly when @embedded-creations and I ported SmartMatrix to Teensy 4.

  4. #4
    Junior Member
    Join Date
    Mar 2021
    Posts
    3
    Paul:

    I moved the libraries from the source directory to the Windows Program Files (x86) library location. I dislike the way Arduino does library updates by leaving the original on the install directory and places the updates in the folder where I store my source code.

    Anyways, same errors.

    I forgot to mention that I cut the trace on the Teensy for VIN power to be separate from the USB power. Now the board does not show up on the COM port, so I'm guessing the USB power is not getting to the board and I have to supply VIN with the 5V from the shield ? I will play with that to see, or somehow the board failed.

    Easone:

    Here is the link to the Adafruit product I purchased from my "Orders":

    https://www.adafruit.com/product/4828

    I believe it is the appropriate board for the Adafruit Teensy 4.0 board.

    Also:
    I plugged the board into the shield, supplied 5V and the FeatureDemo script ran. I had forgotten to change the matrix size from the default of 32x32 to 32x64. The displayed showed moving text separated in the middle. I made the width=64 change and now I cannot upload to the Teensy.

    Is the Teensy *very* sensitive to static ? I have not had this happen with any of my other ESP or Arduino boards (I've done my share of supplying the wrong voltage...).

    I am supplying the shield with 5V from a 12V 2A supply through a voltage regulator (from EZSBC). Since the demo script ran (once) I assume that is connected properly and working correctly.


    I have electrical/electronic background so you can get very technical if you wish. I've been involved in main frame, minicomputer and the PC business for over 40 years. The intended use for the Teensy and RGB Matrix is scrolling display, graphics and text. I've done the EPS32 banging using the P3RGB64x32MatrixPanel library but it is all done on prototyping boards, so I wanted to use something powerful enough (SAMD based) and an etched PC board so I can run a larger matrix. I will continue to work with the recommended FeatureDemo script to make my project.


    Thanks for your quick responses, it gives me research material to continue debugging.

    Tom

  5. #5
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    24,099
    Quote Originally Posted by TomMynar View Post
    I forgot to mention that I cut the trace on the Teensy for VIN power to be separate from the USB power. Now the board does not show up on the COM port, so I'm guessing the USB power is not getting to the board and I have to supply VIN with the 5V from the shield ? I will play with that to see, or somehow the board failed.
    Like all electronics, it can't work if it's not getting power. The best way to check is with a voltmeter. Check both VIN-GND and 3.3V-GND to make sure your Teensy 4 really is powering up.


    I plugged the board into the shield, supplied 5V and the FeatureDemo script ran. I had forgotten to change the matrix size from the default of 32x32 to 32x64. The displayed showed moving text separated in the middle. I made the width=64 change and now I cannot upload to the Teensy.

    Is the Teensy *very* sensitive to static ? I have not had this happen with any of my other ESP or Arduino boards (I've done my share of supplying the wrong voltage...).
    Very difficult to say what went wrong from only this message.

    But I can tell you we hear "cannot upload" over and over on this forum (without any further info about what was actually attempted and actually seen) and it very often turns out Teensy was loaded with "bad" code where the auto-reboot request from Arduino no longer works.

    If you're familiar with traditional Ardiuno and ESP boards, you've probably been using "Serial" which actually is a hardware serial port that communicates with a dedicated USB-serial chip. When something goes wrong on the microcontroller code, the USB connection remains very reliable because it is implemented by a dedicated chip that's unaffected by whatever code you uploaded.

    Teensy is a native USB board. So are most of Arduino's newer products, and ESP's newer chip is also. With native USB, the ability to upload by just clicking a button in Arduino depends on the board still successfully running a previously uploaded program. The USB isn't a separate chip. There are lots of ways your program can crash or otherwise mess up the USB communication.

    Every Teensy has a pushbutton dedicated to getting you back into programming mode. When bad code has been loaded and Arduino can't initiate a new upload by USB communication, it will give you an error which says to press the pushbutton. Maybe you did that? Maybe not? I want you to understand how I'm trying to help, but when all I know are 2 words "cannot upload" and many times before others have said those words when normal software-initiated upload not longer worked... well, can you see how this lack of detail leaves a lot of guesswork?

    On Teensy 4.0 & 4.1, we also have a special 15 second button press which triggers a full erase and restore of a known-good program to the flash. Hold for about 15 seconds (feels like forever) and you'll see a quick flash of the LED at the moment it's ready. You must release the button within 4 seconds of that red LED blink. You'll see the red LED turn on bright for many seconds (nearly a minute on Teensy 4.1) while it fully wipes the flash memory. When it's finished, you'll see the orange LED blink again after your board has rebooted and it's running a known-good program where USB definitely works.

    Of course that 15 sec restore process only works if your Teensy 4 has proper 3.3V power, so grab a voltmeter and check that the power really is on.

    Another problem we sometimes hear with these LED projects is USB ports or USB hubs shutting down if too much current is drawn. Ideally your hardware is supposed to report this to its drivers and OS is supposed to tell you. But that only seems to work reliably on MacOS. Sometimes Widows will give an alert, but a lot of commodity PC hardware doesn't properly report the problem so those alerts aren't often seen on Windows. On Linux is might work but probably gets buried in a log file where you don't see it. Usually a full cold reboot of your PC cures everything after this has happened.

    If I had any idea what's actually going wrong, I would type a shorter and more helpful message. Please, try to understand I'm really in the dark and trying to help by just covering the many things we commonly see in these sorts of low-detail problem reports.

  6. #6
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany
    Posts
    8,282
    Last edited by Frank B; 03-26-2021 at 11:49 AM.

  7. #7
    Junior Member
    Join Date
    Mar 2021
    Posts
    3
    Paul,

    Yes, I understand how it is difficult to explain what goes wrong with limited information. You have given me exactly what I needed to know why things work the way they do (sorry, had to misquote Star Trek here.) When building my prototype ESP boards, I put a diode from the input voltage (3.3 or 5v) to the board, protecting from this exact problem: USB power from PC being fed back from the external power. But I didn't expect that cutting this trace removed ALL power from the Teensy.

    Once I re-connected the power to the shield, the programming restarted. I was able to make changes to the FeatureDemo sketch.

    Thanks for all the technical info, very concise and detailed.

    Tom

Posting Permissions

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