Peculiar problem with SPI lcd ILI9341

Hello. I have peculiar problem with SPI lcd ILI9341. When using hardware SPI, screen goes white, but when I use "software" SPI screen works well (very slow but works). I tried examples from Adafruit library and Ucglib library, in both cases it's the same: "hardware configuration" white screen, "software configuration" example works well.
This doesn't bother me much, problem is that the LCD has touch panel which I can't make it work. All examples, for touch panel, are for harware SPI, I tried some examples but didn't work . Driver for touch panel is Xpt2046.
Can anyone have idea if touch panel could work on "software SPI" and how to connect touch panel to arduino, and of course example program would be great.

first part of program that works OK "software SPI", Ada example:

/***************************************************
  This is our GFX example for the Adafruit ILI9341 Breakout and Shield
  ----> http://www.adafruit.com/products/1651

  Check out the links above for our tutorials and wiring diagrams
  These displays use SPI to communicate, 4 or 5 pins are required to
  interface (RST is optional)
  Adafruit invests time and resources providing this open source code,
  please support Adafruit and open-source hardware by purchasing
  products from Adafruit!

  Written by Limor Fried/Ladyada for Adafruit Industries.
  MIT license, all text above must be included in any redistribution
 ****************************************************/


#include "SPI.h"
#include "Adafruit_GFX.h"
#include "Adafruit_ILI9341.h"

// For the Adafruit shield, these are the default.
#define TFT_DC 9
#define TFT_CS 10
#define TFT_MOSI 11
#define TFT_CLK 13
#define TFT_RST 8
#define TFT_MISO 12


// Use hardware SPI (on Uno, #13, #12, #11) and the above for CS/DC
//Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC);
// If using the breakout, change pins as desired
Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC, TFT_MOSI, TFT_CLK, TFT_RST, TFT_MISO);

I'm using:
clone arduino uno,
2,8" LCD (https://www.aliexpress.com/item/4001143078353.html?spm=a2g0s.9042311.0.0.27424c4dtXcG2i)
CD4050BE

pictures added. adafruit's serial monitor outputs. wiring, programs. photo of lcd.

excuse my mistakes in writing, english is not my native language

Please don't post screenshots of code or Serial Terminal. Always copy-paste the text directly to your message.

Your CD4050BE schematic looks fine. Only you can hand-trace the wires. I can't decipher your rats' nest.
Except for VCC pin on Red pcb. This should be 5V and not 3.3V

You can bit-bang the XPT2046 on separate GPIO pins with URTouch.h library.

Personally, I would use Hardware SPI for TFT, XPT2046, SD card on a proper 3.3V Arduino.

However the CD4050 should do the level shifting for you. It only has 6 channels. TFT_CS, TFT_DC, TFT_RST, XPT_CS, SD_CS, MOSI, SCK. Omit the XPT_IRQ. MISO connected via the 2k2 series resistor.

Seriously, several Chinese Uno clones come with 3.3V/5V switched GPIO. I have never used the 5V setting. And yes, they work fine at 16MHz and 3.3V

David.

Thanks for reply. I'll try to bit-bang the XPT2046 URTouch.h library and see if i can make it work on "software SPI".

This topic was automatically closed after 59 days. New replies are no longer allowed.