Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ESP32S3 Devkitc and 2.8 320x240 ILI9341 - problem #186

Open
kazz2020 opened this issue Feb 23, 2025 · 5 comments
Open

ESP32S3 Devkitc and 2.8 320x240 ILI9341 - problem #186

kazz2020 opened this issue Feb 23, 2025 · 5 comments

Comments

@kazz2020
Copy link

kazz2020 commented Feb 23, 2025

I try to make this work on esp32s3 devkitc (44 pin version) and ili9341 display (with integrated sd card slot). This is my config
`// Target definition
#define RG_TARGET_NAME "ESP32S3-DEVKIT-C"

// Storage
#define RG_STORAGE_ROOT "/sd"
#define RG_STORAGE_SDSPI_HOST SPI3_HOST
#define RG_STORAGE_SDSPI_SPEED SDMMC_FREQ_DEFAULT
// #define RG_STORAGE_SDMMC_HOST SDMMC_HOST_SLOT_1
// #define RG_STORAGE_SDMMC_SPEED SDMMC_FREQ_DEFAULT
// #define RG_STORAGE_FLASH_PARTITION "vfs"

// Audio
#define RG_AUDIO_USE_INT_DAC 0 // 0 = Disable, 1 = GPIO25, 2 = GPIO26, 3 = Both
#define RG_AUDIO_USE_EXT_DAC 0 // 0 = Disable, 1 = Enable

// Video
#define RG_SCREEN_DRIVER 0 // 0 = ILI9341
#define RG_SCREEN_HOST SPI2_HOST
#define RG_SCREEN_SPEED SPI_MASTER_FREQ_26M // Close to TFT_eSPI's 27MHz
#define RG_SCREEN_BACKLIGHT 1
#define RG_SCREEN_WIDTH 320
#define RG_SCREEN_HEIGHT 240
#define RG_SCREEN_ROTATE 0
#define RG_SCREEN_MARGIN_TOP 0
#define RG_SCREEN_MARGIN_BOTTOM 0
#define RG_SCREEN_MARGIN_LEFT 0
#define RG_SCREEN_MARGIN_RIGHT 0
#define RG_SCREEN_INIT()
gpio_set_level(RG_GPIO_LCD_RST, 0); /* Hardware reset - LOW /
vTaskDelay(pdMS_TO_TICKS(20)); /
Wait 20ms /
gpio_set_level(RG_GPIO_LCD_RST, 1); /
Hardware reset - HIGH /
vTaskDelay(pdMS_TO_TICKS(120)); /
Wait 120ms /
ILI9341_CMD(0xCF, 0x00, 0xC1, 0x30);
ILI9341_CMD(0xED, 0x64, 0x03, 0x12, 0x81);
ILI9341_CMD(0xE8, 0x85, 0x00, 0x78);
ILI9341_CMD(0xCB, 0x39, 0x2C, 0x00, 0x34, 0x02);
ILI9341_CMD(0xF7, 0x20);
ILI9341_CMD(0xEA, 0x00, 0x00);
ILI9341_CMD(0xC0, 0x10); /
Power Control 1 /
ILI9341_CMD(0xC1, 0x00); /
Power Control 2 /
ILI9341_CMD(0xC5, 0x30, 0x30); /
VCM Control /
ILI9341_CMD(0xC7, 0xB7); /
VCM Control 2 /
ILI9341_CMD(0x3A, 0x55); /
Pixel Format /
ILI9341_CMD(0x36, 0x08); /
Memory Access Control /
ILI9341_CMD(0xB1, 0x00, 0x1A); /
Frame Rate Control /
ILI9341_CMD(0xB6, 0x08, 0x82, 0x27); /
Display Function Control /
ILI9341_CMD(0xF2, 0x00); /
3Gamma Function Disable /
ILI9341_CMD(0x26, 0x01); /
Gamma curve selected /
ILI9341_CMD(0xE0, 0x0F, 0x2A, 0x28, 0x08, 0x0E, 0x08, 0x54, 0xA9, 0x43, 0x0A, 0x0F, 0x00, 0x00, 0x00, 0x00);
ILI9341_CMD(0xE1, 0x00, 0x15, 0x17, 0x07, 0x11, 0x06, 0x2B, 0x56, 0x3C, 0x05, 0x10, 0x0F, 0x3F, 0x3F, 0x0F);
ILI9341_CMD(0x2B, 0x00, 0x00, 0x01, 0x3F); /
Page Address Set /
ILI9341_CMD(0x2A, 0x00, 0x00, 0x00, 0xEF); /
Column Address Set /
ILI9341_CMD(0x11); /
Sleep Out /
vTaskDelay(pdMS_TO_TICKS(120)); /
Delay 120ms /
ILI9341_CMD(0x29); /
Display ON /
vTaskDelay(pdMS_TO_TICKS(120)); /
Wait for display to stabilize /
gpio_set_level(RG_GPIO_LCD_BCKL, 1); /
Turn on backlight */

// Input
// Refer to rg_input.h to see all available RG_KEY_* and RG_GAMEPAD_*_MAP types

#define RG_GAMEPAD_GPIO_MAP {
{RG_KEY_SELECT, GPIO_NUM_16, GPIO_PULLUP_ONLY, 0},
{RG_KEY_START, GPIO_NUM_17, GPIO_PULLUP_ONLY, 0},
{RG_KEY_MENU, GPIO_NUM_18, GPIO_PULLUP_ONLY, 0},
{RG_KEY_OPTION, GPIO_NUM_8, GPIO_PULLUP_ONLY, 0},
{RG_KEY_A, GPIO_NUM_2, GPIO_PULLUP_ONLY, 0},
{RG_KEY_B, GPIO_NUM_5, GPIO_PULLUP_ONLY, 0},
}

// Battery
#define RG_BATTERY_DRIVER 1
#define RG_BATTERY_ADC_UNIT ADC_UNIT_1
#define RG_BATTERY_ADC_CHANNEL ADC_CHANNEL_3
#define RG_BATTERY_CALC_PERCENT(raw) (((raw) * 2.f - 3500.f) / (4200.f - 3500.f) * 100.f)
#define RG_BATTERY_CALC_VOLTAGE(raw) ((raw) * 2.f * 0.001f)

// Status LED
#define RG_GPIO_LED GPIO_NUM_38

// SPI Display (back up working)
#define RG_GPIO_LCD_MISO GPIO_NUM_14
#define RG_GPIO_LCD_MOSI GPIO_NUM_12
#define RG_GPIO_LCD_CLK GPIO_NUM_48
#define RG_GPIO_LCD_CS GPIO_NUM_15
#define RG_GPIO_LCD_DC GPIO_NUM_47
#define RG_GPIO_LCD_BCKL GPIO_NUM_39
#define RG_GPIO_LCD_RST GPIO_NUM_3

#define RG_GPIO_SDSPI_MISO GPIO_NUM_9
#define RG_GPIO_SDSPI_MOSI GPIO_NUM_11
#define RG_GPIO_SDSPI_CLK GPIO_NUM_13
#define RG_GPIO_SDSPI_CS GPIO_NUM_10

// External I2S DAC
#define RG_GPIO_SND_I2S_BCK 41
#define RG_GPIO_SND_I2S_WS 42
#define RG_GPIO_SND_I2S_DATA 40
// #define RG_GPIO_SND_AMP_ENABLE 18
`
this pin configuration works perfect with tft_espi library but here i have white screen. This is setup for tft_espi

`

// User defined information reported by "Read_User_Setup" test & diagnostics example
#define USER_SETUP_INFO "User_Setup"

#define ILI9341_2_DRIVER // Alternative ILI9341 driver, see Bodmer/TFT_eSPI#1172

#define TFT_MISO 14
#define TFT_MOSI 12
#define TFT_SCLK 48
#define TFT_CS 15 // Chip select control pin
#define TFT_DC 47 // Data Command control pin
#define TFT_RST 3 // Reset pin (could connect to RST pin)
//#define TFT_RST -1 // Set TFT_RST to -1 if display RESET is connected to ESP32 board RST

#define LOAD_GLCD // Font 1. Original Adafruit 8 pixel font needs ~1820 bytes in FLASH
#define LOAD_FONT2 // Font 2. Small 16 pixel high font, needs ~3534 bytes in FLASH, 96 characters
#define LOAD_FONT4 // Font 4. Medium 26 pixel high font, needs ~5848 bytes in FLASH, 96 characters
#define LOAD_FONT6 // Font 6. Large 48 pixel font, needs ~2666 bytes in FLASH, only characters 1234567890:-.apm
#define LOAD_FONT7 // Font 7. 7 segment 48 pixel font, needs ~2438 bytes in FLASH, only characters 1234567890:-.
#define LOAD_FONT8 // Font 8. Large 75 pixel font needs ~3256 bytes in FLASH, only characters 1234567890:-.
//#define LOAD_FONT8N // Font 8. Alternative to Font 8 above, slightly narrower, so 3 digits fit a 160 pixel TFT
#define LOAD_GFXFF // FreeFonts. Include access to the 48 Adafruit_GFX free fonts FF1 to FF48 and custom fonts

// Comment out the #define below to stop the SPIFFS filing system and smooth font code being loaded
// this will save ~20kbytes of FLASH
#define SMOOTH_FONT

// ##################################################################################
//
// Section 4. Other options
//

// #define SPI_FREQUENCY 1000000
// #define SPI_FREQUENCY 5000000
// #define SPI_FREQUENCY 10000000
// #define SPI_FREQUENCY 20000000
#define SPI_FREQUENCY 27000000
// #define SPI_FREQUENCY 40000000
// #define SPI_FREQUENCY 55000000 // STM32 SPI1 only (SPI2 maximum is 27MHz)
// #define SPI_FREQUENCY 80000000

// Optional reduced SPI frequency for reading TFT
#define SPI_READ_FREQUENCY 20000000

// The XPT2046 requires a lower SPI clock rate of 2.5MHz so we define that here:
#define SPI_TOUCH_FREQUENCY 2500000

// The ESP32 has 2 free SPI ports i.e. VSPI and HSPI, the VSPI is the default.
// If the VSPI port is in use and pins are not accessible (e.g. TTGO T-Beam)
// then uncomment the following line:
#define USE_HSPI_PORT`

any clue why my code domnt work on retr-go?

@goshansp
Copy link

goshansp commented Feb 23, 2025

I may have the same issue on a very similar setup. Are you getting nothing on the display besides the backlight as I do? My ILI9341 stays white and does not change. Even during resets there is no change to the display. I am on a ESP32-S3 n16r8 and testing with esp-idf/example it works. I have noticed support for esplay-s3 to be broken

EDIT: I got my display to do something. As I tried the _INIT from ESP32S3-DEVKIT-C instead of the _INIT from ESPLAY-S3 and now the display shows something!

@kazz2020
Copy link
Author

kazz2020 commented Feb 24, 2025

I may have the same issue on a very similar setup. Are you getting nothing on the display besides the backlight as I do? My ILI9341 stays white and does not change. Even during resets there is no change to the display. I am on a ESP32-S3 n16r8 and testing with esp-idf/example it works. I have noticed support for esplay-s3 to be broken

EDIT: I got my display to do something. As I tried the _INIT from ESP32S3-DEVKIT-C instead of the _INIT from ESPLAY-S3 and now the display shows something!

I use esp32s3devkit example but I see only white screen. I have same setup as You . Can you share your config? maybe there is something different.

@kazz2020
Copy link
Author

why in config.h file for esp32s3-devkitc-1 example we have
#define RG_GPIO_LCD_CS GPIO_NUM_NC
#define RG_GPIO_LCD_RST GPIO_NUM_3
??
GPIO3 for esp32s3 devkitc-1 is strapping pin?
CS pin shouldnt be connected?

@goshansp
Copy link

goshansp commented Feb 24, 2025

FYI: @kazz2020 this is the config where I managed to get screen output working.

@kazz2020
Copy link
Author

FYI: @kazz2020 this is the config where I managed to get screen output working.

Doesn't work for me. I don't get it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants