0

I recently got one TFT LCD from aliexpress which supports SPI and uses ILI9341.

This is the one.TFT LCD

I have the ESP8266 EspressoLite 1 board, and I am using ESP8266 Arduino. (https://github.com/esp8266/Arduino)

I made the following connection : SCK #14, MOSI #13, MISO #12 and CS #4, DC #5,RESET #0

and used the example graphicTest (which is available in the Adafruit_ILI9341-master folder) . I was able to make the display work for a few seconds. In the graphic test, once the line test starts my ESP8266 gets restarted. This was getting repeated .

In my existing project, I used the following code to just show some messages :

Adafruit_ILI9341 tft = Adafruit_ILI9341(4, 5, 13, 14, 0, 12);
  tft.begin()
  tft.fillScreen(ILI9341_BLACK);
  tft.setCursor(0, 0);
  tft.setTextColor(ILI9341_GREEN);  tft.setTextSize(4);
  tft.println(message);

The message is shown once a response is sent back from ESP. This works for a couple of times and then it again gets stuck and reboots.

I am not sure whether I am using the optimised library for ESP8266 for this LCD or whether there is any as such.

I read in forums and could see that there were some adafruit libraries in the ESP8266 Arduino but now that it is not available and only some TFT_Touch_Shield_V2 are present.

Has anyone faced the same issue or can tell me a better way to make this display work with ESP8266 Arduino.

Thanks in advance. !!!

1 Answer 1

1

You did not include any output from the esp8266, but I'm pretty sure what is happening is that the watchdog timer is expiring and resetting your board. This is because the SPI transactions to transfer data to the display are taking too long.

Put the following line in both setup() and loop() before any display operations happen:

wdt_disable();

Needless to say, if you actually do need the WDT in your application, you can reenable it after the display operations complete (of course, if you are doing something that depends on the wdt, you already know this!)

Look at the source for the Adafruit library, make sure there are #ifdef ESP8266 statements there; older versions did not support the 8266. You may also want to increase the default speed at which the library drives the SPI bus from 8000000. I've gotten it to work at up to 40MHz, with the board flashed at 160MHz of course, and it's a lot faster (unsurprisingly), but if you have long wires or a marginal-quality display, that may fail.

Post pictures :)

6
  • Thanks a lot for the suggestions .Its too early in the morning here to check what you have mentioned .I will check the following once later today and will post the results :) I hope with your help I can sort it out and too much thankful for such lengthy explanation and details about the whole issue. I expect you to help me further in case it doesn't sort out the issue .
    – rahulmr
    Commented May 4, 2016 at 22:53
  • Thanks for the detailed explanation .I tried putting the wdt_disable() void showmessage(String message) { wdt_disable(); tft.fillScreen(ILI9341_BLACK); tft.setCursor(0, 0); tft.setTextColor(ILI9341_GREEN); tft.setTextSize(4); tft.println(message); } but it doesn't work .it still continues to reset
    – rahulmr
    Commented May 5, 2016 at 2:30
  • What do you see on the serial port output? (If you are not using the serial port in your code, just put Serial.begin(115200) or some such, as the debugging output defaults to 74300bps or some weird number like that which most terminal emulators, including the arduino ide serial monitor, do not support.
    – JayEye
    Commented May 5, 2016 at 23:40
  • 1
    I made it work as you mentioned .disabled the watchdog timer before writing to LCD and then once that is done called the enable with a time value of 10 and now it works without any exception . But still I feel the speed is bit slow for esp8266 .You said about 40Mhz . Is that done using the spin set frequency method and then flashing at 160 ? anyway thanks for fixing my issue :)
    – rahulmr
    Commented May 6, 2016 at 0:51
  • 1
    I'm glad you got it to work. The 40MHz is the SPI bus speed, which you set in the spi settings, for example here: github.com/adafruit/Adafruit_ILI9341/blob/master/… You also appear to be using the software (bit-banged) SPI code; use the constructor that does not specify the miso/mosi/sclk pins, and use the hardware spi pins on the 8266 (mosi: 13, sclk: 14, cs: 16, miso: 12 (unused for the display, but if you have the card that also has a touch screen, you need that. With a different chip select, of course!)
    – JayEye
    Commented May 6, 2016 at 4:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.