2.4 tft lcd i2c bug solved

hello every body ,

i wanted to share with you all who are using tft2.4 with arduino some topics.
The libraries for the boards are using A4 pin as a reset pin but arduino uses that pins as SDA.
thats why when we are using i2c with tfts it restarts to lcd . the solution that i found for that problem is making some pin changes i am sending the pictures to be more clear.

iam also new with arduino but i hope it will be usefull to all of you .

regards,

I thought that we were going to see a sophisticated solution !

You will struggle to use the microSD (which is probably the most useful part of this shield).

If your board has an ILI9341 controller, you can reset this in Software. There is no need for your Black wire.

It is a mystery why the parallel mcufriend shields are so common, and few people make SPI shields. Wavetech, Itead make them but they cost 5x the price of the Mcufriend boards. 10x for the Seeed or Adafruit. With an SPI TFT, Touch, microSD you have plenty of spare pins for I2C, GPIO etc

David.

david_prentice:
I thought that we were going to see a sophisticated solution !

Hello David, sorry about that but i said iam beginner i just wanted to share my experience as much as i can.

david_prentice:
You will struggle to use the microSD (which is probably the most useful part of this shield).

i break digital pins for microSD because i use them for different function i don't need them for app which im working on, but its not necessary break it you are right.

david_prentice:
If your board has an ILI9341 controller, you can reset this in Software. There is no need for your Black wire.

i really would like to know how to define reset pin on software that what i was looking for and couldn't manage that's why i did it on hardware.

regards,

First off, you need to know which controller you have. Most libraries will have a tft.readID() method.
Or you just look at what argument is given to tft.begin( ID );

Run an example program and look at the Serial Terminal.

If your examples work with tft.begin(0x9341) then you do nothing. The begin() does a software reset of the controller.
If you have begin(0x9325) or begin(0x7783) then you need the black wire.

David.

david_prentice:
If your examples work with tft.begin(0x9341) then you do nothing. The begin() does a software reset of the controller.

My example is working with 0x9341 and on the software i found the command for reset,

void Adafruit_TFTLCD::begin(uint16_t id) {
  uint8_t i = 0;

  reset();

  delay(200);

  if((id == 0x9325) || (id == 0x9328)) {

    uint16_t a, d;
    driver = ID_932X;
    CS_ACTIVE;
    while(i < sizeof(ILI932x_regValues) / sizeof(uint16_t)) {
      a = pgm_read_word(&ILI932x_regValues[i++]);
      d = pgm_read_word(&ILI932x_regValues[i++]);
      if(a == TFTLCD_DELAY) delay(d);
      else                  writeRegister16(a, d);
    }
    setRotation(rotation);
    setAddrWindow(0, 0, TFTWIDTH-1, TFTHEIGHT-1);

  } else if (id == 0x9341) {

    uint16_t a, d;
    driver = ID_9341;
    CS_ACTIVE;

    writeRegister8(ILI9341_POWERCONTROL1, 0x23);
    writeRegister8(ILI9341_POWERCONTROL2, 0x10);
    writeRegister16(ILI9341_VCOMCONTROL1, 0x2B2B);
    writeRegister8(ILI9341_VCOMCONTROL2, 0xC0);
    writeRegister8(ILI9341_MEMCONTROL, ILI9341_MADCTL_MY | ILI9341_MADCTL_BGR);
    writeRegister8(ILI9341_PIXELFORMAT, 0x55);
    writeRegister16(ILI9341_FRAMECONTROL, 0x001B);
    
    writeRegister8(ILI9341_ENTRYMODE, 0x07);
    /* writeRegister32(ILI9341_DISPLAYFUNC, 0x0A822700);*/
    writeRegister8(ILI9341_SLEEPOUT, 0);
    writeRegister8(ILI9341_DISPLAYON, 0);

	// *** SPFD5408 change -- Begin
	// Not tested yet
	//writeRegister8(ILI9341_INVERTOFF, 0);
	//delay(500);
    // *** SPFD5408 change -- End
    setAddrWindow(0, 0, TFTWIDTH-1, TFTHEIGHT-1);
    return;

  } else if (id == 0x8357) {
    // HX8357D
    driver = ID_HX8357D;
    CS_ACTIVE;
     while(i < sizeof(HX8357D_regValues)) {
      uint8_t r = pgm_read_byte(&HX8357D_regValues[i++]);
      uint8_t len = pgm_read_byte(&HX8357D_regValues[i++]);
      if(r == TFTLCD_DELAY) {
	delay(len);
      } else {
	//Serial.print("Register $"); Serial.print(r, HEX);
	//Serial.print(" datalen "); Serial.println(len);

	CS_ACTIVE;
	CD_COMMAND;
	write8(r);
	CD_DATA;
	for (uint8_t d=0; d<len; d++) {
	  uint8_t x = pgm_read_byte(&HX8357D_regValues[i++]);
	  write8(x);
	}
	CS_IDLE;

      }
    }
     return;
     
  } else if(id == 0x7575) {

    uint8_t a, d;
    driver = ID_7575;
    CS_ACTIVE;
    while(i < sizeof(HX8347G_regValues)) {
      a = pgm_read_byte(&HX8347G_regValues[i++]);
      d = pgm_read_byte(&HX8347G_regValues[i++]);
      if(a == TFTLCD_DELAY) delay(d);
      else                  writeRegister8(a, d);
    }
    setRotation(rotation);
    setLR(); // Lower-right corner of address window

  } else {
    driver = ID_UNKNOWN;
    return;
  }
}

and how can be this reset function to be addressed reset pin.?
this is maybe my question.

regards,

No, it looks like you are using Adafruit library.

tft.reset() for hardware reset.
tft.begin(0x9341) for software reset.

David.

david_prentice:
No, it looks like you are using Adafruit library.

yes i do use adafruit lib.