Pages: [1]   Go Down
Author Topic: Help Wiring Adafruit 1.8" TFT LCD and 1284p standalone project  (Read 1523 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 29
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
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:
// 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:
#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








Logged

0
Offline Offline
Shannon Member
****
Karma: 222
Posts: 12725
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Perhaps the non-highspeed version is the one to try first - the 1284 may have different requirements for hardware SPI?
Logged

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

Global Moderator
Boston area, metrowest
Online Online
Brattain Member
*****
Karma: 549
Posts: 27427
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

How about some more code -
do you have
pinMode(cs, OUTPUT);
for example?
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Offline Offline
Newbie
*
Karma: 0
Posts: 29
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Many thanks all,

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

Code:
// 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:
// 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

Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 29
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

@MarkT

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

Code:
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:
#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);

 smiley-cry

Logged

0
Offline Offline
Shannon Member
****
Karma: 222
Posts: 12725
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Have you asked on the  Adafruit site ?  I reckon they will be very helpful by all accounts.
Logged

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

Offline Offline
Newbie
*
Karma: 0
Posts: 29
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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 smiley-sad

Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 29
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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 smiley-sad

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
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 29
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

With the new library released in 12 november it's work!

https://github.com/adafruit/Adafruit-ST7735-Library

Logged

0
Offline Offline
Shannon Member
****
Karma: 222
Posts: 12725
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Ah, glad its been resolved...
Logged

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

Pages: [1]   Go Up
Jump to: