2.8 TFT Capacitive Touch Shield issues with Arduino Zero

EL Wire/Tape/Panels, LEDs, pixels and strips, LCDs and TFTs, etc products from Adafruit

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
higgybaby
 
Posts: 13
Joined: Thu Sep 18, 2014 12:39 am

2.8 TFT Capacitive Touch Shield issues with Arduino Zero

Post by higgybaby »

I'm trying to get the 2.8" Capacitive Touch Shield (prod. Id 1947, purchased 9/22/2014) working with an official Arduino Zero

Both TFT and SD work fine with an Arduino UNO using the attached sketch. I've soldered the pads so that ICSP is connected (and have not cut the traces to the I/O pins). However when using the same sketch with the Arduino Zero, only the TFT works (so at least SPI on ICSP must be working). The "SD.begin" function will always fail with the Zero... while it worked fine on the UNO. I do not have any other devices connected to the Arduino. I can't figure out why this would happen. Here is my sketch... Thanks!:

Code: Select all

// Debug effort using Adafruit Capacitive touch screen with SD card reader (prod. 1947) on 
// an Arduino Zero. Same code works fine on Uno

#include <SD.h>

#include "SPI.h"
#include "Adafruit_GFX.h"
#include "Adafruit_ILI9341.h"

#define TFT_DC 9
#define TFT_CS 10
#define SD_CS 4

Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC);

void setup() {
  
  // initialize serial communication
  while ( ! Serial ) { delay( 1); } // this is required for M0's because of slower on-board/"native" USB 
  Serial.begin(9600); 
  Serial.println("ILI9341 Test!");

  Serial.print("Initializing SD card...");
  
//*  !!!!??? THIS ONLY WORKS ON UNO... FAILS ON ZERO. ???!!!!!!!
  // see if the card is present and can be initialized:
  if (!SD.begin(SD_CS)) {
    Serial.println("Card failed, or not present");
    
    while (1);   // don't do anything more:
  }
  Serial.println("card initialized.");
  
  SDdemo2();
//*/  !!!!!!!!!!!!!!!!!!!!!!!!!!
  
  
  TFTdemo();  
}


void loop(void) {
  
}

void SDdemo2(){
  String dataString = "hello";
  File dataFile = SD.open("datalog.txt",FILE_WRITE);
  
  // if the file is available, write to it:
  if (dataFile) {
    dataFile.println(dataString);
    dataFile.close();
    
    // print to the serial port too:
    Serial.print("Value written to card is: ");
    Serial.println(dataString);
  }
  // if the file isn't open, pop up an error:
  else {
    Serial.println("error opening datalog.txt");
  }
}

void TFTdemo(){
  
  tft.begin();

  Serial.println(F("Benchmark                Time (microseconds)"));
  delay(10);
  Serial.print(F("Screen fill              "));
  Serial.println(testFillScreen());
  delay(500);

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

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

unsigned long testFillScreen() {
  unsigned long start = micros();
  tft.fillScreen(ILI9341_BLACK);
  yield();
  tft.fillScreen(ILI9341_RED);
  yield();
  tft.fillScreen(ILI9341_GREEN);
  yield();
  tft.fillScreen(ILI9341_BLUE);
  yield();
  tft.fillScreen(ILI9341_BLACK);
  yield();
  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;
}


User avatar
mikeysklar
 
Posts: 13824
Joined: Mon Aug 01, 2016 8:10 pm

Re: 2.8 TFT Capacitive Touch Shield issues with Arduino Zero

Post by mikeysklar »

Let's try initializing the SPI for the SD card at HALF_SPEED. I think this has become necessary with the faster higher clock processors.

Code: Select all

sd.begin(CS_PIN, SPI_HALF_SPEED);

User avatar
higgybaby
 
Posts: 13
Joined: Thu Sep 18, 2014 12:39 am

Re: 2.8 TFT Capacitive Touch Shield issues with Arduino Zero

Post by higgybaby »

No joy... same problem. I also tried SPI_QUARTER_SPEED as a shot in the dark.

User avatar
mikeysklar
 
Posts: 13824
Joined: Mon Aug 01, 2016 8:10 pm

Re: 2.8 TFT Capacitive Touch Shield issues with Arduino Zero

Post by mikeysklar »

What is the size of your SD card?

User avatar
higgybaby
 
Posts: 13
Joined: Thu Sep 18, 2014 12:39 am

Re: 2.8 TFT Capacitive Touch Shield issues with Arduino Zero

Post by higgybaby »

8G and it works fine with the same sketch on both a Metro and Uno with the shield. I've tried other cards as well from 16-128G but wasn't really leaning in that direction as I've tried so many and considering all work fine with a Metro with the same setup.

User avatar
mikeysklar
 
Posts: 13824
Joined: Mon Aug 01, 2016 8:10 pm

Re: 2.8 TFT Capacitive Touch Shield issues with Arduino Zero

Post by mikeysklar »

Since we do not have a guide specifically for using the 2.8" CapTouch shield with our 3v M0/M4 processors you might want to take a look at how the breakout is wired to one of our Feathers.
B1DBCE8D-8BB2-45E3-831A-A7E248719D72.png
B1DBCE8D-8BB2-45E3-831A-A7E248719D72.png (204.25 KiB) Viewed 177 times
https://learn.adafruit.com/adafruit-2-8 ... quickstart

You could pull the shield and use jumper wires to manually connect each line to get a better idea where the trouble is.

User avatar
higgybaby
 
Posts: 13
Joined: Thu Sep 18, 2014 12:39 am

Re: 2.8 TFT Capacitive Touch Shield issues with Arduino Zero

Post by higgybaby »

Thanks for the link to the guide but it doesn't mention the SD reader... only the TFT which appears to work fine in my situation.

I'm confused at why one SPI device (the TFT) works fine on Uno and Zero while another SPI device (the SD reader) only works on Uno. Is there a chance there is a difference in the way that the SD library vs. the Adafruit_ILI9341 library interact with the SPI library when going between the Uno and Zero? It appears that the Uno expects SPI to be on pins 11, 12, and 13 (which is hardwired to Uno's ICSP) while Zero expects SPI to be on the ICSP header only? (although I'm not sure that's a correct interpretation). I'm wondering if the tft library somehow takes this into account while the SD library does not? It's strange how one device would be fine, but not the other. This is all new stuff to this noob so I'm flying blind with the guesses. I've tried taking a look at the libraries and how sercoms are assigned and used/referenced but it's a pretty big undertaking. Any guidance would be appreciated. Thanks.

User avatar
higgybaby
 
Posts: 13
Joined: Thu Sep 18, 2014 12:39 am

Re: 2.8 TFT Capacitive Touch Shield issues with Arduino Zero

Post by higgybaby »

Author removed incorrect conclusions.
Last edited by higgybaby on Sat Sep 18, 2021 5:44 pm, edited 1 time in total.

User avatar
higgybaby
 
Posts: 13
Joined: Thu Sep 18, 2014 12:39 am

Re: 2.8 TFT Capacitive Touch Shield issues with Arduino Zero

Post by higgybaby »

The problem appears to be that I had a gap in the solder of the "S0" pad to the ICSP connector. For some reason, the TFT works with this disconnected, but not the SD reader. When properly soldered, both devices work fine with the Zero as advertised. I'd left pins 11,12, and 13 traces in tact... so of course both devices still worked with the Uno.

Thanks.

Locked
Please be positive and constructive with your questions and comments.

Return to “Glowy things (LCD, LED, TFT, EL) purchased at Adafruit”