adafruit / TFTLCD-Library

Arduino library for 8-bit TFT LCDs such as ILI9325, ILI9328, etc
http://www.ladyada.net/products/tfttouchbreakout/ and http://www.ladyada.net/products/tfttouchshield
319 stars 260 forks source link

reset issue #18

Open russli opened 9 years ago

russli commented 9 years ago

I encountered an issue using the graphicstest sketch with an ILI9341 controller.

If readID() is called directly after reset() ( as the graphicstest sketch does ) the ILI9341 does not have enough time to properly reset before readID() is called. In my case this caused an erroneous id of: 0xC0C0 to be reported. Adding a delay of 2 ms. between readID() and reset() resolves this issue.

Rather than modifying each sketch, a better solution would of course be to add the delay to the reset() function within Adafruit_TFTLCD.cpp as follows:

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

void Adafruit_TFTLCD::reset(void) {

CS_IDLE; // CD_DATA; WR_IDLE; RD_IDLE;

ifdef USE_ADAFRUIT_SHIELD_PINOUT

digitalWrite(5, LOW); delay(2); digitalWrite(5, HIGH);

else

if(_reset) { digitalWrite(_reset, LOW); delay(2); digitalWrite(_reset, HIGH); }

endif

delay(2);       // add delay here

// Data transfer sync CS_ACTIVE; CD_COMMAND; write8(0x00); for(uint8_t i=0; i<3; i++) WR_STROBE; // Three extra 0x00s CS_IDLE; }

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

Cheers, Russ