Working on my latest project and could use some suggestions and/or help. I’m using a cheap 2.4" tftLCD on my UNO R3 and I want to modify the LCD board to move the reset line off of A4 and over to pin 1. Eventually I want to add a BMP180 pressure sensor, and I’ll need A4 and A5 to interface with the sensor using the specific library for that sensor.
In my project I also want to access the micro SD card, and I started learning how to use the SD with the Adafruit example sketch (tftbmp) that comes with the Adafruit TFT library. (NOTE: the sensor name: BMP180 has nothing to do with the image file type that the example code loads from the SD card (*.bmp)).
This is the cheap LCD I have (http://www.ebay.com/itm/US-Ship-Arduino-UNO-LCD-Shield-w-2-4-TFT-SD-Reader-Touch-Screen-Module/321991686388).
It requires the breakout board pinout and it also needs overriding the identifier with this added piece of code:
if(identifier==0x0101) identifier=0x9341; //this is the ID override for the Xyltech TFT_LCD
I have two of the tftLCDs, one has been modified to move the reset to pin 1 which required cutting a trace on the top of the printed circuit board and soldering a wire to replace the connection so it goes to pin 1 instead. The other unmodified tftLCD retains the A4 reset.
I thought that changing the reset pin location in the setup line of the Adafruit sketch along with the identifier override is all that is needed. But this modification has broken the LCD updates, and all I get is a white screen on the LCD with the LCD reset on pin 1. However, the serial messages in this sketch are still good (this is true with either LCD board). With the altered LCD reset line on pin 1 the SD card is still being read, but the screen is white. There is the blip when the screen is supposed to be updated, but that is all.
The unmodified tftLCD card with its reset on A4 works as intended, the bmp image from the SD card is displayed very nicely on the screen.
Note that I’m using an older SD library (1.0.6), newer libraries don’t seem to work at all with either tftLCD card and I’m not sure why not. I get the: Initializing SD card…failed with the newer SD libraries.
Below is the slightly modified Adafruit example code with the identifier override on line 53-54, and the TFTLCD pinout choice is either line 43 (unmodified) or line 44 (modified reset).
I’m stuck trying to figure out why the reset pin assignment is affecting the LCD, there should be no pin conflicts. On the tftLCD boards I have, pins 0, 1, and A5 should be free.
I have tried a version of the code where I comment out all the SD access lines and just draw a rectangle on the screen using tft.drawRect, etc. This works on either card so long as the reset is set to the right pin for the card being tested. So I’ve concluded that something in the SD library is affected by the move of the LCD reset line from A4 to pin 1.
But that makes no sense!
Modified example sketch is attached to avoid character limit.
tftbmp_rst_on_1.ino (9.07 KB)