購入後、ピンも付けず眠らせていたラズパイ「Pico W」をもったいないので使うことに。数年前の素の「Pico」は使ってましたが、久しぶりなので思い出すのにチョッと苦労。無事WiFiに繋げられホッとしました(これでネットに接続できるなんてひと昔前にはね...)。WEBからのLED点灯・消灯も出来ました。まあ、これは今回の主題ではないのでこれぐらいにして。
TFTディスプレイモジュールを繋ぎ動作させた結果を報告します。(2025/3/16編集)
1.3.95" 8bitパラレル接続のTFTディスプレイモジュール ILI9488 480x320
2.Raspberry Pi Pico W
3.TFT_eSPIライブラリ使用
4.ArduinoIDE -> File -> Examples -> TFT_eSPI -> 480x320 -> UTFT_Demo_480x320.ino を実行
1ループ後のスコアが「560msecs」と結構速いです。欲張って「LovyanGFX」でもと思いましたが、よく見たらPicoはサポート対象外でした、残念。それとこのボードにタッチ機能はないようで試してません(アマゾンの商品紹介には書いてありましたが...)。以下に、何をどのように設定したのか記します。
まず、Pico、ILI9488、Parallelなので「Setup100_RP2040_ILI9488_parallel.h」でピンの定義などをします。
#define USER_SETUP_ID 100
// Interface
#define TFT_PARALLEL_8_BIT
// Display driver type
#define ILI9488_DRIVER
////////////////////////////////////////////////////////////////////////////////////////////
// RP2040 pins used
////////////////////////////////////////////////////////////////////////////////////////////
#define TFT_CS -1 // Do not define, chip select control pin permanently connected to 0V
// These pins can be moved and are controlled directly by the library software
#define TFT_DC 28 // Data Command control pin
#define TFT_RST 2 // Reset pin
#define TFT_RD -1 // Do not define, read pin permanently connected to 3V3
// Note: All the following pins are PIO hardware configured and driven
#define TFT_WR 22
// PIO requires these to be sequentially increasing - do not change
#define TFT_D0 6
#define TFT_D1 7
#define TFT_D2 8
#define TFT_D3 9
#define TFT_D4 10
#define TFT_D5 11
#define TFT_D6 12
#define TFT_D7 13
次に、これをインクルードするために、「User_Setup_Select.h」の次の行だけ有効に。他はそのまま。
#include <User_Setups/Setup100_RP2040_ILI9488_parallel.h> // Setup file for Pico/RP2040 with 8-bit parallel ILI9488
そして、最後に
// User defined information reported by "Read_User_Setup" test & diagnostics example
#define USER_SETUP_INFO "User_Setup"
// Tell the library to use parallel mode (otherwise SPI is assumed)
#define TFT_PARALLEL_8_BIT
#define ILI9488_DRIVER // WARNING: Do not connect ILI9488 display SDO to MISO if other devices share the SPI bus (TFT SDO does NOT tristate when CS is high)
// Tell the library to use 8-bit parallel mode (otherwise SPI is assumed)
#define TFT_PARALLEL_8_BIT
// The ESP32 and TFT the pins used for testing are:
#define TFT_CS -1//27//33 // Chip select control pin (library pulls permanently low
#define TFT_DC 28//12//15 // RS Data Command control pin - must use a pin in the range 0-31
#define TFT_RST 2//33//32 // Reset pin, toggles on startup
#define TFT_WR 22//14// 4 // Write strobe control pin - must use a pin in the range 0-31
#define TFT_RD -1//32// 0 // Read strobe control pin
#define TFT_D0 6//23//12 // Must use pins in the range 0-31 for the data bus
#define TFT_D1 7//19//13 // so a single register write sets/clears all bits.
#define TFT_D2 8//18//26 // Pins can be randomly assigned, this does not affect
#define TFT_D3 9//26//25 // TFT screen update performance.
#define TFT_D4 10// 5//17
#define TFT_D5 11// 4//16
#define TFT_D6 12// 0//27
#define TFT_D7 13//15//14
(見にくくてごめんなさい。ESP32用のPIN番号も残してあります。)
TFT_PARALLEL_8_Bitの定義が2か所にありますし、ピンの定義が「Setup100_RP2040_ILI9488_parallel.h」とダブってます、さらにコンパイル時に「TOUCH_CS pin not defined」のWarningも出ますが、まあいいかな、動きますし。
【追記】久し振りにやってみたところ、動かなかったので見直しました。
Setup100_RP2040_ILI9488_parallel.h 内の記述を次にように
#define TFT_CS -1 // Do not define, chip select control pin permanently connected to 0V
#define TFT_RD -1 // Do not define, read pin permanently connected to 3V3
有効化し、
TFT-LCD ILI9488モジュール | Pi Pico |
---|---|
TFT_CS(LCD_CS) | GND |
TFT_RD(LCD_RD) | 3V3(OUT) |
と接続し動作を確認しました。
最後まで見ていただきありがとうございます。