Go Down

Topic: Help Wiring Adafruit 1.8" TFT LCD and 1284p standalone project (Read 1 time) previous topic - next topic

uno23

Hi all, I try to use  1.8" 18-bit color TFT LCD display
http://adafruit.com/products/358

with my breadboard 1284p project

So I wired

Code: [Select]
Gnd          --> GND
VCC          --> 5v
RESET      --> D0
D/C          --> D3
CARDCS    --> NONE
TFTCS      --> D4
MOSI        --> D5
SCK         --> D7
MISO        --> NONE
LITE        --> VCC


this is the pin mapping
Code: [Select]

// ATMEL ATMEGA1284P
//
//                   +---\/---+
//           (D 0) PB0  1|        |40  PA0 (AI 0 / D24)
//           (D 1) PB1  2|        |39  PA1 (AI 1 / D25)
//      INT2 (D 2) PB2  3|        |38  PA2 (AI 2 / D26)
//       PWM (D 3) PB3  4|        |37  PA3 (AI 3 / D27)
//    PWM/SS (D 4) PB4  5|        |36  PA4 (AI 4 / D28)
//      MOSI (D 5) PB5  6|        |35  PA5 (AI 5 / D29)
//  PWM/MISO (D 6) PB6  7|        |34  PA6 (AI 6 / D30)
//   PWM/SCK (D 7) PB7  8|        |33  PA7 (AI 7 / D31)
//                 RST  9|        |32  AREF
//                 VCC 10|        |31  GND
//                 GND 11|        |30  AVCC
//               XTAL2 12|        |29  PC7 (D 23)
//               XTAL1 13|        |28  PC6 (D 22)
//      RX0 (D 8)  PD0 14|        |27  PC5 (D 21) TDI
//      TX0 (D 9)  PD1 15|        |26  PC4 (D 20) TDO
// RX1/INT0 (D 10) PD2 16|        |25  PC3 (D 19) TMS
// TX1/INT1 (D 11) PD3 17|        |24  PC2 (D 18) TCK
//      PWM (D 12) PD4 18|        |23  PC1 (D 17) SDA
//      PWM (D 13) PD5 19|        |22  PC0 (D 16) SCL
//      PWM (D 14) PD6 20|        |21  PD7 (D 15) PWM
//                   +--------+
//


and i use adafruit labrary with this code...

Code: [Select]
#define cs   4
#define dc   3
#define rst   0

#include <Adafruit_GFX.h>
#include <Adafruit_ST7735.h>
#include <SPI.h>

Adafruit_ST7735 tft = Adafruit_ST7735(cs,dc,rst);

and I try with the example graphictest_highspeed


But unfortunately the display is white totally illuminated.
upload code is via a programmer. And the sketch is uploaded correctly. I modified the code to add in the loop a  blinking LED and it works. Any idea? Where am I doing wrong? thanks

best regards

Marco









MarkT

Perhaps the non-highspeed version is the one to try first - the 1284 may have different requirements for hardware SPI?
[ I won't respond to messages, use the forum please ]

CrossRoads

How about some more code -
do you have
pinMode(cs, OUTPUT);
for example?
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

uno23

Many thanks all,

So I use the adafruit library, so if I watch inside  the library code I see:

Code: [Select]
// Constructor when using hardware SPI.  Faster, but must use SPI pins
Adafruit_ST7735::Adafruit_ST7735(uint8_t cs, uint8_t rs, uint8_t rst) {
  _cs   = cs;
  _rs   = rs;
  _rst  = rst;
  hwSPI = true;
  _sid  = _sclk = 0;
}


and the initialization methods with correct pinmode

Code: [Select]
// Initialization code common to both 'B' and 'R' type displays
void Adafruit_ST7735::commonInit(uint8_t *cmdList) {

  constructor(ST7735_TFTWIDTH, ST7735_TFTHEIGHT);
  colstart  = rowstart = 0; // May be overridden in init func

  pinMode(_rs, OUTPUT);
  pinMode(_cs, OUTPUT);
  csport    = portOutputRegister(digitalPinToPort(_cs));
  cspinmask = digitalPinToBitMask(_cs);
  rsport    = portOutputRegister(digitalPinToPort(_rs));
  rspinmask = digitalPinToBitMask(_rs);

  if(hwSPI) { // Using hardware SPI
    SPI.begin();
    SPI.setClockDivider(SPI_CLOCK_DIV4); // 4 MHz (half speed)
    SPI.setBitOrder(MSBFIRST);
    SPI.setDataMode(SPI_MODE0);
  } else {
    pinMode(_sclk, OUTPUT);
    pinMode(_sid , OUTPUT);
    clkport     = portOutputRegister(digitalPinToPort(_sclk));
    clkpinmask  = digitalPinToBitMask(_sclk);
    dataport    = portOutputRegister(digitalPinToPort(_sid));
    datapinmask = digitalPinToBitMask(_sid);
    *clkport   &= ~clkpinmask;
    *dataport  &= ~datapinmask;
  }

  // toggle RST low to reset; CS low so it'll listen to us
  *csport &= ~cspinmask;
  if (_rst) {
    pinMode(_rst, OUTPUT);
    digitalWrite(_rst, HIGH);
    delay(500);
    digitalWrite(_rst, LOW);
    delay(500);
    digitalWrite(_rst, HIGH);
    delay(500);
  }

  if(cmdList) commandList(cmdList);
}


// Initialization for ST7735B screens
void Adafruit_ST7735::initB(void) {
  commonInit(Bcmd);
}




What could I check?

Best regards

Marco


uno23

@MarkT

I have also tried with non-highspeed version with the same result.

Code: [Select]
Gnd          --> GND
VCC          --> 5v
RESET      --> D0
D/C          --> D3
CARDCS    --> NONE
TFTCS      --> D23
MOSI        --> D22
SCK         --> D21
MISO        --> NONE
LITE        --> VCC


with this code
Code: [Select]

#define sclk   21
#define mosi  22
#define cs   23
#define dc   3
#define rst   0

#include <Adafruit_GFX.h>
#include <Adafruit_ST7735.h>
#include <SPI.h>

Adafruit_ST7735 tft = Adafruit_ST7735(cs,dc,mosi,sclk,rst);


=(


MarkT

Have you asked on the  Adafruit site ?  I reckon they will be very helpful by all accounts.
[ I won't respond to messages, use the forum please ]

uno23

I have  tried to post the same message to adafruti forum

http://forums.adafruit.com/viewtopic.php?f=47&t=34244

But at this time I have no news :(


uno23

This evening I tried to connect the display with arduino one following the tutorial step by step ..... but the result is the same the display appears all white :(

http://learn.adafruit.com/1-8-tft-display/connecting-the-display


Could it be broken? Mistake or something fundamental? But I followed the tutorial like a monkey: D


MarkT

[ I won't respond to messages, use the forum please ]

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy