Hello everyone,
I'm encountering a persistent and frustrating issue with Hardware SPI on my Arduino Uno WiFi R4 board when attempting to use an ILI9341 TFT display with an XPT2046 touch controller.
The Problem: My ILI9341 TFT display remains blank or shows corrupted output, and the XPT2046 touch functionality is completely unresponsive on the Arduino Uno WiFi R4. This setup is critical for my project's user interface.
Interesting Findings My setup works perfectly with Uno R3. With R4, to get it to work somewhat, I use the full constructor, but lose the ability to control both touch screen and tft for drawing graphics. When I use the constructor for Hardware SPI, this is when the blank screen occurs.
My Setup:
- Problematic Board: Arduino Uno WiFi R4
- TFT Display: ILI9341 (using Adafruit_ILI9341 library)
- Touch Controller: XPT2046 (using XPT2046_Touchscreen library)
- SD Card: Integrated on the same TFT module (using SD.h library) - Note: This is also affected by the SPI issue.
- SPI Pins Used (Hardware SPI):
TFT_CS
: Digital Pin 10TFT_DC
: Digital Pin 9TFT_RST
: Digital Pin 8SD_CS
: Digital Pin 4TCH_CS
: Digital Pin 5TCH_IRQ
: Analog Pin A5- Hardware SPI MOSI, MISO, SCK are connected to the standard pins (11, 12, 13 respectively) on the Uno WiFi R4.
Initialization Sequence in setup()
:
- All Chip Select (CS) pins (
TFT_CS
,SD_CS
,TCH_CS
) are configured asOUTPUT
and setHIGH
(deselected) before any SPI communication. SPI.begin()
is called.tft.begin()
is called.SD.begin(SD_CS)
is called.touch.begin()
is called.
Crucial Observation: The exact same circuit wiring and Arduino sketch work perfectly on a standard Arduino Uno (non-WiFi version, e.g., Uno R3) with no issues whatsoever. This clearly indicates the problem is specific to the Arduino Uno WiFi R4's hardware SPI implementation, its distinct Renesas RA4M1 microcontroller, or its interaction with the onboard ESP32 WiFi module.
Has anyone else encountered these specific SPI communication challenges with external displays/touch controllers on the Arduino Uno WiFi R4? I'm looking for insights, potential workarounds, or confirmation of a known compatibility issue.