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

Thread: "error compiling for board Teensy LC" when trying to use ILI9341 example sketches

  1. #1
    Junior Member
    Join Date
    Feb 2018
    Posts
    7

    "error compiling for board Teensy LC" when trying to use ILI9341 example sketches

    Hello,

    I'm getting the Teensy "error compiling" message when trying to use any of the example sketches for the ILI9341 touchscreen. I'm not sure if there is something in the code that is specific for an arduino nano, or if something is wrong with my libraries. I am getting error messages about a "KINETISK_SPIO" that I don't understand. Any help would be greatly appreciated!

    Here is the error message:

    Arduino: 1.8.9 (Mac OS X), TD: 1.46, Board: "Teensy LC, Serial + MIDI, 48 MHz, Smallest Code, US English"

    In file included from /Users/DrEcho/Documents/Arduino/libraries/ILI9341_t3/examples/touchpaint/touchpaint.ino:19:0:
    /Users/DrEcho/Documents/Arduino/libraries/ILI9341_t3/ILI9341_t3.h: In member function 'void ILI9341_t3::waitFifoNotFull()':
    /Users/DrEcho/Documents/Arduino/libraries/ILI9341_t3/ILI9341_t3.h:178:9: error: 'KINETISK_SPI0' was not declared in this scope
    sr = KINETISK_SPI0.SR;
    ^
    /Users/DrEcho/Documents/Arduino/libraries/ILI9341_t3/ILI9341_t3.h: In member function 'void ILI9341_t3::waitFifoEmpty()':
    /Users/DrEcho/Documents/Arduino/libraries/ILI9341_t3/ILI9341_t3.h:187:9: error: 'KINETISK_SPI0' was not declared in this scope
    sr = KINETISK_SPI0.SR;
    ^
    /Users/DrEcho/Documents/Arduino/libraries/ILI9341_t3/ILI9341_t3.h: In member function 'void ILI9341_t3::waitTransmitComplete()':
    /Users/DrEcho/Documents/Arduino/libraries/ILI9341_t3/ILI9341_t3.h:193:12: error: 'KINETISK_SPI0' was not declared in this scope
    while (!(KINETISK_SPI0.SR & SPI_SR_TCF)) ; // wait until final output done
    ^
    /Users/DrEcho/Documents/Arduino/libraries/ILI9341_t3/ILI9341_t3.h:193:31: error: 'SPI_SR_TCF' was not declared in this scope
    while (!(KINETISK_SPI0.SR & SPI_SR_TCF)) ; // wait until final output done
    ^
    /Users/DrEcho/Documents/Arduino/libraries/ILI9341_t3/ILI9341_t3.h:194:9: error: 'KINETISK_SPI0' was not declared in this scope
    tmp = KINETISK_SPI0.POPR; // drain the final RX FIFO word
    ^
    /Users/DrEcho/Documents/Arduino/libraries/ILI9341_t3/ILI9341_t3.h: In member function 'void ILI9341_t3::writecommand_cont(uint8_t)':
    /Users/DrEcho/Documents/Arduino/libraries/ILI9341_t3/ILI9341_t3.h:197:3: error: 'KINETISK_SPI0' was not declared in this scope
    KINETISK_SPI0.PUSHR = c | (pcs_command << 16) | SPI_PUSHR_CTAS(0) | SPI_PUSHR_CONT;
    ^
    /Users/DrEcho/Documents/Arduino/libraries/ILI9341_t3/ILI9341_t3.h:197:67: error: 'SPI_PUSHR_CTAS' was not declared in this scope
    KINETISK_SPI0.PUSHR = c | (pcs_command << 16) | SPI_PUSHR_CTAS(0) | SPI_PUSHR_CONT;
    ^
    /Users/DrEcho/Documents/Arduino/libraries/ILI9341_t3/ILI9341_t3.h:197:71: error: 'SPI_PUSHR_CONT' was not declared in this scope
    KINETISK_SPI0.PUSHR = c | (pcs_command << 16) | SPI_PUSHR_CTAS(0) | SPI_PUSHR_CONT;
    ^
    /Users/DrEcho/Documents/Arduino/libraries/ILI9341_t3/ILI9341_t3.h: In member function 'void ILI9341_t3::writedata8_cont(uint8_t)':
    /Users/DrEcho/Documents/Arduino/libraries/ILI9341_t3/ILI9341_t3.h:201:3: error: 'KINETISK_SPI0' was not declared in this scope
    KINETISK_SPI0.PUSHR = c | (pcs_data << 16) | SPI_PUSHR_CTAS(0) | SPI_PUSHR_CONT;
    ^
    /Users/DrEcho/Documents/Arduino/libraries/ILI9341_t3/ILI9341_t3.h:201:64: error: 'SPI_PUSHR_CTAS' was not declared in this scope
    KINETISK_SPI0.PUSHR = c | (pcs_data << 16) | SPI_PUSHR_CTAS(0) | SPI_PUSHR_CONT;
    ^
    /Users/DrEcho/Documents/Arduino/libraries/ILI9341_t3/ILI9341_t3.h:201:68: error: 'SPI_PUSHR_CONT' was not declared in this scope
    KINETISK_SPI0.PUSHR = c | (pcs_data << 16) | SPI_PUSHR_CTAS(0) | SPI_PUSHR_CONT;
    ^
    /Users/DrEcho/Documents/Arduino/libraries/ILI9341_t3/ILI9341_t3.h: In member function 'void ILI9341_t3::writedata16_cont(uint16_t)':
    /Users/DrEcho/Documents/Arduino/libraries/ILI9341_t3/ILI9341_t3.h:205:3: error: 'KINETISK_SPI0' was not declared in this scope
    KINETISK_SPI0.PUSHR = d | (pcs_data << 16) | SPI_PUSHR_CTAS(1) | SPI_PUSHR_CONT;
    ^
    /Users/DrEcho/Documents/Arduino/libraries/ILI9341_t3/ILI9341_t3.h:205:64: error: 'SPI_PUSHR_CTAS' was not declared in this scope
    KINETISK_SPI0.PUSHR = d | (pcs_data << 16) | SPI_PUSHR_CTAS(1) | SPI_PUSHR_CONT;
    ^
    /Users/DrEcho/Documents/Arduino/libraries/ILI9341_t3/ILI9341_t3.h:205:68: error: 'SPI_PUSHR_CONT' was not declared in this scope
    KINETISK_SPI0.PUSHR = d | (pcs_data << 16) | SPI_PUSHR_CTAS(1) | SPI_PUSHR_CONT;
    ^
    /Users/DrEcho/Documents/Arduino/libraries/ILI9341_t3/ILI9341_t3.h: In member function 'void ILI9341_t3::writecommand_last(uint8_t)':
    /Users/DrEcho/Documents/Arduino/libraries/ILI9341_t3/ILI9341_t3.h:210:3: error: 'KINETISK_SPI0' was not declared in this scope
    KINETISK_SPI0.SR = SPI_SR_TCF;
    ^
    /Users/DrEcho/Documents/Arduino/libraries/ILI9341_t3/ILI9341_t3.h:210:22: error: 'SPI_SR_TCF' was not declared in this scope
    KINETISK_SPI0.SR = SPI_SR_TCF;
    ^
    /Users/DrEcho/Documents/Arduino/libraries/ILI9341_t3/ILI9341_t3.h:211:67: error: 'SPI_PUSHR_CTAS' was not declared in this scope
    KINETISK_SPI0.PUSHR = c | (pcs_command << 16) | SPI_PUSHR_CTAS(0);
    ^
    /Users/DrEcho/Documents/Arduino/libraries/ILI9341_t3/ILI9341_t3.h: In member function 'void ILI9341_t3::writedata8_last(uint8_t)':
    /Users/DrEcho/Documents/Arduino/libraries/ILI9341_t3/ILI9341_t3.h:216:3: error: 'KINETISK_SPI0' was not declared in this scope
    KINETISK_SPI0.SR = SPI_SR_TCF;
    ^
    /Users/DrEcho/Documents/Arduino/libraries/ILI9341_t3/ILI9341_t3.h:216:22: error: 'SPI_SR_TCF' was not declared in this scope
    KINETISK_SPI0.SR = SPI_SR_TCF;
    ^
    /Users/DrEcho/Documents/Arduino/libraries/ILI9341_t3/ILI9341_t3.h:217:64: error: 'SPI_PUSHR_CTAS' was not declared in this scope
    KINETISK_SPI0.PUSHR = c | (pcs_data << 16) | SPI_PUSHR_CTAS(0);
    ^
    /Users/DrEcho/Documents/Arduino/libraries/ILI9341_t3/ILI9341_t3.h: In member function 'void ILI9341_t3::writedata16_last(uint16_t)':
    /Users/DrEcho/Documents/Arduino/libraries/ILI9341_t3/ILI9341_t3.h:222:3: error: 'KINETISK_SPI0' was not declared in this scope
    KINETISK_SPI0.SR = SPI_SR_TCF;
    ^
    /Users/DrEcho/Documents/Arduino/libraries/ILI9341_t3/ILI9341_t3.h:222:22: error: 'SPI_SR_TCF' was not declared in this scope
    KINETISK_SPI0.SR = SPI_SR_TCF;
    ^
    /Users/DrEcho/Documents/Arduino/libraries/ILI9341_t3/ILI9341_t3.h:223:64: error: 'SPI_PUSHR_CTAS' was not declared in this scope
    KINETISK_SPI0.PUSHR = d | (pcs_data << 16) | SPI_PUSHR_CTAS(1);
    ^
    Multiple libraries were found for "Adafruit_STMPE610.h"
    Used: /Users/DrEcho/Documents/Arduino/libraries/Adafruit_STMPE610
    Not used: /Applications/Arduino.app/Contents/Java/hardware/teensy/avr/libraries/Adafruit_STMPE610
    Multiple libraries were found for "ILI9341_t3.h"
    Used: /Users/DrEcho/Documents/Arduino/libraries/ILI9341_t3
    Not used: /Applications/Arduino.app/Contents/Java/hardware/teensy/avr/libraries/ILI9341_t3
    Error compiling for board Teensy LC.

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

    And here is the code
    Code:
    /***************************************************
      This is our touchscreen painting example for the Adafruit ILI9341 Shield
      ----> http://www.adafruit.com/products/1651
    
      Check out the links above for our tutorials and wiring diagrams
      These displays use SPI to communicate, 4 or 5 pins are required to
      interface (RST is optional)
      Adafruit invests time and resources providing this open source code,
      please support Adafruit and open-source hardware by purchasing
      products from Adafruit!
    
      Written by Limor Fried/Ladyada for Adafruit Industries.
      MIT license, all text above must be included in any redistribution
     ****************************************************/
    
    
    #include <SPI.h>
    #include <Wire.h>      // this is needed even tho we aren't using it
    #include <ILI9341_t3.h>
    #include <Adafruit_STMPE610.h>
    
    // This is calibration data for the raw touch data to the screen coordinates
    #define TS_MINX 150
    #define TS_MINY 130
    #define TS_MAXX 3800
    #define TS_MAXY 4000
    
    // The STMPE610 uses hardware SPI on the shield, and #8
    #define STMPE_CS 8
    Adafruit_STMPE610 ts = Adafruit_STMPE610(STMPE_CS);
    
    // The display also uses hardware SPI, plus #9 & #10
    #define TFT_CS 10
    #define TFT_DC  9
    ILI9341_t3 tft = ILI9341_t3(TFT_CS, TFT_DC);
    
    // Size of the color selection boxes and the paintbrush size
    #define BOXSIZE 40
    #define PENRADIUS 3
    int oldcolor, currentcolor;
    
    void setup(void) {
     // while (!Serial);     // used for leonardo debugging
     
      Serial.begin(9600);
      Serial.println(F("Touch Paint!"));
      
      tft.begin();
    
      if (!ts.begin()) {
        Serial.println("Couldn't start touchscreen controller");
        while (1);
      }
      Serial.println("Touchscreen started");
      
      tft.fillScreen(ILI9341_BLACK);
      
      // make the color selection boxes
      tft.fillRect(0, 0, BOXSIZE, BOXSIZE, ILI9341_RED);
      tft.fillRect(BOXSIZE, 0, BOXSIZE, BOXSIZE, ILI9341_YELLOW);
      tft.fillRect(BOXSIZE*2, 0, BOXSIZE, BOXSIZE, ILI9341_GREEN);
      tft.fillRect(BOXSIZE*3, 0, BOXSIZE, BOXSIZE, ILI9341_CYAN);
      tft.fillRect(BOXSIZE*4, 0, BOXSIZE, BOXSIZE, ILI9341_BLUE);
      tft.fillRect(BOXSIZE*5, 0, BOXSIZE, BOXSIZE, ILI9341_MAGENTA);
     
      // select the current color 'red'
      tft.drawRect(0, 0, BOXSIZE, BOXSIZE, ILI9341_WHITE);
      currentcolor = ILI9341_RED;
    }
    
    
    void loop()
    {
      // See if there's any  touch data for us
      if (ts.bufferEmpty()) {
        return;
      }
      /*
      // You can also wait for a touch
      if (! ts.touched()) {
        return;
      }
      */
    
      // Retrieve a point  
      TS_Point p = ts.getPoint();
      
     /*
      Serial.print("X = "); Serial.print(p.x);
      Serial.print("\tY = "); Serial.print(p.y);
      Serial.print("\tPressure = "); Serial.println(p.z);  
     */
     
      // Scale from ~0->4000 to tft.width using the calibration #'s
      p.x = map(p.x, TS_MINX, TS_MAXX, 0, tft.width());
      p.y = map(p.y, TS_MINY, TS_MAXY, 0, tft.height());
    
      /*
      Serial.print("("); Serial.print(p.x);
      Serial.print(", "); Serial.print(p.y);
      Serial.println(")");
      */
    
      if (p.y < BOXSIZE) {
         oldcolor = currentcolor;
    
         if (p.x < BOXSIZE) { 
           currentcolor = ILI9341_RED; 
           tft.drawRect(0, 0, BOXSIZE, BOXSIZE, ILI9341_WHITE);
         } else if (p.x < BOXSIZE*2) {
           currentcolor = ILI9341_YELLOW;
           tft.drawRect(BOXSIZE, 0, BOXSIZE, BOXSIZE, ILI9341_WHITE);
         } else if (p.x < BOXSIZE*3) {
           currentcolor = ILI9341_GREEN;
           tft.drawRect(BOXSIZE*2, 0, BOXSIZE, BOXSIZE, ILI9341_WHITE);
         } else if (p.x < BOXSIZE*4) {
           currentcolor = ILI9341_CYAN;
           tft.drawRect(BOXSIZE*3, 0, BOXSIZE, BOXSIZE, ILI9341_WHITE);
         } else if (p.x < BOXSIZE*5) {
           currentcolor = ILI9341_BLUE;
           tft.drawRect(BOXSIZE*4, 0, BOXSIZE, BOXSIZE, ILI9341_WHITE);
         } else if (p.x < BOXSIZE*6) {
           currentcolor = ILI9341_MAGENTA;
           tft.drawRect(BOXSIZE*5, 0, BOXSIZE, BOXSIZE, ILI9341_WHITE);
         }
    
         if (oldcolor != currentcolor) {
            if (oldcolor == ILI9341_RED) 
              tft.fillRect(0, 0, BOXSIZE, BOXSIZE, ILI9341_RED);
            if (oldcolor == ILI9341_YELLOW) 
              tft.fillRect(BOXSIZE, 0, BOXSIZE, BOXSIZE, ILI9341_YELLOW);
            if (oldcolor == ILI9341_GREEN) 
              tft.fillRect(BOXSIZE*2, 0, BOXSIZE, BOXSIZE, ILI9341_GREEN);
            if (oldcolor == ILI9341_CYAN) 
              tft.fillRect(BOXSIZE*3, 0, BOXSIZE, BOXSIZE, ILI9341_CYAN);
            if (oldcolor == ILI9341_BLUE) 
              tft.fillRect(BOXSIZE*4, 0, BOXSIZE, BOXSIZE, ILI9341_BLUE);
            if (oldcolor == ILI9341_MAGENTA) 
              tft.fillRect(BOXSIZE*5, 0, BOXSIZE, BOXSIZE, ILI9341_MAGENTA);
         }
      }
      if (((p.y-PENRADIUS) > BOXSIZE) && ((p.y+PENRADIUS) < tft.height())) {
        tft.fillCircle(p.x, p.y, PENRADIUS, currentcolor);
      }
    }

  2. #2
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    10,089
    There is a newest version of TD that is v 1.48 - when the following is cleared up - having that version may allow resolution as needed.

    The console output shows this:
    Multiple libraries were found for "ILI9341_t3.h"
    Used: /Users/DrEcho/Documents/Arduino/libraries/ILI9341_t3
    Not used: /Applications/Arduino.app/Contents/Java/hardware/teensy/avr/libraries/ILI9341_t3
    That points to an unknown LOCAL copy of the Used: /Users/DrEcho/Documents/Arduino/libraries/ILI9341_t3 overriding what is installed with TD.

    Unless there is a known reason for that it should be removed.

  3. #3
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    5,719
    Often times the _t3 implies a Teensy 3.x and will not work with the LC.

    In fact the start of the ili9341_t3 library has:
    Code:
    #if defined(__MKL26Z64__)
    #error "Sorry, ILI9341_t3 does not work with Teensy LC.  Use Adafruit_ILI9341."
    #elif defined(__AVR__)
    #error "Sorry, ILI9341_t3 does not work with Teensy 2.0 or Teensy++ 2.0.  Use Adafruit_ILI9341."
    #endif
    I do have my own extended version of this library (ILI9341_t3n) , that at one point I added some support for the Teensy LC.
    It is up at: https://github.com/KurtE/ILI9341_t3n

    It currently still requires my secondary library SPIN to work: https://github.com/KurtE/SPIN

    I did recently verify I could still compile the touchpaint for XPT2046 touch screen on LC...

Posting Permissions

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