Control 3.2" 240x320h IPS SPI Module ILI9341 with cap. touch FT6336U on Nologo Nano 33 BLE (Arduino Framework)

In this post, to Control 3.2" 240x320h IPS SPI Module ILI9341 with cap. touch FT6336U with Nologo Nano 33 BLE in Arduino Framework,

Adafruit_ILI9341 and Arduino-FT6336U libraries are need.
- To install Adafruit_ILI9341, read the video in Raspberry Pi Pico (RP2040) + 3.2inch IPS SPI Module ILI9341.
- To download and install Arduino-FT6336U, read the video in Detect FT6336U Capacitive Touch Screen on Raspberry Pi Pico using Arduino-FT6336U library.

Connection

ILI9341 Module	    Nano 33 BLE
1 	VCC	    3V3
2 	GND         GND
3 	LCD_CS	    D5
4 	LCD_RST	    D6
5 	LCD_RS	    D7
6 	SDI(MOSI)   D11 (SPI COPI)
7 	SCK	    D13	(SPI SCK)
8 	LED	    3V3
9 	SDO(MISO)   D12 (SPI CIPO)
10 	CTP_SCL	    A5	(I2C SCL)
11 	CTP_RST	    D8
12 	CTP_SDA	    A4	(I2C SDA)
13 	CTP_INT	    D9
14 	SD_CS	    D10

Code

nano33BLE_ILI9341_FT6336U.ino
/*
Exercidr run on Nano 33 BLE
+ 3.2 inch 320x240 IPS SPI Module ILI9341 with FT6336U Capacitive Touch Screen,
using Adafruit_ILI9341 and Arduino-FT6336U (https://github.com/aselectroworks/Arduino-FT6336U).

Read Touch event and display on screen.

Sometimes miss touch events, depends on sampling rate.
*/

#include <Adafruit_ILI9341.h>
#include <FT6336U.h>

/*
Hardware I2C pins for Raspberry Pi Pico
I2C_SDA = A4
I2C_SCL = A5

Hardware SPI pins for Raspberry Pi Pico
SPI_MOSI = D11
SPI_MISO = D12
SPI_SCK  = D13

  Connection:
  ILI9341 Module  Nano 33 BLE
  1 	VCC         3V3
  2 	GND         GND
  3 	LCD_CS      D5
  4 	LCD_RST     D6
  5 	LCD_RS      D7
  6 	SDI(MOSI)   D11 (SPI COPI)
  7 	SCK         D13	(SPI SCK)
  8 	LED         3V3
  9 	SDO(MISO)   D12 (SPI CIPO)
  10 	CTP_SCL     A5	(I2C SCL)
  11 	CTP_RST     D8
  12 	CTP_SDA     A4	(I2C SDA)
  13 	CTP_INT     D9
  14 	SD_CS       D10


*/

#define TFT_DC  D7
#define TFT_CS  D5
#define TFT_RST D6

#define RST_N_PIN D8
#define INT_N_PIN D9

Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC, TFT_RST);

FT6336U ft6336u(RST_N_PIN, INT_N_PIN);

void setup() {
    delay(500);
    Serial.begin(115200);
    delay(1000);

    Serial.println();

    tft.begin();          // Initialize screen
    tft.invertDisplay(true);
    tft.fillScreen(ILI9341_BLACK);

    ft6336u.begin();

    Serial.print("FT6336U Firmware Version: ");
    Serial.println(ft6336u.read_firmware_id());
    Serial.print("FT6336U Device Mode: ");
    Serial.println(ft6336u.read_device_mode());
}

void loop() {
    if(digitalRead(INT_N_PIN) != -1) {
        switch(ft6336u.read_touch1_event()){
          case 0x00:
            tft.fillScreen(ILI9341_BLACK);
            break;
          case 0x02:
            tft.fillCircle(ft6336u.read_touch1_x(), ft6336u.read_touch1_y(), 3, ILI9341_WHITE);
            break;
        }
    }
}


In this video, ILI9341 SPI Display Module with FT6336U cap. touch is controlled with Nologo Nano 33 BLE, instead of Raspberry Pi Pico.



Obviously, it's much slower than expected.
Probably it's because the Nano 33 BLE is running mbed OS in the background and the Arduino interface library probably has to negotiate with the OS before the sketch code can use the SPI port and I/O pins.


Comments

Popular posts from this blog

480x320 TFT/ILI9488 SPI wih EP32C3 (arduino-esp32) using Arduino_GFX Library

my dev.tools - FNIRSI 2C23T 3-in-1 Dual Channel Oscilloscope/Multimeter/Signal Generator