Teensy 3.2 with Audio Board and ILI9341 2.8 inch Touch Screen

Status
Not open for further replies.

duncabar

Active member
Hi, using a new Teensy 3.2 and with a new Audio Board and the 2.8 Inch TFT Touchscreen sold here on PJRC Store. I'm having problems getting the SD card to work at the same time as the display... they both work separately (so screen is good and SD card good by my reckoning). I am wired up as documented here (using Teensy 3.x Audio Board column): http://www.pjrc.com/store/display_ili9341_touch.html

I've re-wired several times and don't see any hookup errors. I've tried various source code examples including the sample code in the Audio Tutorial: https://github.com/PaulStoffregen/Audio/tree/master/examples/Tutorial/Part_3_03_TFT_Display

Using the following defines (which corresponds to wiring) :

#include <ILI9341_t3.h>
#include <font_Arial.h> // from ILI9341_t3
#include <Audio.h>
#include <Wire.h>
#include <SPI.h>
#include <SD.h>
#include <SerialFlash.h>

// For optimized ILI9341_t3 library
#define TFT_DC 20
#define TFT_CS 21
#define TFT_RST 255 // 255 = unused, connect to 3.3V
#define TFT_MOSI 7
#define TFT_SCLK 14
#define TFT_MISO 12
ILI9341_t3 tft = ILI9341_t3(TFT_CS, TFT_DC, TFT_RST, TFT_MOSI, TFT_SCLK, TFT_MISO);

I can post more code but it's really just the samples on github. There seems to be an issue with the SD card reading when I have T_DO (from Touch screen) connected to Pin 12 on Teensy... if i disconnect it, the SD card works. I'm thinking there is a conflict somewhere.

Does anyone have the TFT Touchscreen working with the audio card? I've tried two different teensy 3.2 and both the 2.8 and 2.4 TFT with exact same results.

I'm not positive if the issue is on hardware end or software. Any help would be greatly appreciated!
 
Last edited:
I got the SD card working with the touch display - don't find the crude sketch sample I did last year - but it worked with touch usage. Must be related to the sound card. If no direct pin conflicts then when Paul redid his Purple Test board ( on the store page ) he added two 10K ohm pull-ups that may be needed - looks like they are on the CS and D/C pins

<edit>: there are suggested board edits to connect the SD card also on hardware page - did you make those edits? I did those to the one I used.
 
Last edited:
There seems to be an issue with the SD card reading when I have T_DO (from Touch screen) connected to Pin 12 on Teensy... if i disconnect it, the SD card works. I'm thinking there is a conflict somewhere.
This rings a bell. I guess the touch screen does not release the T_DO and puts the line high, but keeps the line low. AFAIK, T_DO (MISO) low indicates device busy.

Maybe a 10 k pullup on MISO helps. one reason of having a pullup in PJRC SD board http://www.pjrc.com/teensy/sd_adaptor.html is to ensure that MISO is high when inactive.
 
Using the display and touch and SD per my post #2 was functional - T_IRQ, and three CS's unique with common data/clk lines on all three devices was no problem, and I did a lot of touching with no apparent issues. On the board I hand wired that used the SD-SPI I didn't even have the pull-ups used on the Purple Test board. SD wasn't tested extensively - but display and touch no problem together. Can the display with touch be tested without the Audio board attached?

This thread shows some of the work I did with the PJRC ILI9341 display with Touch.
 
Thanks guys. I will take a look a look at both links. I should have been clear about which SD card I'm attempting to use. I am trying to use the SD card that's on the audio board. I had tried to get the SD card on the tft display to work (even after documented warning that it wasn't supported on the display in the PJRC store) following links others had posted... They didn't work for me - i may have done something wrong. So I just went to a new unmodified display and started with that SD. When i first hooked up the display to the teensy only, the touch worked very well. When I add the audio board, neither the display (white screen only) or the SD card works... testing each connection one by one, i found that removing the T_DO connection made the SD on the audio board work, but still not the screen itself. I guess i'd have thought that if it were related to the touch connections, the screen would work when i removed the four touch connections... but no dice. I did note a small discrepancy in connection on the Touch Display with audio, and the Tutorial (vin vs 3.3, etc) but i tried those.. and the Tutorial doesn't use a touch screen. Also note, i did not connect the T_IRQ line.
I will go back and take a look at the 10K pullup suggested by WMXZ and the link from defragster.
 
Ok... after more testing, I'm still stuck. The T_DO pull-up didn't seem to work - i'm not sure i'm even getting that far as the display is just white. I decided to completely wire up the Tutorial as referenced above to rule out wiring issues. I used the code from Tutorial Part 3-3: Add a TFT Display and i get the same results as before. Note, that i did not wire any of the Touchscreen connections... just the display. SD card works, music plays.. every tutorial code works as published...except the last one when i add the TFT touch display. At this point, i'm guessing there's more difference in the 2.8 TFT Display and 2.8 TFT Touch Display than just the touch. I really need touch screen.

Does anyone have any other ideas here? Thank you very much in advance!
pic1.jpgpic2.jpg
 

Attachments

  • Part_3_03_TFT_Display.ino
    3 KB · Views: 163
Last edited:
The smaller (2.2") PJRC screen wires up the same as the larger touch screen from my experience - just adds independent touch controller sharing the same SPI lines. You may have a different unit at 2.8"?

Did you ever see the display work? Can you get it to work stand alone at all now? I ask because I got a 2.8" Touch display that went ALL white on me (touch still worked) after some short usage, then PJRC sent a replacement and I dared to poke it with a soldering iron - when I did the mod to use the SD card as linked on the store page - it seems closing the jumper bypassed some bad part - keeping power from the display controller and I got a display back.

I don't see the Purple Test board doing a pull up on T_DO - that is a common data line, it is the control lines that need to be high when not pulled low from what I can see.
 
Teensy 3.2 just not working with SD and Touchscreen

Thank you for responding! I have definitely ruled out an issue with the display (I have three: a 2.4", and two 2.8" TFT Touchscreen purchased here on PJRC) and they all have the same behavior. I do not have a non-touch display to test - besides, that won't work for my product. I have also ruled out the Teensy 3.2, as i have 3 of those as well. Everything works fine in strip-down test projects alone.. but, so far, I haven't gotten anything to work when both Touchscreen and SD card together. So now, I've tried to simplify the situation and take the audio board out of the mix and am using the Wiz820+SD adapter (without the WIZ820io module) and I am having the SAME PROBLEM. Can't get SD and TFT Touchscreen to work together... separately they are fine. What can be so terribly wrong? I am thinking (based on documentation here on the site) that there is some sort of SPI issue.... I am pretty sure I've eliminated pin conflicts (at least based on documentation)...

Attached is a couple of test program to simply print some menu on the TFT and check the SD card... If any one can help me get TFT Touchscreen to work with SD card (on either the WIZ820 or the Audio card) I would be truly grateful!

Another option... if anyone knows of any combination of 2.8 or 3.2 TFT Touchscreens that DO work with SD card (and preferably the teensy audio board) that would be great to hear too.
Barry
 

Attachments

  • listfiles.ino
    3 KB · Views: 140
  • tftMenuSD4.ino
    21.5 KB · Views: 148
Last edited:
I have verified that the issue is between Touch and SD Card when using either Wiz820 SD or the Audio Card SD... Removing T_DO makes SD work and TFT work... Just no touch function. Also, commenting out SD init allows touch to work. Help! :)
 
Here is an EVIL sketch that should never see the light of day - but it works - just tried it now:View attachment IntTouchPaintDeb_SD.ino Compile for Serial USB and watch the Serial Monitor for flash directory data. If you see text inversion or color swaps - I do - but it may be this board is tired of being touched - or from the code in progress.

It is working again on this fabulous beauty: ILI9341-restive-touch. I just read post #138 on that thread below the linked thread and hardware worked for twinscroll too it seems.

You either have a defective unit or bad connections. other posts on that thread may be worth reading.

It uses the interrupt code for TOUCH as it was a WORK IN PROGRESS - as coded it works on my linked device: PJRC 2.8" TFT with Touch Active and the SD made usable per the store page linked edit - I never saw if you acknowledged you made those edits?

Anyhow I bolted it back together and popped in a flash card and VOILA - it prints the directory of my SD card. It prints to USB in SETUP and after a wait (2 secs) when the GREEN paint color is selected which is how it boots up. Draw by touching another color button then draw in the black space - the lower portion is onscreen debug.

I could probably update that sketch to use the INT aware code I got into the touch library - but have too many other things I'm not doing

I have not rewritten the sketch - but using it again for high speed SPI testing - it works - except I noticed these vars need to be zeroed on entering the indicated function:
void printDirectory(File dir, int numTabs) {
File entry;
NumFiles = 0;
FilesSize = 0;
ListTime = 0;
DumpTime = 0;
StartTime = 0;
ThisTime = 0;
 
Last edited:
I don't think i have a defective unit. I now have 2 separate systems wired (the same way) and both exhibit the same behavior of not allowing touch and SD to be active together. But, you asked whether I made the board edits that you'd linked to before... I assumed you meant the documented changes for the audio board?
audioboard.PNG
I did make those. I am now wondering if your reference to "store page linked edit" meant the recommended changes to the stand alone SD board (which i don't have) mentioned here: https://forum.pjrc.com/threads/16758-Teensy-3-MicroSD-guide and linked to by Paul. Is that the changes you meant? If so, would it be relevant for the Wiz820 or the Audio board SD? Willing to try anything.

In the meantime, i will try the two sketches you attached and get back with you. Thank you again for helping me!
 
defragster! Thank you! Your EVIL sketch work with zero changes to my wiring (well, i did add the TS_IRQ line to Pin 2). I was flabbergasted. I am still not 100% sure why yours does but mine doesn't.. but now i have a working example and i will figure that out. I'm guessing it's related to SPI timing and your usage of IRQ. Anyway - I can take it from here - thank you so much!
 
Great that sketch worked. The INT code native in that does stop spurious SPI traffic for Touch testing, that code is now improved and standard in the Touch driver code. It may be that I #include or setup() the various libraries/devices in a different way?

This is what I was referring to: this hardware modification may be able to get it working.

<edit>: Just scanned your sketch - the only thing that jumped out was that your code is using my "TS_MAP tsMap" struct and the TS_GetMap() function with rotation independent point mapping! Now I just wish I had finished doing button work that made sense as a library of some sort to hide the ugliness it takes to manually scan buttons!
 
Last edited:
I would like to respectfully jump in here as well. I posted this request for help back in April and never got a response, I have been out of town a lot an unable to work this but I had put a lot of time trying as duncabar has also indicated.

I was not trying to access the SD card on the Display but on the Audio board. Duncabar is this what you are trying also?

The code I was testing with is in the linked post.

Defragster I will test your sketch and report back in this thread.

Thanks for getting this topic going.
 
I have verified that the issue is between Touch and SD Card when using either Wiz820 SD or the Audio Card SD... Removing T_DO makes SD work and TFT work... Just no touch function. Also, commenting out SD init allows touch to work. Help! :)

Are any of these sketches still around?

Maybe there's a subtle software issue here, like one of the libs not fully using SPI transactions for compatibility with the others?

I can't look into this right now, but if you post a single message with the code and a photo or details on the wiring, I'll put it onto my list of possible software issues to investigate.
 
Audio Shield and Acclerated Graphics lib conflicts

I have been having difficulty using the Accelerated Graphics lib and Either touch or just color display and the audio shield. Here is an example where you can uncomment one line:

//#define T3_ACCEL 1

to see the problem. Freshly installed Arduino 1.6.9 and TD 1.29 Beta works the same for me ( that is ... not at all ...)
I would love to help further if there is something I can dig into but I've been stuck at this point for months on my own.

@defragster, I can get your example to work the touch screen, however I cannot access the SD card with it. I thought it worked for a while but then I kept getting failed SD init and with many permutations and tries could never get the SD socket on the audio card to work. I tried with two different T3 & Audio cards.

Code:
/***************************************************
  This is our GFX example for the Adafruit ILI9341 Breakout and 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
  
  5/10/2015 Modified to run on Teensy 3.1 with audio card
 ****************************************************/
//#define T3_ACCEL 1

#include <Audio.h>
#include <Wire.h>
#include <XPT2046_Touchscreen.h>
#include <SPI.h>
#include <SD.h>
#define CS_PIN  8


XPT2046_Touchscreen ts(CS_PIN);

#ifdef T3_ACCEL 
#include "ILI9341_t3.h"
#endif
#ifndef T3_ACCEL
#include "Adafruit_GFX.h"
#include "Adafruit_ILI9341.h"
#endif
// For the Teensy with audio shield, these are the default.
#define TFT_DC 20
#define TFT_CS 21

// Use hardware SPI (on Uno, #13, #12, #11) and the above for CS/DC
#ifndef T3_ACCEL 
Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC);
#endif
#ifdef T3_ACCEL 
ILI9341_t3 tft = ILI9341_t3(TFT_CS, TFT_DC,255,7,14,8);
#endif
// If using the breakout, change pins as desired
//Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC, TFT_MOSI, TFT_CLK, TFT_RST, TFT_MISO);

// GUItool: begin automatically generated code
AudioPlaySdWav           playWav1;       //xy=154,78
AudioOutputI2S           i2s1;           //xy=334,89
AudioConnection          patchCord1(playWav1, 0, i2s1, 0);
AudioConnection          patchCord2(playWav1, 1, i2s1, 1);
AudioControlSGTL5000     sgtl5000_1;     //xy=240,153
// GUItool: end automatically generated code

void setup() {

  // Audio connections require memory to work.  For more
  // detailed information, see the MemoryAndCpuUsage example
  AudioMemory(5);

  sgtl5000_1.enable();
  sgtl5000_1.volume(0.5);

  
  SPI.setMOSI(7);
  SPI.setSCK(14);

  Serial.begin(115200);
  delay(2000);
  Serial.println("ILI9341 Test!");
  
    if (!ts.begin()) {
    Serial.println("Could Not Initialize Touch");
    delay(3000);
  } else {
    Serial.println("Initialized Touch");
    delay(3000);
    
  } 
 
  tft.begin();

    if (!(SD.begin(10))) {
    // stop here, but print a message repetitively
    //while (1) {
      Serial.println("Unable to access the SD card");
      delay(500);
    //}
  }
  
  //testGraphics();

  Serial.println(F("Done!"));
}

void loop(void) {
  tft.setRotation(3);
  tft.fillScreen(ILI9341_BLACK);
  tft.setCursor(0, 0);
  tft.setTextColor(ILI9341_GREEN);    tft.setTextSize(4);
  tft.println("SDTEST1.WAV");
  playFile("SDTEST1.WAV");
  tft.println("SDTEST2.WAV");
  playFile("SDTEST2.WAV");
  tft.println("SDTEST3.WAV");
  playFile("SDTEST3.WAV");
  tft.println("SDTEST4.WAV");
  playFile("SDTEST4.WAV");
#ifdef T3_ACCEL 
    if (ts.touched()) {
    TS_Point p = ts.getPoint();
    Serial.print("Pressure = ");
    Serial.print(p.z);
    Serial.print(", x = ");
    Serial.print(p.x);
    Serial.print(", y = ");
    Serial.println(p.y);
    }

#endif
  delay(250);

#ifndef T3_ACCEL
  delay(1000);
#endif

}

void playFile(const char *filename)
{
  Serial.print("Playing file: ");
  Serial.println(filename);

  // Start playing the file.  This sketch continues to
  // run while the file plays.
  playWav1.play(filename);

  // A brief delay for the library read WAV info
  delay(5);

  // Simply wait for the file to finish playing.
  while (playWav1.isPlaying()) {
    // uncomment these lines if you audio shield
    // has the optional volume pot soldered
    float vol = analogRead(15);
    vol = vol / 1024;
    sgtl5000_1.volume(vol);
    if (ts.touched()) {
    TS_Point p = ts.getPoint();
    Serial.print("Pressure = ");
    Serial.print(p.z);
    Serial.print(", x = ");
    Serial.print(p.x);
    Serial.print(", y = ");
    Serial.println(p.y);
    }

  }
}

unsigned long testFillScreen() {
    tft.setRotation(1);
  unsigned long start = micros();
  tft.fillScreen(ILI9341_BLACK);
  delay(200);
  tft.fillScreen(ILI9341_RED);
  delay(200);
  tft.fillScreen(ILI9341_GREEN);
  delay(200);
  tft.fillScreen(ILI9341_BLUE);
  delay(200);  
  tft.fillScreen(ILI9341_BLACK);
  delay(20);  
  return micros() - start;
}

unsigned long testText() {
  tft.fillScreen(ILI9341_BLACK);
  unsigned long start = micros();
  tft.setCursor(0, 0);
  tft.setTextColor(ILI9341_WHITE);  tft.setTextSize(1);
  tft.println("Hello World!");
  tft.setTextColor(ILI9341_YELLOW); tft.setTextSize(2);
  tft.println(1234.56);
  tft.setTextColor(ILI9341_RED);    tft.setTextSize(3);
  tft.println(0xDEADBEEF, HEX);
  tft.println();
  tft.setTextColor(ILI9341_GREEN);
  tft.setTextSize(5);
  tft.println("Groop");
  tft.setTextSize(2);
  tft.println("I implore thee,");
  tft.setTextSize(1);
  tft.println("my foonting turlingdromes.");
  tft.println("And hooptiously drangle me");
  tft.println("with crinkly bindlewurdles,");
  tft.println("Or I will rend thee");
  tft.println("in the gobberwarts");
  tft.println("with my blurglecruncheon,");
  tft.println("see if I don't!");
  return micros() - start;
}

unsigned long testLines(uint16_t color) {
  unsigned long start, t;
  int           x1, y1, x2, y2,
                w = tft.width(),
                h = tft.height();

  tft.fillScreen(ILI9341_BLACK);

  x1 = y1 = 0;
  y2    = h - 1;
  start = micros();
  for(x2=0; x2<w; x2+=6) tft.drawLine(x1, y1, x2, y2, color);
  x2    = w - 1;
  for(y2=0; y2<h; y2+=6) tft.drawLine(x1, y1, x2, y2, color);
  t     = micros() - start; // fillScreen doesn't count against timing

  tft.fillScreen(ILI9341_BLACK);

  x1    = w - 1;
  y1    = 0;
  y2    = h - 1;
  start = micros();
  for(x2=0; x2<w; x2+=6) tft.drawLine(x1, y1, x2, y2, color);
  x2    = 0;
  for(y2=0; y2<h; y2+=6) tft.drawLine(x1, y1, x2, y2, color);
  t    += micros() - start;

  tft.fillScreen(ILI9341_BLACK);

  x1    = 0;
  y1    = h - 1;
  y2    = 0;
  start = micros();
  for(x2=0; x2<w; x2+=6) tft.drawLine(x1, y1, x2, y2, color);
  x2    = w - 1;
  for(y2=0; y2<h; y2+=6) tft.drawLine(x1, y1, x2, y2, color);
  t    += micros() - start;

  tft.fillScreen(ILI9341_BLACK);

  x1    = w - 1;
  y1    = h - 1;
  y2    = 0;
  start = micros();
  for(x2=0; x2<w; x2+=6) tft.drawLine(x1, y1, x2, y2, color);
  x2    = 0;
  for(y2=0; y2<h; y2+=6) tft.drawLine(x1, y1, x2, y2, color);

  return micros() - start;
}

unsigned long testFastLines(uint16_t color1, uint16_t color2) {
  unsigned long start;
  int           x, y, w = tft.width(), h = tft.height();

  tft.fillScreen(ILI9341_BLACK);
  start = micros();
  for(y=0; y<h; y+=5) tft.drawFastHLine(0, y, w, color1);
  for(x=0; x<w; x+=5) tft.drawFastVLine(x, 0, h, color2);

  return micros() - start;
}

unsigned long testRects(uint16_t color) {
  unsigned long start;
  int           n, i, i2,
                cx = tft.width()  / 2,
                cy = tft.height() / 2;

  tft.fillScreen(ILI9341_BLACK);
  n     = min(tft.width(), tft.height());
  start = micros();
  for(i=2; i<n; i+=6) {
    i2 = i / 2;
    tft.drawRect(cx-i2, cy-i2, i, i, color);
  }

  return micros() - start;
}

unsigned long testFilledRects(uint16_t color1, uint16_t color2) {
  unsigned long start, t = 0;
  int           n, i, i2,
                cx = tft.width()  / 2 - 1,
                cy = tft.height() / 2 - 1;

  tft.fillScreen(ILI9341_BLACK);
  n = min(tft.width(), tft.height());
  for(i=n; i>0; i-=6) {
    i2    = i / 2;
    start = micros();
    tft.fillRect(cx-i2, cy-i2, i, i, color1);
    t    += micros() - start;
    // Outlines are not included in timing results
    tft.drawRect(cx-i2, cy-i2, i, i, color2);
  }

  return t;
}

unsigned long testFilledCircles(uint8_t radius, uint16_t color) {
  unsigned long start;
  int x, y, w = tft.width(), h = tft.height(), r2 = radius * 2;

  tft.fillScreen(ILI9341_BLACK);
  start = micros();
  for(x=radius; x<w; x+=r2) {
    for(y=radius; y<h; y+=r2) {
      tft.fillCircle(x, y, radius, color);
    }
  }

  return micros() - start;
}

unsigned long testCircles(uint8_t radius, uint16_t color) {
  unsigned long start;
  int           x, y, r2 = radius * 2,
                w = tft.width()  + radius,
                h = tft.height() + radius;

  // Screen is not cleared for this one -- this is
  // intentional and does not affect the reported time.
  start = micros();
  for(x=0; x<w; x+=r2) {
    for(y=0; y<h; y+=r2) {
      tft.drawCircle(x, y, radius, color);
    }
  }

  return micros() - start;
}

unsigned long testTriangles() {
  unsigned long start;
  int           n, i, cx = tft.width()  / 2 - 1,
                      cy = tft.height() / 2 - 1;

  tft.fillScreen(ILI9341_BLACK);
  n     = min(cx, cy);
  start = micros();
  for(i=0; i<n; i+=5) {
    tft.drawTriangle(
      cx    , cy - i, // peak
      cx - i, cy + i, // bottom left
      cx + i, cy + i, // bottom right
      ILI9341_RED); //tft.color565(0, 0, i)); // change color to debug this code
      // its not the color
  }

  return micros() - start;
}

unsigned long testFilledTriangles() {
  unsigned long start, t = 0;
  int           i, cx = tft.width()  / 2 - 1,
                   cy = tft.height() / 2 - 1;

  tft.fillScreen(ILI9341_BLACK);
  start = micros();
  for(i=min(cx,cy); i>10; i-=5) {
    start = micros();
    tft.fillTriangle(cx, cy - i, cx - i, cy + i, cx + i, cy + i,
      tft.color565(0, i, i));
    t += micros() - start;
    tft.drawTriangle(cx, cy - i, cx - i, cy + i, cx + i, cy + i,
      tft.color565(i, i, 0));
  }

  return t;
}

unsigned long testRoundRects() {
  unsigned long start;
  int           w, i, i2,
                cx = tft.width()  / 2 - 1,
                cy = tft.height() / 2 - 1;

  tft.fillScreen(ILI9341_BLACK);
  w     = min(tft.width(), tft.height());
  start = micros();
  for(i=0; i<w; i+=6) {
    i2 = i / 2;
    tft.drawRoundRect(cx-i2, cy-i2, i, i, i/8, tft.color565(i, 0, 0));
  }

  return micros() - start;
}

unsigned long testFilledRoundRects() {
  unsigned long start;
  int           i, i2,
                cx = tft.width()  / 2 - 1,
                cy = tft.height() / 2 - 1;

  tft.fillScreen(ILI9341_BLACK);
  start = micros();
  for(i=min(tft.width(), tft.height()); i>20; i-=6) {
    i2 = i / 2;
    tft.fillRoundRect(cx-i2, cy-i2, i, i, i/8, tft.color565(0, i, 0));
  }

  return micros() - start;
}

void testGraphics() {

  // read diagnostics (optional but can help debug problems)
  uint8_t x = tft.readcommand8(ILI9341_RDMODE);
  Serial.print("Display Power Mode: 0x"); Serial.println(x, HEX);
  x = tft.readcommand8(ILI9341_RDMADCTL);
  Serial.print("MADCTL Mode: 0x"); Serial.println(x, HEX);
  x = tft.readcommand8(ILI9341_RDPIXFMT);
  Serial.print("Pixel Format: 0x"); Serial.println(x, HEX);
  x = tft.readcommand8(ILI9341_RDIMGFMT);
  Serial.print("Image Format: 0x"); Serial.println(x, HEX);
  x = tft.readcommand8(ILI9341_RDSELFDIAG);
  Serial.print("Self Diagnostic: 0x"); Serial.println(x, HEX); 
  
  Serial.println(F("Benchmark                Time (microseconds)"));

  Serial.print(F("Screen fill              "));
  Serial.println(testFillScreen());
  delay(500);

  Serial.print(F("Text                     "));
  Serial.println(testText());
  delay(3000);

  Serial.print(F("Lines                    "));
  Serial.println(testLines(ILI9341_CYAN));
  delay(500);

  Serial.print(F("Horiz/Vert Lines         "));
  Serial.println(testFastLines(ILI9341_RED, ILI9341_BLUE));
  delay(500);

  Serial.print(F("Rectangles (outline)     "));
  Serial.println(testRects(ILI9341_GREEN));
  delay(500);

  Serial.print(F("Rectangles (filled)      "));
  Serial.println(testFilledRects(ILI9341_YELLOW, ILI9341_MAGENTA));
  delay(500);

  Serial.print(F("Circles (filled)         "));
  Serial.println(testFilledCircles(10, ILI9341_MAGENTA));

  Serial.print(F("Circles (outline)        "));
  Serial.println(testCircles(10, ILI9341_WHITE));
  delay(500);

  Serial.print(F("Triangles (outline)      "));
  //Serial.println(testTriangles());
  delay(500);

  Serial.print(F("Triangles (filled)       "));
  //Serial.println(testFilledTriangles());
  delay(500);

  Serial.print(F("Rounded rects (outline)  "));
  Serial.println(testRoundRects());
  delay(500);

  Serial.print(F("Rounded rects (filled)   "));
  //Serial.println(testFilledRoundRects());
  delay(500);
}
 
Last edited:
My original problem was with the SD card on the Audio board when using Touch Screen. To simplify things (in my mind), I switched to the Wiz820 and with the help from @defragster above, was able to get the SD card on Wiz820 (minus the network io module) to work. Based on his last response, I simply changed the ORDER of lines of code in setup() to match his. The only other change i made to get my original sketch to work was using his example to set miso, mosi and sck down in the SD card init (instead of defaulting). Now, my NEXT test is to try and use the same trick in @defragster's code to get this to work on the Audio SD - i will try that tonight when i get home. If i have success, i will definitely post the entire code back here. I assume we will need to remap some of the pins as documented on audio card. Below are the only two sections of my code that made this work with 820wiz SD:

in Setup():

Code:
  Serial.begin(9600);
  while ( !Serial && (millis() < 3000)) ;
  tft.begin();
  ts.begin();
  Serial.println(F("Please work damn it"));
  setup2();

In Setup2():

Code:
  SPI.setMISO(SDCARD_MISO_PIN);  //12
  SPI.setMOSI(SDCARD_MOSI_PIN);  //11
  SPI.setSCK(SDCARD_SCK_PIN);     //13
 
Last edited:
o.k Thanks, I missed the explicit setting the SD MSOI/MISO and CLK I can now get the Defragster example to work. Will continue to look at my other code to see what's different.

I also find I need to instantiate TFT with all the pins declared like this.

ILI9341_t3 tft = ILI9341_t3(TFT_CS, TFT_DC,255,7,14,8);
 
Well...the code that gets tft, touch screen, and SD working with Wiz820 does not work with Audio board. Made documented pin reassignment but no go... Really need the audio board to work!
 
Glad I dug that code up and shared it - not sure how I got that much right when so much else is so ugly.

fretless_kb - Not sure if I missed your post - or decided the audio board made it a better question for another . . . I have one here but not hooked it up yet as every time it looks like a good distraction (Hey look it has a 16GB SD card in it) - a better one comes along. I hope if you properly map and connect the usable SPI pins in setup it'll work.

I should redo that EVIL sketch perhaps using the REAL IRQ Touch method (not my mid development hack) and get that back up on my touch github.
 
Really need the audio board to work!

Well if you're not needing the extra speed from the high performance graphics lib you can certainly make the touch and sound work. in My example I default to using the Ada fruit graphics lib with the audio card and it works reliably, but you lose the fonts and accelerations.

I'll look into this some more tomorrow I'm sure it's something simple, but I'm just not familiar enough with coding and this hardware to pick it out.

I do know I tried the stock examples and can run all the examples without an audio card just fine, it's adapting to the card that was killing me and in most cases just not working at all (Audio and T3 Graphics lib). which is why I was asking if anyone else on the forums had ever gotten this combination to work.

Thanks Defragster, I got your code to work just fine as it seems to be intended (read and list files on SD card) by updating the data to work with the audio card assignments. I haven't actually played an audio file in that file set yet. it gives me something to work toward which is what I need at the moment.
 
You know what... I never actually tried with the original Adafruit_ILI9341 library! (I am new around Teensy but loving it) I am so gad you mentioned this. So, I replaced ILI9341_t3 with the adafruit include and changed change the constructor and now everything is working. TFT, Touch Screen, SD (on the Audio board), and full audio! For this particular application, i probably don't need the graphics speed.. the extra fonts from T3 would be nice - but like you said - this gives something specific to work toward.
Thanks everyone!
 
Updates...

I've modified the Original Example by Defragster to demonstrate Accelerated Graphics lib with Wav file playback. Hopefully later I can spend more time uncovering what's the differences in the approaches. But for now here's the updated demo which plays sounds and updates the screen.

View attachment IntTouchPaintDeb_SD_withWavPlayback.ino

Thanks so much everyone!

Cheers Kb
 
Tutorial 3_02 with Added FFT

If you have this PJRC Audio Tutorial hardware this ZIP sketch works with ILI9341 plugged on the breadboard - plays the songs from SD on start.

View attachment Part_3_02_Fourier_Transform_TFT.zip

Line #8 is #ifdef for ILI9341, to run the 128x128 display on thread comment it out.

Button controls do a bit more but are similar - changed the FLASH sound from Guitar ( it was too big ) on middle, button, and the right tone button cycles SIN, SQUARE, SAWTOOTH on each tone.

<edit> this doesn't use the TOUCH as the breadboard layout doesn't leave room for the 5 touch pins. You can use that display with a long pin header to lift it up.

<edit> slightly updated version on this thread set for ILI9163C display: ILI9163C-128x128-TFT-driver
 
Last edited:
Status
Not open for further replies.
Back
Top