Use this forum to chat about hardware specific topics for the ESP8266 (peripherals, memory, clocks, JTAG, programming)

User avatar
By QuickFix
#68748
Ribeiro Santos wrote:Try each funcionality one at a time,

Of course you can also advise TS to connect his bicycle to the SPI-pins, hoping it will fly away... :roll:

The LCD uses an 8- or 9-bit MCU parallel interface, not SPI. :idea:
User avatar
By QuickFix
#68780
Goran wrote:Do you know what approximate slow-down factor can I expect due to using SPI instead of 8-bit parallel interface?
Or, if you tried rendering 240x320x24 BMP image, what was the absolute rendering time in sec?

I don't have actual speed statistics at the moment and since I'm using the standard Adafruit library (for Arduino), I guess some speed optimization should be possible.
However, this video on YouTube will give you a good indication of the speed.

This is how I connected the display to my ESP (at the moment display only, until I've received my new and correct displays):
  • GPIO0 - LED
    I've done this so I can PWM the backlight intensity, if you don't have enough GPIO's, connect LED to +3.3V (= always backlight on)
    I chose GPIO0 in combination with a pull-up resistor, so I won't interfere with the FLASH-line of the ESP.
  • GPIO2 = DC
    This is the Data/Command-line (also known as "A0" or "RS" on some boards).
    You can use another GPIO for this line, if needed (as long as you set it correctly in code)
  • GPIO12 - SDO (MISO) / T_DO / SD_MISO
    Not all boards have this pin, so you can leave this off for the display (but it's needed for touch and SD)
  • GPIO13 (= HSPID) - SDI (MOSI) / T_DIN / SD_MOSI
    Sometimes known as "SDA"
  • GPIO14 (= HSPICLK) - SCK / T_CLK / SD_SCK
    SPI clock
  • GPIO15 (= HSPICS) - CS
    This is the chip select pin, sometimes called SS ("Slave Select")
    Every device (display, touch, SD) needs its own CS, so you'll need at least two more pins for touch and SD.
  • RESET - RESET
    I've put the RESET-line of the display to the RESET of the ESP to save a GPIO, in that case you'l need to declare RESET as -1 in code.
    If you have a GPIO available, connect it to that pin instead (and change in code).
  • The T_IRQ line (interrupt of the touch screen) can be connected to a free GPIO defined in code as an interrupt INPUT pin:
    Code: Select all#define TOUCH_IRQ 4 // GPIO pin for the touch interrupt

    void touching() {
      noInterrupts();
      // Hande touch screen code in here (as quickly as possible!)
      interrupts();
    }

    void setup() {
      // Bla-blah some other initialization code...
      pinMode(TOUCH_IRQ, INPUT_PULLUP); // Not really sure yet if I need to pull it up...
      attachInterrupt(digitalPinToInterrupt(TOUCH_IRQ), touching, CHANGE);
      // Bla-blah some more initialization code...
    }
    Presumably it should be possible not to use T_IRQ, which will spare you another GPIO, but then you'll have to poll the touch-screen regularly in code (your milage may vary, depending on the type of project)
    NOTE: above code isn't tested yet, since I don't have a correct touch screen display yet (still under way from China) ;)