Go Down

Topic: Arduino 1.77" SPI TFT Blank White Screen Only (Read 1 time) previous topic - next topic

Thorium234

Hello all,

I have a Freetronics Eleven (100% Arduino Uno compatible) connected to an Arduino 1.77" SPI TFT LCD Display. I'm using the TFT Display Text tutorial at http://arduino.cc/en/Tutorial/TFTDisplayText. When I upload the sketch the display white backlight activates but nothing else happens. Could it be a compatibility problem with the Uno-copy board?
How do I get it to display anything?

Also, I don't have a micro SD fitted: is that necessary?

Any help would be appreciated.

Palliser

Hello Thorium234,

The example doesn't require SD card and it is written for hardware SPI use which means MOSI (pin 11) and SCLK (pin 13) by default. Could you post your code and how are you connecting the 11/LCD? Regards.

p

Thorium234

Here is my code that I had literally copied and pasted into Arduino IDE from the tutorial to be sure I hadn't made a typo.

Code: [Select]
#include <TFT.h>  // Arduino LCD library
#include <SPI.h>

// pin definition for the Uno
#define cs   10
#define dc   9
#define rst  8 

// pin definition for the Leonardo
// #define cs   7
// #define dc   0
// #define rst  1

// create an instance of the library
TFT TFTscreen = TFT(cs, dc, rst);

// char array to print to the screen
char sensorPrintout[4];

void setup() {
 
  // Put this line at the beginning of every sketch that uses the GLCD:
  TFTscreen.begin();

  // clear the screen with a black background
  TFTscreen.background(0, 0, 0);
 
  // write the static text to the screen
  // set the font color to white
  TFTscreen.stroke(255,255,255);
  // set the font size
  TFTscreen.setTextSize(2);
  // write the text to the top left corner of the screen
  TFTscreen.text("Sensor Value :\n ",0,0);
  // ste the font size very large for the loop
  TFTscreen.setTextSize(5);
}

void loop() {

  // Read the value of the sensor on A0
  String sensorVal = String(analogRead(A0));

  // convert the reading to a char array
  sensorVal.toCharArray(sensorPrintout, 4);

  // set the font color
  TFTscreen.stroke(255,255,255);
  // print the sensor value
  TFTscreen.text(sensorPrintout, 0, 20);
  // wait for a moment
  delay(250);
  // erase the text you just wrote
  TFTscreen.stroke(0,0,0);
  TFTscreen.text(sensorPrintout, 0, 20);
}


I'm connecting exactly (I've double and triple checked) as per this image on the tutorial.


Might SPI work a bit differently with the eleven even though it's supposed to be Uno compatible? I don't know a lot about SPI.

Thorium234

Palliser

Could you run the following code to see if the white background is real or not? I mean, if the TFTscreen.background is working.

Code: [Select]
#include <TFT.h>  // Arduino LCD library
#include <SPI.h>
#define cs   10
#define dc   9
#define rst  8 
TFT TFTscreen = TFT(cs, dc, rst);

void setup() {
  TFTscreen.begin(); 
}

void loop() {
TFTscreen.background(255,0,0); // red
delay(1000);
TFTscreen.background(0,255,0); // green
delay(1000);
TFTscreen.background(0,0,255); // blue
delay(1000);
}


p

Thorium234

Alright. I've uploaded your code but the screen is still white i.e. there is no change in what is being displayed.

The hardwired LED to pin D13 does flash every second so the board is sending something to SCLK pin though.

It's almost like the display won't accept commands; as soon as I power up the eleven board the display just lights up the backlight and stays like that.

Thorium234

Palliser

What IDE version you are using? Could you try with the Arduino IDE 1.5.6-r2?

p

Thorium234

I'm using version 1.0.5-r2.

I can only find my current version and the 1.5.7-r2 Beta on the Arduino download page. Where do download 1.5.6-r2?

Thorium234


Thorium234

#8
Jul 27, 2014, 07:15 am Last Edit: Jul 27, 2014, 08:15 am by Thorium234 Reason: 1
Okay, I've uninstalled my old version and started installing 1.5.6-r2 but this error came up some way through the installation process:

 Error opening file for writing:

 C:\Program Files (x86)\Arduino\java\bin\awt.dll

 Click Abort to stop the installation,
 Retry to try again, or
 Ignore to skip this file.

I tried Retry but the same error happened. Any ideas?

Update: I ignored the error (and 4 or 5 subsequent and similar errors) and it installed. I tried uploading the code you've posted and it successfully compiled and uploaded but nothing different is happening with the display.

Update 2: Investigating the error I just worked out it is related to something else (that I've now dealt with) on my computer. I've re-installed 1.5.6r-2 with no errors now. However, again there is no luck with the display.

Sorry about the whole error thing.

Palliser

Hello Thorium234,
Are you powering the Arduino only through the USB connector? If so, can you try using an external power supply?
It's known that some LCDs (like some modems) have high power consumption to work accordingly. Regards,

p

Thorium234

Palliser, so far I've only been using the USB port from my computer.

Okay, now I've plugged a 7.2V RC car battery (fully charged and hence supplying a higher value of 8.5V) into the eleven's DC jack. The display still doesn't do anything. I measured the potential difference across the +5V pin and GND pin on the display whilst powered up and it shows 4.9V from both USB and DC jack power. I suspect this is due to the eleven's on-board regulator cutting down the battery's input to the required 5V.

Perhaps the display needs its own power supply? But I fear the 8.5V from the battery would be too much going straight into the display.

Thorium234

Palliser

Let's try one more thing: Could you wire your eleven with the LCD according to the arduino UNO wiring as shown in the following link?

http://arduino.cc/en/Guide/TFTtoBoards#.UyWQNNyP4p0

p

Thorium234

It's rewired as indicated in the link and I just tried running it with both USB and then battery. I uploaded the sketch you offered above to test the tftScreen.background function but nothing happened. The screen comes on white as soon as the eleven has power. In fact, if I remove all leads but for +5V and GND to the display it still comes on white and does nothing.

Palliser

Let's now test the SPI port of your eleven.
With your eleven alone, make a jumper between pins 11 (MOSI) and 12 (MISO).
The following code will send and receive a string via the SPI port.
If the test is successful, you should see the string "SPI TEST OK" in the serial monitor of the Arduino IDE.

Code: [Select]
//Loop Back test for the SPI port of the Arduino
#include <SPI.h>
char outByte [20] = "SPI TEST OK";
char inByte;
int i = 0;                                                         

void setup()
{
  Serial.begin(9600); 
  SPI.begin(); 
  delay(100); 
}

void loop()
{   
  for(i = 0; outByte [i] != '\0'; i ++) 
  {
    inByte = SPI.transfer(outByte [i]);
    Serial.write(inByte);   
  }
  Serial.println();
  delay(1000);
}



Thorium234

Okay, I've done exactly as described and I get "SPI TEST OK" printed on the Serial Monitor every second.

So this means the SPI ports and SPI library are both working with my eleven?

Thorium234

Go Up