retro-go icon indicating copy to clipboard operation
retro-go copied to clipboard

esp32s3 white screen

Open SzaboPeterBence1 opened this issue 3 months ago • 6 comments

please fix this bug.

i uploaded the code to an esp32s3, but i only get a white/sometimes grey image, sometimes the hourglass appears very incorrectly.

i'm using a 240x320 ili9241 display.

i bought a bunch of parts for this and now it doesn't work.

Here is the debug i got, maybe it helps:

[debug] STACK:5264, HEAP:294+8178 (256+8064), BUSY:0%, FPS:50 (50+0+0), BATT:1324 ESP-ROM:esp32s3-20210327 Build:Mar 27 2021 rst:0x1 (POWERON),boot:0x8 (SPI_FAST_FLASH_BOOT) SPIWP:0xee mode:DIO, clock div:1 load:0x3fce3808,len:0x1494 load:0x403c9700,len:0xe60 load:0x403cc700,len:0x3060 entry 0x403c9970 I (24) boot: ESP-IDF v4.4.8-dirty 2nd stage bootloader I (24) boot: compile time 20:03:23 I (25) boot: Multicore bootloader I (27) boot: chip revision: v0.2 I (31) qio_mode: Enabling default flash chip QIO I (36) boot.esp32s3: Boot SPI Speed : 80MHz I (41) boot.esp32s3: SPI Mode : QIO I (46) boot.esp32s3: SPI Flash Size : 16MB I (51) boot: Enabling RNG early entropy source... I (56) boot: Partition Table: I (60) boot: ## Label Usage Type ST Offset Length I (67) boot: 0 nvs WiFi data 01 02 00009000 00004000 I (74) boot: 1 otadata OTA data 01 00 0000d000 00002000 I (82) boot: 2 phy_init RF data 01 01 0000f000 00001000 I (89) boot: 3 launcher OTA app 00 10 00010000 000f0000 I (97) boot: 4 retro-core OTA app 00 11 00100000 000f0000 I (104) boot: 5 prboom-go OTA app 00 12 001f0000 000d0000 I (112) boot: 6 gwenesis OTA app 00 13 002c0000 00100000 I (119) boot: 7 fmsx OTA app 00 14 003c0000 000a0000 I (127) boot: End of partition table I (131) esp_image: segment 0: paddr=00010020 vaddr=3c0a0020 size=2f634h (194100) map I (169) esp_image: segment 1: paddr=0003f65c vaddr=3fc97bf0 size=009bch ( 2492) load I (170) esp_image: segment 2: paddr=00040020 vaddr=42000020 size=9d260h (643680) map I (272) esp_image: segment 3: paddr=000dd288 vaddr=3fc985ac size=031cch ( 12748) load I (275) esp_image: segment 4: paddr=000e045c vaddr=40374000 size=13be8h ( 80872) load I (301) boot: Loaded app from partition at offset 0x10000 I (301) boot: Disabling RNG early entropy source...

======================================================== launcher 1.45-3-g70770-dirty (Sep 25 2025 20:00:10) built for: ESP32S3-DEVKIT-C. type: dev

[info] rg_storage_init: Looking for SD Card using SDSPI... E (846) sdmmc_sd: sdmmc_init_spi_crc: sdmmc_send_cmd_crc_on_off returned 0x106 E (846) vfs_fat_sdmmc: sdmmc_card_init failed (0x106). [error] rg_storage_init: Storage mounting failed! err=0x106 [info] rg_input_init: Initializing ADC gamepad driver... [info] rg_input_init: Initializing GPIO gamepad driver... [info] rg_input_init: Initializing ADC battery driver... [info] rg_input_init: Input ready. state=00000000 00000000 [error] rg_storage_read_file: Fopen failed (2): '/sd/retro-go/config/global.json' [error] rg_storage_read_file: Fopen failed (2): '/sd/retro-go/config/boot.json' [info] rg_display_init: Initialization... [error] rg_storage_read_file: Fopen failed (2): '/sd/retro-go/config/launcher.json' [info] rg_alloc: SIZE=2560, CAPS=DMA|8BIT, PTR=0x3fceb0c0 [info] rg_alloc: SIZE=2560, CAPS=DMA|8BIT, PTR=0x3fcebac4 [info] rg_alloc: SIZE=2560, CAPS=DMA|8BIT, PTR=0x3fcec4c8 [info] rg_alloc: SIZE=2560, CAPS=DMA|8BIT, PTR=0x3fcececc [info] rg_alloc: SIZE=2560, CAPS=DMA|8BIT, PTR=0x3fced8d0 [info] lcd_set_backlight: backlight set to 80% [info] rg_display_init: Display ready. [info] rg_alloc: SIZE=11520, CAPS=SPIRAM|8BIT, PTR=0x3d800a44 [info] rg_gui_set_language_id: Language set to: English (0) [info] rg_gui_set_font: Font set to: VeraBold 11 (height=13, scaling=1.00) [info] rg_gui_set_theme: Using built-in theme! [info] rg_audio_init: Audio ready. sink='Ext DAC', samplerate=32000, volume=50 [error] rg_storage_read_file: Fopen failed (2): '/sd/retro-go/cache/clock.bin' [info] rg_system_load_time: Time is now: Thu Sep 25 12:59:49 2025

[info] rg_system_init: Available memory: 294/380 + 8178/8189 [info] rg_system_init: Retro-Go ready.

SzaboPeterBence1 avatar Sep 25 '25 20:09 SzaboPeterBence1

Image Here is my sd card reader

SzaboPeterBence1 avatar Sep 27 '25 16:09 SzaboPeterBence1

The fact that the display is sometimes corrupted might suggest a bus conflict maybe? It's hard to say what why the sd card init fails with 0x106 otherwise.

You can try enabling debug logging in esp-idf, it should tell you which exact step fails. In your target's sdkconfig find the "Log output" section and replace it with:

CONFIG_LOG_DEFAULT_LEVEL_NONE=n
CONFIG_LOG_DEFAULT_LEVEL_ERROR=n
CONFIG_LOG_DEFAULT_LEVEL_WARN=n
CONFIG_LOG_DEFAULT_LEVEL_INFO=n
CONFIG_LOG_DEFAULT_LEVEL_DEBUG=y
CONFIG_LOG_DEFAULT_LEVEL_VERBOSE=n
CONFIG_LOG_DEFAULT_LEVEL=4
CONFIG_LOG_COLORS=y

You will have to rg_tool.py clean for it to apply. It will also make the binary a lot larger, you might have to rebuild/reflash an entire image for the partition table to be adjusted.

Can you also share your config.h? Maybe you have a problematic gpio or SPI peripheral assignment that would be easy to spot.

ducalex avatar Oct 02 '25 19:10 ducalex

here is my config.h:

// 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 1 // 0 = Disable, 1 = Enable

// Video #define RG_SCREEN_DRIVER 0 // 0 = ILI9341/ST7789 #define RG_SCREEN_HOST SPI2_HOST #define RG_SCREEN_SPEED SPI_MASTER_FREQ_10M // SPI_MASTER_FREQ_80M #define RG_SCREEN_BACKLIGHT 1 #define RG_SCREEN_WIDTH 320 #define RG_SCREEN_HEIGHT 240 #define RG_SCREEN_ROTATE 0 #define RG_SCREEN_VISIBLE_AREA {0, 0, 0, 0} #define RG_SCREEN_SAFE_AREA {0, 0, 0, 0} #define RG_SCREEN_INIT()
ILI9341_CMD(0xCF, 0x00, 0xc3, 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, 0x1B); /* Power control //VRH[5:0] /
ILI9341_CMD(0xC1, 0x12); /
Power control //SAP[2:0];BT[3:0] /
ILI9341_CMD(0xC5, 0x32, 0x3C); /
VCM control /
ILI9341_CMD(0xC7, 0x91); /
VCM control2 /
ILI9341_CMD(0x36, 0x68); /
Memory Access Control (MX|MV|BGR) /
ILI9341_CMD(0xB1, 0x00, 0x10); /
Frame Rate Control (1B=70, 1F=61, 10=119) /
ILI9341_CMD(0xB6, 0x0A, 0xA2); /
Display Function Control /
ILI9341_CMD(0xF6, 0x01, 0x30);
ILI9341_CMD(0xF2, 0x00); /
3Gamma Function Disable /
ILI9341_CMD(0x26, 0x01); /
Gamma curve selected */
ILI9341_CMD(0xE0, 0x0F, 0x31, 0x2B, 0x0C, 0x0E, 0x08, 0x4E, 0xF1, 0x37, 0x07, 0x10, 0x03, 0x0E, 0x09, 0x00);
ILI9341_CMD(0xE1, 0x00, 0x0E, 0x14, 0x03, 0x11, 0x07, 0x31, 0xC1, 0x48, 0x08, 0x0F, 0x0C, 0x31, 0x36, 0x0F);

// Input // Refer to rg_input.h to see all available RG_KEY_* and RG_GAMEPAD_*_MAP types #define RG_GAMEPAD_ADC_MAP {
{RG_KEY_DOWN, ADC_UNIT_1, ADC_CHANNEL_5, ADC_ATTEN_DB_11, 3072, 4096},
{RG_KEY_LEFT, ADC_UNIT_1, ADC_CHANNEL_6, ADC_ATTEN_DB_11, 1024, 3071},
{RG_KEY_UP, ADC_UNIT_1, ADC_CHANNEL_5, ADC_ATTEN_DB_11, 1024, 3071},
{RG_KEY_RIGHT, ADC_UNIT_1, ADC_CHANNEL_6, ADC_ATTEN_DB_11, 3072, 4096},
} #define RG_GAMEPAD_GPIO_MAP {
{RG_KEY_SELECT, .num = GPIO_NUM_16, .pullup = 1, .level = 0},
{RG_KEY_START, .num = GPIO_NUM_17, .pullup = 1, .level = 0},
{RG_KEY_MENU, .num = GPIO_NUM_18, .pullup = 1, .level = 0},
{RG_KEY_OPTION, .num = GPIO_NUM_8, .pullup = 1, .level = 0},
{RG_KEY_A, .num = GPIO_NUM_45, .pullup = 1, .level = 0},
{RG_KEY_B, .num = GPIO_NUM_5, .pullup = 1, .level = 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_37 #define RG_GPIO_SDSPI_MOSI GPIO_NUM_11 #define RG_GPIO_SDSPI_CLK GPIO_NUM_36 #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

I'll try lowering #define RG_SCREEN_SPEED SPI_MASTER_FREQ to 10M to see if that solves it, because it didn't work at higher frequencies either.

SzaboPeterBence1 avatar Oct 02 '25 19:10 SzaboPeterBence1

I thought if nothing else solves the problem I would try an SDMMC SD card breakout.

SzaboPeterBence1 avatar Oct 02 '25 20:10 SzaboPeterBence1

I'm not anything obviously wrong, you're not using reserved pins and there doesn't seem to be any conflict.

Is the image still distorted when you disconnect the SD Card board entirely?

You could try SDMMC indeed, it might work!

ducalex avatar Oct 10 '25 17:10 ducalex

Hello,

Finally I couldn't get it to work with an SPI SD reader, I bought an SDMMC SD reader, but that didn't work either. Finally I made my own SD card reader from an SD adapter, and it works perfectly, even at 40 MHz. I've attached the schematic.

Image

SzaboPeterBence1 avatar Nov 12 '25 06:11 SzaboPeterBence1