Teensy 4.0 Compile Problem not seen with Teensy 3.2

Status
Not open for further replies.

jbrob

New member
I am having an issue compiling the "Uncanny Eyes" sketch by Adafruit (https://github.com/adafruit/Uncanny_Eyes/archive/master.zip). If I select Teensy 3.2, the sketch compiles without an issue.
I downloaded and installed Teensyduino on 9/7/2019. I think the other setup information and the error is detailed below:

Arduino: 1.8.10 (Windows 10), TD: 1.48, Board: "Teensy 4.0, Serial, 600 MHz, Faster, US English"

uncannyEyes: In function 'void drawEye(uint8_t, uint16_t, uint8_t, uint8_t, uint8_t, uint8_t)':
uncannyEyes:409: error: 'KINETISK_SPI0' was not declared in this scope
while(KINETISK_SPI0.SR & 0xC000); // Wait for space in FIFO

^

uncannyEyes:410: error: 'KINETISK_SPI0' was not declared in this scope
KINETISK_SPI0.PUSHR = p | SPI_PUSHR_CTAS(1) | SPI_PUSHR_CONT;

^

uncannyEyes:410: error: 'SPI_PUSHR_CTAS' was not declared in this scope
KINETISK_SPI0.PUSHR = p | SPI_PUSHR_CTAS(1) | SPI_PUSHR_CONT;

^

uncannyEyes:410: error: 'SPI_PUSHR_CONT' was not declared in this scope
KINETISK_SPI0.PUSHR = p | SPI_PUSHR_CTAS(1) | SPI_PUSHR_CONT;

^

uncannyEyes:425: error: 'KINETISK_SPI0' was not declared in this scope
KINETISK_SPI0.SR |= SPI_SR_TCF; // Clear transfer flag

^

uncannyEyes:425: error: 'SPI_SR_TCF' was not declared in this scope
KINETISK_SPI0.SR |= SPI_SR_TCF; // Clear transfer flag

^

Multiple libraries were found for "SPI.h"
Used: C:\Program
Multiple libraries were found for "Adafruit_GFX.h"
Used: C:\Users\jrobi\Documents\Arduino\libraries\Adafruit_GFX_Library
Multiple libraries were found for "Adafruit_SSD1351.h"
Used: C:\Users\jrobi\Documents\Arduino\libraries\Adafruit_SSD1351_library
'KINETISK_SPI0' was not declared in this scope

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
 
The uncanny eyes program used a lot of Teensy 3.x specific optimizations for display that are completely different for Teensy 4.0.

Some time ago, mjs513 improved that program to support the 240x240 displays that have since come out:

I use the first one on the T4 with two 240x240 displays, with each display on a separate SPI bus (you have to solder wires to the pads underneath the Teensy to get access to the 2nd and 3rd SPI buses).

I have not built the T4 to use the older 128x128 displays. That might be interesting to try (the second link is probably more appropriate for the 128x128 displays).
 
Thanks for the compliment but @KurtE did the work on the libraries to be able to use multiple SPI busses.
 
Thanks for the compliment but @KurtE did the work on the libraries to be able to use multiple SPI busses.

Sorry about that. It was your site that I picked it up from. So I assumed you had done the work, but yeah, now that I think on it, KurtE did do most of the work. After awhile it gets hard to track which person did the work.....

It still would be nice if we could get the example files put into 1.49.
 
Two things:

1) Adafruit's ItsyBitsy Express M4 compiled and ran the original sketch just fine (fine enough for me at any rate) modulo some pin reassignments. Perhaps it incorporates some of Teensy 3.2's optimizations as well.

2) Whoever did the code, I tip my hat to. Very clear and very resilient to butchery , err, I mean, modification to adapt to what I wanted to do.
 
@mjs513 @MichaelMeissner, ... - Actually we all did a lot of stuff and helped figure things out... With lots of hair pulling...

One of these days I will get back to playing with it... Maybe for next Halloween
 
Two things:

1) Adafruit's ItsyBitsy Express M4 compiled and ran the original sketch just fine (fine enough for me at any rate) modulo some pin reassignments. Perhaps it incorporates some of Teensy 3.2's optimizations as well.
Phillip Burgess is the main author of it.

In July 2018, he started adding support for the Adafruit M0 and M4 systems at the time for the two 128x128 displays (OLED and TFT). According to the comments in the source, the Adafruit boards use DMA, while Teensy 3.x uses SPI FIFO support. The Teensy optimizations originally came from Paul Stoffregen's optimizations for the ILI9341 display, and similar optimizations were then ported to other displays, including the TFT displays using the ST7735 controller and the OLED displays using the SSD1351 controller (and other controllers since then).

2) Whoever did the code, I tip my hat to. Very clear and very resilient to butchery , err, I mean, modification to adapt to what I wanted to do.

There are 4 main strains of uncanny eyes at this time:
  • Teensy 3.2/3.5/3.6 and Adafruit M0/M4 boards (M0/M4 Express, Hallowing M0, etc.) with the original code supporting the 128x128 displays;
  • A version that runs on Raspberry Pi-2/Pi-3 boards (the Pi-zero isn't really fast enough to run it, and the Pi-4 appears to have changed things about, so it doesn't run out of the box);
  • The new code for the 240x240 display that only runs on the Adafruit M4 boards (M4 Express, Hallowing M4);
  • The version for the Teensy 4, based on the original code.

The new M4 version uses a completely different way to draw the eyes. It is more configurable (due in part to the Adafruit M4 boards having flash memory that acts as a removable disk drive so you can change parameters without rebuilding), but due to having 4x the data for the new displays, it can't do everything in memory. Instead it reads part of the image and displays that, and goes back for the next part to process. Each eye is handled separately. And it is currently tied to the DMA subsystem on the Adafruit M4 boards.

The Teensy 4 version instead of using one SPI bus, and switching back and forth between the eyes, uses two separate buses. I believe unlike the Teensy 3 version, you can't use other SPI devices in the dead time between doing the displays.
 
Status
Not open for further replies.
Back
Top