Hi, I am new here but have read many of the posts concerning ST7796S controller display which I am trying to use with an Arduino Mega 2560 R3. Here is an image of the 3.95" TFT and the AtMega 2560:
On the TFT I have shorted R5 and removed R4 thus using 16 Bits.
Thanks to all the posts on this forum I have managed to get most of the libraries working properly by forcing ID=0x7796. The issue I have is when I try to use the touch screen libraries of MCUFRIEND_kbv-2.9.9 (button_simple and TouchScreen_Calibr_native).
For button_simple I get the graphics on the screen but nothing happens when I press the buttons.
For TouchScreen_Calibr_native I get the following on the serial monitor.
TouchScreen.h GFX Calibration
Making all control and bus pins INPUT_PULLUP
Typical 30k Analog pullup with corresponding pin
would read low when digital is written LOW
e.g. reads ~25 for 300R X direction
e.g. reads ~30 for 500R Y direction
MISSING TOUCHSCREEN
ID = 0x7796
And I get the following on the TFT display.
Touch Calibration FAILED
Unable to read the position
of the press. This is a
hardware issue and can not
be corrected in software.
check XP, XM pins with a multimeter
check YP, YM pins with a multimeter
should be about 300 ohms
What pins exactly on the AtMega should I be testing with my MM?
From the posts I read, I tried the following changes in the code of TouchScreen_Calibr_native.ino
Last 2 lines (int XP..... and int TS_LEFT.....).
#define PORTRAIT 0
#define LANDSCAPE 1
#define USE_XPT2046 0
#define USE_LOCAL_KBV 1
#define TOUCH_ORIENTATION PORTRAIT
#if defined(USB_PID) && USB_PID == 0x804E // Arduino M0 Native
#define Serial SerialUSB
#endif
#define SWAP(x, y) { int t = x; x = y; y = t; }
#define TITLE "TouchScreen.h GFX Calibration"
#include <Adafruit_GFX.h>
#include <MCUFRIEND_kbv.h>
MCUFRIEND_kbv tft;
// MCUFRIEND UNO shield shares pins with the TFT.
#if defined(ESP32)
int XP = 27, YP = 4, XM = 15, YM = 14; //most common configuration
#else
int XP = 8, XM = 56, YP = 57, YM =9 ; //320x480 ID=0x7796, XM=A2=56, YP=A3=57
int TS_LEFT = 924, TS_RT = 127, TS_TOP = 59, TS_BOT = 931;
I also forced the id after tft.readID() with:
if (ID == 0xD3D3) ID = 0x7796;
Not sure if this helps. When I run the library LCD_ID_readnew I get the following Serial print:
diagnose any controller
reg(0x0000) 00 00 ID: ILI9320, ILI9325, ILI9335, ...
reg(0x0004) 04 04 04 04 Manufacturer ID
reg(0x0009) 09 09 09 09 09 Status Register
reg(0x000A) 0A 0A Get Power Mode
reg(0x000C) 0C 0C Get Pixel Format
reg(0x0030) 30 30 30 30 30 PTLAR
reg(0x0033) 33 33 33 33 33 33 33 VSCRLDEF
reg(0x0061) 61 61 RDID1 HX8347-G
reg(0x0062) 62 62 RDID2 HX8347-G
reg(0x0063) 63 63 RDID3 HX8347-G
reg(0x0064) 64 64 RDID1 HX8347-A
reg(0x0065) 65 65 RDID2 HX8347-A
reg(0x0066) 66 66 RDID3 HX8347-A
reg(0x0067) 67 67 RDID Himax HX8347-A
reg(0x0070) 70 70 Panel Himax HX8347-A
reg(0x00A1) A1 A1 A1 A1 A1 RD_DDB SSD1963
reg(0x00B0) B0 B0 RGB Interface Signal Control
reg(0x00B3) B3 B3 B3 B3 B3 Frame Memory
reg(0x00B4) B4 B4 Frame Mode
reg(0x00B6) B6 B6 B6 B6 B6 Display Control
reg(0x00B7) B7 B7 Entry Mode Set
reg(0x00BF) BF BF BF BF BF BF ILI9481, HX8357-B
reg(0x00C0) C0 C0 C0 C0 C0 C0 C0 C0 C0 Panel Control
reg(0x00C1) C1 C1 C1 C1 Display Timing
reg(0x00C5) C5 C5 Frame Rate
reg(0x00C8) C8 C8 C8 C8 C8 C8 C8 C8 C8 C8 C8 C8 C8 GAMMA
reg(0x00CC) CC CC Panel Control
reg(0x00D0) D0 D0 D0 D0 Power Control
reg(0x00D1) D1 D1 D1 D1 VCOM Control
reg(0x00D2) D2 D2 D2 Power Normal
reg(0x00D3) D3 D3 D3 D3 ILI9341, ILI9488
reg(0x00D4) D4 D4 D4 D4 Novatek
reg(0x00DA) DA DA RDID1
reg(0x00DB) DB DB RDID2
reg(0x00DC) DC DC RDID3
reg(0x00E0) E0 E0 E0 E0 E0 E0 E0 E0 E0 E0 E0 E0 E0 E0 E0 E0 GAMMA-P
reg(0x00E1) E1 E1 E1 E1 E1 E1 E1 E1 E1 E1 E1 E1 E1 E1 E1 E1 GAMMA-N
reg(0x00EF) EF EF EF EF EF EF ILI9327
reg(0x00F2) F2 F2 F2 F2 F2 F2 F2 F2 F2 F2 F2 F2 Adjust Control 2
reg(0x00F6) F6 F6 F6 F6 Interface Control
I hope the provided info helps. Please let me know anything else I can do.