ducalex / retro-go

Retro emulation for the ODROID-GO and other ESP32 devices
GNU General Public License v2.0
569 stars 130 forks source link

GAMES NOT LAUNCHING!!!!! #165

Closed SSStarku closed 5 days ago

SSStarku commented 2 weeks ago

SCREEN

1730554262984 1730554262974 1730554262969 1730554262962

PARTS

-Display:ILI9431 -Microcontroller: esp32s3 -SDcard: 64gb formated to FAT32 Config: default of the esp32s3devmodule + #define RG_GPIO_LCD_CS GPIO_NUM_14

To Reproduce

Steps to reproduce the behavior:

  1. Installing the .img that i build in the esp32s3 2.formating sd card 64gb to FAT32 and installing some games
  2. error message about the sd card in screen but pressing A
  3. esp32s3 detecting the games and the sd card
  4. Launching a game
  5. seeing the last error message:

unexpected behaviour

-When I turn it on I get an error telling me thet the sd is not connected -The games do not start and the machine restarts. -I keep getting an error :[error] rg_surface_load_image: PNG decoding failed: 83

SSStarku commented 2 weeks ago

1730571775613 ok now some games launch but in somes i also have new error: crash.log this one is about the proom

ducalex commented 2 weeks ago

Retro-Go requires PSRAM (external RAM) to work but it's not detected, that's what the error on your screenshot is telling you.

If your esp module doesn't have PSRAM then there's no way you will be able to run DOOM unfortunately. You might be able to run smaller ROMs in some of the emulators but most will likely not work, there's just not enough memory :(

SSStarku commented 2 weeks ago

What is the minimum I need? Isn't an 8PSRAM enough?

Connecting...
Detecting chip type... ESP32-S3
Chip is ESP32-S3 (QFN56) (revision v0.2)
Features: WiFi, BLE, Embedded PSRAM 8MB (AP_3v3)
ducalex commented 2 weeks ago

8MB is more than enough! Then I guess it means it isn't detected during boot. The detection is done by esp-idf before retro-go starts so this is more difficult for me to help you.

Can you share your retro-go/targets/<name>/sdkconfig file?

SSStarku commented 2 weeks ago

i have used the default Fri3D Camp 2024 sdkconfig because the hardware is the same

ducalex commented 2 weeks ago

You can increase logging level, replace the "Log output" section with this:

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

You will need to run python rg_tool.py clean after any change to the sdkconfig.

Then run the new version and please share all serial output from the moment you power it on, there will hopefully be some messages about spiram/psram init failure...

pilesofspam commented 2 weeks ago

Little late to the party, but I have a similar hardware setup (esp32S3 with 16MB flash, 8MB psram), and spent some time troubleshooting. For me (on esp-idf-5.1.1), I went into each application directory (retro-core, prboom-go, etc) and ran "idf.py menuconfig". From the first screen, scrolled on down to "Component Config" and again down to "esp psram". Enable support for spiram there. Also, for your device, it's probably octal, so make sure to mark that under spi ram config.

SSStarku commented 2 weeks ago

Thanks for the answers. : ) I'm trying to fix it but I have a problem, why does it appear that I don't have an SD connected but it does recognize it?

pilesofspam commented 2 weeks ago

Just comparing notes, the first SD card I used was a Sandisk Industrial microSD 16GB and it wasn't recognized. I didn't proceed to test any further. I switched to a full size 32GB Sandisk Ultra (both of these were formatted to fat32, identical directory structure) and it works fine, no other changes and no more warnings. For the card holder, I'm using hardware similar to yours, SD card holder mounted on the LCD board.

SSStarku commented 2 weeks ago

cna you share your sdkconfig and config file? Thank you so much

pilesofspam commented 2 weeks ago

Sure, these are from ./components/targets/esp32s3-devkit-c:

config.h:

// REF: https://wiki.odroid.com/odroid_go/odroid_go

// 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
#define RG_SCREEN_HOST              SPI2_HOST
#define RG_SCREEN_SPEED             SPI_MASTER_FREQ_40M // SPI_MASTER_FREQ_80M
#define RG_SCREEN_BACKLIGHT         1
#define RG_SCREEN_WIDTH             320
#define RG_SCREEN_HEIGHT            240
#define RG_SCREEN_ROTATE            1
#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()                                                                                           \
    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, (0x60|0x08));          /* Memory Access Control  (0x20|0x80|0x08) */                       \
    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_UP,    ADC_UNIT_1, ADC_CHANNEL_5, ADC_ATTEN_DB_11, 3072, 4096},\
    {RG_KEY_RIGHT, ADC_UNIT_1, ADC_CHANNEL_6, ADC_ATTEN_DB_11, 1024, 3071},\
    {RG_KEY_DOWN,  ADC_UNIT_1, ADC_CHANNEL_5, ADC_ATTEN_DB_11, 1024, 3071},\
    {RG_KEY_LEFT,  ADC_UNIT_1, ADC_CHANNEL_6, ADC_ATTEN_DB_11, 3072, 4096},\
}
#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_15, 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_NC

// SPI Display (back up working)
#define RG_GPIO_LCD_MISO            GPIO_NUM_NC
#define RG_GPIO_LCD_MOSI            GPIO_NUM_12
#define RG_GPIO_LCD_CLK             GPIO_NUM_48
#define RG_GPIO_LCD_CS              GPIO_NUM_NC
#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

sdkconfig (from the same place, it's obviously different in each project dir)

#
# Serial flasher config
#
CONFIG_ESPTOOLPY_PORT="/dev/ttyUSB0"
CONFIG_ESPTOOLPY_BAUD_115200B=n
CONFIG_ESPTOOLPY_BAUD_230400B=n
CONFIG_ESPTOOLPY_BAUD_921600B=y
CONFIG_ESPTOOLPY_BAUD_2MB=n
CONFIG_ESPTOOLPY_BAUD=921600
CONFIG_ESPTOOLPY_COMPRESSED=y
CONFIG_ESPTOOLPY_FLASHMODE="dio"
CONFIG_ESPTOOLPY_FLASHFREQ_80M=y
CONFIG_ESPTOOLPY_FLASHFREQ_40M=n
CONFIG_ESPTOOLPY_FLASHFREQ_26M=n
CONFIG_ESPTOOLPY_FLASHFREQ_20M=n
CONFIG_ESPTOOLPY_FLASHFREQ="80m"
CONFIG_ESPTOOLPY_FLASHSIZE_1MB=n
CONFIG_ESPTOOLPY_FLASHSIZE_2MB=n
CONFIG_ESPTOOLPY_FLASHSIZE_4MB=n
CONFIG_ESPTOOLPY_FLASHSIZE_8MB=n
CONFIG_ESPTOOLPY_FLASHSIZE_16MB=y
CONFIG_ESPTOOLPY_FLASHSIZE="16MB"
CONFIG_ESPTOOLPY_FLASHSIZE_DETECT=y
CONFIG_ESPTOOLPY_FLASHMODE_QIO=y

#
# Compiler options
#
CONFIG_COMPILER_OPTIMIZATION_DEFAULT=n
CONFIG_COMPILER_OPTIMIZATION_SIZE=y
# IMPORTANT: ENABLE=y adds almost 50K to the executable, can't fit in our current 2.5MB goal...
CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_ENABLE=n
CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_SILENT=y
CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_DISABLE=n
CONFIG_COMPILER_CXX_EXCEPTIONS=n
CONFIG_COMPILER_STACK_CHECK_MODE_NONE=y
CONFIG_COMPILER_STACK_CHECK_MODE_NORM=n
CONFIG_COMPILER_STACK_CHECK_MODE_STRONG=n
CONFIG_COMPILER_STACK_CHECK_MODE_ALL=n
CONFIG_COMPILER_STACK_CHECK=n

#
# SPI configuration
#
CONFIG_SPI_MASTER_IN_IRAM=y
CONFIG_SPI_MASTER_ISR_IN_IRAM=y

#
# ESP32-specific
#
CONFIG_ESP32_REV_MIN_0=n
CONFIG_ESP32_REV_MIN_1=y
CONFIG_ESP32_REV_MIN_2=n
CONFIG_ESP32_REV_MIN_3=n
CONFIG_ESP32_REV_MIN=1
CONFIG_ESP32_DEFAULT_CPU_FREQ_80=n
CONFIG_ESP32_DEFAULT_CPU_FREQ_160=n
CONFIG_ESP32_DEFAULT_CPU_FREQ_240=y
CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ=240
CONFIG_ESP_SYSTEM_PANIC_PRINT_HALT=n
CONFIG_ESP_SYSTEM_PANIC_PRINT_REBOOT=y
CONFIG_ESP_SYSTEM_PANIC_SILENT_REBOOT=n
CONFIG_ESP_SYSTEM_PANIC_GDBSTUB=n
CONFIG_ESP_DEBUG_OCDAWARE=n
CONFIG_ESP_MAIN_TASK_STACK_SIZE=8192
CONFIG_ESP_INT_WDT=y
CONFIG_ESP_TASK_WDT=n
CONFIG_NEWLIB_NANO_FORMAT=y

#
# SPI RAM config
#
CONFIG_ESP32_SPIRAM_SUPPORT=y
CONFIG_SPIRAM_BOOT_INIT=y
CONFIG_SPIRAM_IGNORE_NOTFOUND=y
CONFIG_SPIRAM_USE_MEMMAP=n
CONFIG_SPIRAM_USE_CAPS_ALLOC=n
CONFIG_SPIRAM_USE_MALLOC=y
CONFIG_SPIRAM_TYPE_AUTO=y
CONFIG_SPIRAM_TYPE_ESPPSRAM32=n
CONFIG_SPIRAM_TYPE_ESPPSRAM64=n
CONFIG_SPIRAM_SIZE=-1
CONFIG_SPIRAM_SPEED_40M=n
CONFIG_SPIRAM_SPEED_80M=y
CONFIG_SPIRAM_MEMTEST=y
CONFIG_SPIRAM_CACHE_WORKAROUND=n
CONFIG_SPIRAM_BANKSWITCH_ENABLE=n
#CONFIG_SPIRAM_MALLOC_ALWAYSINTERNAL=16384
#CONFIG_SPIRAM_MALLOC_RESERVE_INTERNAL=16384

CONFIG_SPIRAM_MALLOC_ALWAYSINTERNAL=32768
CONFIG_SPIRAM_MALLOC_RESERVE_INTERNAL=32768

CONFIG_SPIRAM_ALLOW_STACK_EXTERNAL_MEMORY=y
CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY=y
CONFIG_SPIRAM_OCCUPY_HSPI_HOST=n
CONFIG_SPIRAM_OCCUPY_VSPI_HOST=y
CONFIG_SPIRAM_OCCUPY_NO_HOST=n

CONFIG_SPIRAM_MODE_OCT=y
CONFIG_SPIRAM_CLK_IO=30
CONFIG_SPIRAM_CS_IO=26
CONFIG_DEFAULT_PSRAM_CLK_IO=30
CONFIG_DEFAULT_PSRAM_CS_IO=26

#
# FAT Filesystem support
#
CONFIG_FATFS_CODEPAGE_437=y
CONFIG_FATFS_CODEPAGE=437
CONFIG_FATFS_LFN_NONE=n
CONFIG_FATFS_LFN_HEAP=y
CONFIG_FATFS_LFN_STACK=n
CONFIG_FATFS_MAX_LFN=255
CONFIG_FATFS_USE_FASTSEEK=y

#
# FreeRTOS
#
CONFIG_FREERTOS_HZ=100
CONFIG_FREERTOS_CHECK_STACKOVERFLOW_NONE=n
CONFIG_FREERTOS_CHECK_STACKOVERFLOW_PTRVAL=y
CONFIG_FREERTOS_CHECK_STACKOVERFLOW_CANARY=n
CONFIG_FREERTOS_ASSERT_FAIL_ABORT=y
CONFIG_FREERTOS_ASSERT_FAIL_PRINT_CONTINUE=n
CONFIG_FREERTOS_ASSERT_DISABLE=n
CONFIG_FREERTOS_IDLE_TASK_STACKSIZE=1024
CONFIG_FREERTOS_USE_TRACE_FACILITY=n
CONFIG_FREERTOS_GENERATE_RUN_TIME_STATS=n
CONFIG_FREERTOS_CHECK_MUTEX_GIVEN_BY_OWNER=n

#
# Log output
#
CONFIG_LOG_DEFAULT_LEVEL_NONE=n
CONFIG_LOG_DEFAULT_LEVEL_ERROR=n
CONFIG_LOG_DEFAULT_LEVEL_WARN=y
CONFIG_LOG_DEFAULT_LEVEL_INFO=n
CONFIG_LOG_DEFAULT_LEVEL_DEBUG=n
CONFIG_LOG_DEFAULT_LEVEL_VERBOSE=n
CONFIG_LOG_DEFAULT_LEVEL=2
CONFIG_LOG_COLORS=y

#
# Misc
#
CONFIG_APP_BUILD_BOOTLOADER=n

#
# HTTP Server
#
CONFIG_HTTPD_MAX_REQ_HDR_LEN=1024
CONFIG_HTTPD_MAX_URI_LEN=1024

#
# TLS
#
# Not ideal but I don't want to deal with CAs right now :(
CONFIG_ESP_TLS_INSECURE=y
CONFIG_ESP_TLS_SKIP_SERVER_CERT_VERIFY=y

#
# SPI Flash driver
#
CONFIG_SPI_FLASH_ENABLE_ENCRYPTED_READ_WRITE=n

#
# Silence deprecations because I have no intention of fixing them right now
#
CONFIG_ADC_SUPPRESS_DEPRECATE_WARN=y
CONFIG_I2S_SUPPRESS_DEPRECATE_WARN=y
SSStarku commented 2 weeks ago

thanks i will try it

ducalex commented 2 weeks ago

I went into each application directory (retro-core, prboom-go, etc) and ran "idf.py menuconfig".

You just have to do this for one app and then when it's working correctly grab the sdkconfig in the current app folder and copy it to your target folder. (In fact you pretty much have to copy it, because rg_tool.py clean will wipe the apps' sdkconfig)

It might be nice to document this process better in retro-go's documentation...

SSStarku commented 2 weeks ago

Ok, I made my own sdkconfig because @pileofspam sdkconfig did not work, but this is loot and recognize the Spiram!!! and the error of the SD card has disappeared, but now I do not know why the SD card does not detect it. Can you help me? @ducalex i have this error rg_storage_init: Storage mounting failed! err=0x107 sdkconfig.txt

ducalex commented 2 weeks ago

Error 0x107 is ESP_ERR_TIMEOUT (see here for all error codes) so I guess your card doesn't respond?

Maybe it is a wiring issue? Did it work correctly with your old sdkconfig?

SSStarku commented 5 days ago

Hello, thank you very much for your help. I was able to make it work!!