CornN64 / nesemu

NES emulator with LCD, SD card and NES/SNES/PSX/GPIO controller
Apache License 2.0
17 stars 2 forks source link

Couldn't find rom partition! #1

Open MCU-Amateur opened 2 years ago

MCU-Amateur commented 2 years ago

Please help how to solve this issue. Thanks!

01:36:03.587 -> Showing boot menu 01:36:03.775 -> Menu selection is /spiffs/tetris.nes 01:36:03.775 -> NoFrendo start! 01:36:03.775 -> Starting main loop with file: /spiffs/tetris.nes 01:36:03.775 -> free heap after sound init: 4444584 01:36:03.822 -> Game controller initalizing 01:36:03.822 -> NES Control initated 01:36:03.822 -> free heap after input init: 4442148 01:36:03.822 -> video driver: Simple DirectMedia Layer at 486555958x240 01:36:03.822 -> vid_init done 01:36:03.822 -> vid_init done 01:36:03.916 -> PPU memory allocated and cleared 01:36:03.916 -> Couldn't find rom partition! 01:36:03.916 -> abort() was called at PC 0x401054f2 on core 1 01:36:03.916 -> 01:36:03.916 -> ELF file SHA256: 0000000000000000 01:36:03.916 -> 01:36:03.916 -> Backtrace: 0x4008e000:0x3ffb1de0 0x4008e279:0x3ffb1e00 0x401054f2:0x3ffb1e20 0x400e57cf:0x3ffb1e40 0x400e1686:0x3ffb1e60 0x400e1a5f:0x3ffb1e90 0x400d76ba:0x3ffb1ee0 0x400e296b:0x3ffb1f10 0x400e29e3:0x3ffb1f50 0x400e28b9:0x3ffb1f70 0x400d1d77:0x3ffb1f90 0x400e3ea1:0x3ffb1fb0 0x4008f24e:0x3ffb1fd0 01:36:03.916 -> 01:36:03.916 -> Rebooting...

CornN64 commented 2 years ago

I am not sure why your boot looks different (like no sound init and lots more ram available after heap is freed also vid_init done twice?) Did you use the ESP V1.04 board manager when compiling? here is my boot text for reference

Menu selection is /spiffs/SnowB.nes NoFrendo start! Starting main loop with file: /spiffs/SnowB.nes Finished initializing sound free heap after sound init: 232436 Game controller initalizing NES Control initated free heap after input init: 230000 vid_init done PPU memory allocated and cleared partition type = 0. partition subtype = 17. partition starting address = 150000. partition size = 140000. partition label = app1. partition encrypted = 0. Reading rom from /spiffs/SnowB.nes Loaded/Verified 262160 ROM bytes mapped on EEPROM area Initialized. ROM @ 0x3f420000 Head: 0x3f420000 (4e 45 53 1a) SRAM Present Timer install 60Hz

MCU-Amateur commented 2 years ago

Hi, thanks for reply. First of all, I had disabled "//#define CONFIG_SOUND_ENABLED" because I had no idea what sound module in your project. 2nd, I am using ESP32 wrover which has 4MB PSRAM built-in. I enabled PSRAM, that is why my free RAM is high. I tried to disabled PSRAM, the problem still the same "Couldn't find rom partition!". My ESP32 module keep rebooting infinitely which show

12:32:22.383 -> system type unknown, playing nofrendo NES intro. 12:32:22.477 -> PPU memory allocated and cleared 12:32:22.477 -> Couldn't find rom partition! 12:32:22.477 -> abort() was called at PC 0x401054f2 on core 1 12:32:22.477 -> 12:32:22.477 -> ELF file SHA256: 0000000000000000 12:32:22.477 -> 12:32:22.477 -> Backtrace: 0x4008e000:0x3ffb1de0 0x4008e279:0x3ffb1e00 0x401054f2:0x3ffb1e20 0x400e57cf:0x3ffb1e40 0x400e1686:0x3ffb1e60 0x400e1a5f:0x3ffb1e90 0x400d76ba:0x3ffb1ee0 0x400e296b:0x3ffb1f10 0x400e29e3:0x3ffb1f50 0x400e28b9:0x3ffb1f70 0x400d1d77:0x3ffb1f90 0x400e3ea1:0x3ffb1fb0 0x4008f24e:0x3ffb1fd0 12:32:22.477 -> 12:32:22.477 -> Rebooting...

I had no idea why "vid_init done" init twice. My NES ROM in spiffs has no problem which I downloaded from https://www.emulatorgames.net/download/ and has been used with other ESP32 NES emulator with no problem. Please help to check if my config.ini has any problem below. Can help to double the project code you had uploaded here has any problem? I had also disabled all the control hardware at prior. (I don't have any hardware yet). Thanks!

//Config file for ESP32 NES emulator Corn 2020

pragma GCC optimize ("O2")

pragma once

//Setting FreeRTOS sheduler to 300Hz

define CONFIG_FREERTOS_HZ 300

//LCD screen & video constants

define LCD_TYPE_ILI 0

define LCD_TYPE_ST 1

define SCREEN_WIDTH 320

define SCREEN_HEIGHT 240

define NES_WIDTH 256

define NES_HEIGHT 240

define NES_VIS_LINES 224 //This number impacts SPI transfers to the LCD

//Define Display type ILI9341 (currently only ILI9341 works)

define CONFIG_HW_LCD_TYPE LCD_TYPE_ILI

// NTSC timing defaults if PAL not defined //#define PAL

//Define to skip menu //#define SKIP_MENU

// Sound Settings, Note: Do not assign anything else to pins 25 or 26, those are used by I2S //#define CONFIG_SOUND_ENABLED

//LCD SPI transfer clock rate. With short leads to the display it is possible to run the display at 80MHz however here you can opt to run it slower //#define LCD_SPI_CLOCK_RATE SPI_MASTER_FREQ_80M //80MHz (If enable 80M, my ili9341 screen did not show anything)

define LCD_SPI_CLOCK_RATE SPI_MASTER_FREQ_40M //40MHz

//If defined it allows selection in the menu to scale/stretch frame (X axis only) to full screen (with artifacts in scrolling games). //It will also be slightly slower with stretch screen enabled due to more data needs to be sent over SPI to the LCD //0 -> defaults to not stretched, 1 -> defaults to stretched

define FULL_SCREEN 1

//If defined then screen interpolation is bilinear instead of nerest neighborhor sampling (looks better but uses a little more CPU) //This only works in CPU mode and in interlaced mode for the moment //Speedy implementation idea from the guys hacking the game and watch console processing all 3 color componets at once //almost like vector processing

define BILINEAR

// If defined it will run the SPI transfer to the LCD as a separate task and the value indicates which CPU core 0(faster with volatiles) or 1(faster with OS_SEMAPHORE)

define RUN_VIDEO_AS_TASK 0

// If defined it will use OS semafores (which seems slower!?) else use simple volatile variables to pass info between tasks //#define USE_OS_SEMAPHORES

// If defined rotate display 180 deg

define ROTATE_LCD_180

// Use DMA to transfer to screen if defined else use CPU (DMA and CPU are about equally fast...) //#define USE_SPI_DMA

// Turn on various debugging options //#define NOFRENDO_DEBUG //#define MEMORY_DEBUG //#define MAPPER_DEBUG //#define SHOW_SPI_TRANSFER_TIME //in micro seconds //#define SHOW_RENDER_VIDEO_TIME //in micro seconds

//Define and it will directly boot the ROM from the list //#define BOOT_ROM 0

// LCD Settings using VSPI bus // LCD pin mapping

define CONFIG_HW_LCD_RESET_GPIO -1

define CONFIG_HW_LCD_CS_GPIO 15

define CONFIG_HW_LCD_DC_GPIO 4

define CONFIG_HW_LCD_MOSI_GPIO 13

define CONFIG_HW_LCD_CLK_GPIO 14

define CONFIG_HW_LCD_MISO_GPIO 12

define CONFIG_HW_LCD_BL_GPIO -1

// SD card pin mapping //#define CONFIG_SD_CARD

define CONFIG_SD_CS 21

define CONFIG_SD_MOSI 13

define CONFIG_SD_SCK 14

define CONFIG_SD_MISO 12

//---------------------------------- //Enable only one controller type!!! //----------------------------------

// NES input pin mapping // __ //DATA |o o| NC //LATCH |o o| NC //CLOCK |o o/ 3V3 //GND |o/ //

define CONFIG_HW_CONTROLLER_NES //Define to use NES controller

define CONFIG_HW_NES_DAT -1 // # MISO

define CONFIG_HW_NES_LATCH -1 // # CS

define CONFIG_HW_NES_CLK -1 // # CLK

// SNES input pin mapping // _ //3V3 |o| //CLOCK |o| //LATCH |o| //DATA |o| // |-| //NC |o| //NC |o| //GND |o| // - // //#define CONFIG_HW_CONTROLLER_SNES //Define to use SNES controller

define CONFIG_HW_SNES_DAT -1 // # MISO

define CONFIG_HW_SNES_LATCH -1 // # CS

define CONFIG_HW_SNES_CLK -1 // # CLK

// PSX input pin mapping //#define CONFIG_HW_CONTROLLER_PSX //Define to use PSX controller

define CONFIG_HW_PSX_DAT -1 // # DATA/MISO

define CONFIG_HW_PSX_CMD -1 // # CMD/MOSI

define CONFIG_HW_PSX_ATT -1 // # ATT

define CONFIG_HW_PSX_CLK -1 // # CLK

// GPIO pin mapping (raw button input) //#define CONFIG_HW_CONTROLLER_GPIO //Define to use GPIO pins on the ESP32

define CONFIG_HW_GPIO_START -1

define CONFIG_HW_GPIO_SELECT -1

define CONFIG_HW_GPIO_UP -1

define CONFIG_HW_GPIO_DOWN -1

define CONFIG_HW_GPIO_LEFT -1

define CONFIG_HW_GPIO_RIGHT -1

define CONFIG_HW_GPIO_B -1

define CONFIG_HW_GPIO_A -1

define CONFIG_HW_GPIO_MENU -1 //Also referred to as Button 2

define CONFIG_HW_GPIO_POWER -1 //Also referred to as Button 1

define CONFIG_HW_GPIO_TURBO_A -1

define CONFIG_HW_GPIO_TURBO_B -1

CornN64 commented 2 years ago

You can safely enable audio. It can be connected directly to an analog amplifier (with the filter shown in the ascII drawing) to drive speakers. Other than that I do not have a WROVER chip, I used a WROOM. Changing some of the hardware specific pins for SPI interfaces will most likely not work since it relies on the hardware to make the transfers work. what about? -> #define CONFIG_SD_CARD Are you running on the internal EEPROM or on SD card? You will need to provide the ROMs in either case and setup the text file accordingly...

MCU-Amateur commented 2 years ago

Thanks for reply again.

  1. Tried with ESP32 WROOM module (without PSRAM) - Problem still same. (I had 2 versions on hand)
  2. Already enabled sound (#define CONFIG_SOUND_ENABLED) - Problem still same.
  3. Tried with SPI pins (18, 19, 23, 5) - Problem still same.
  4. Tried with SDCard. Success to read from sdcard. - Problem still same.
  5. Currently using SPIFFS. Copied roms.txt and smb1.nes into data folder and upload to SPIFFS (ESP32 sketch data upload using Arduino IDE) - Problem still same.

I think the problem may be due to the library src/nes_rom.c itself. Please advice. Thanks!

17:57:15.073 -> Game controller initalizing 17:57:15.073 -> NES Control initated 17:57:15.073 -> Init SPI bus 17:57:15.073 -> Init SPI bus completed 17:57:15.073 -> Adding screen device 17:57:15.073 -> Adding screen completed 17:57:15.073 -> E (189) gpio: gpio_set_direction(236): GPIO number error 17:57:15.073 -> E (194) gpio: gpio_set_level(178): GPIO output gpio_num error 17:57:15.119 -> E (233) gpio: gpio_set_level(178): GPIO output gpio_num error 17:57:15.119 -> LCD ILI9341 initialization. 17:57:15.166 -> LCD initialization complete. 17:57:15.213 -> Start boot menu init 17:57:15.213 -> Reading rom list 17:57:15.213 -> ROM[1] icon[;] name[Tetris] file[tetris.nes] 17:57:15.213 -> Found 1 ROMs 17:57:15.213 -> Finished boot menu init 17:57:15.213 -> No errors, carry on 17:57:15.213 -> Showing boot menu 17:57:15.401 -> Menu selection is /spiffs/tetris.nes 17:57:15.401 -> NoFrendo start! 17:57:15.401 -> Starting main loop with file: /spiffs/tetris.nes 17:57:15.401 -> Finished initializing sound 17:57:15.401 -> free heap after sound init: 247480 17:57:15.401 -> Game controller initalizing 17:57:15.401 -> NES Control initated 17:57:15.448 -> free heap after input init: 245044 17:57:15.448 -> video driver: Simple DirectMedia Layer at 486555958x240 17:57:15.448 -> vid_init done 17:57:15.448 -> vid_init done 17:57:15.541 -> system type unknown, playing nofrendo NES intro. 17:57:15.541 -> PPU memory allocated and cleared 17:57:15.635 -> Couldn't find rom partition! 17:57:15.635 -> abort() was called at PC 0x401049ca on core 1 17:57:15.635 -> 17:57:15.635 -> ELF file SHA256: 0000000000000000 17:57:15.635 -> 17:57:15.635 -> Backtrace: 0x40089f0c:0x3ffb1de0 0x4008a189:0x3ffb1e00 0x401049ca:0x3ffb1e20 0x400e484b:0x3ffb1e40 0x400e08a6:0x3ffb1e60 0x400e0ca8:0x3ffb1e90 0x400d715c:0x3ffb1ee0 0x400e1abc:0x3ffb1f10 0x400e1b2d:0x3ffb1f50 0x400e1a17:0x3ffb1f70 0x400d1e4b:0x3ffb1f90 0x400e2f11:0x3ffb1fb0 0x4008b1aa:0x3ffb1fd0 17:57:15.635 -> 17:57:15.635 -> Rebooting...

CornN64 commented 2 years ago

Assuming that WROOM and WROVER are compatible (all tho I think that WROVER uses some of its pins to connect to the PSRAM which might influence things for the worse). From what I can tell it seems to have troubles opening the file system on either spiffs or the SD card, so maybe try some example that lists the SD card to get things running there first... the other tip is to make sure you use Arduino 1.8.13 and maybe more importantly ESPlib 1.04... I know newer versions had caused problems in other projects

MCU-Amateur commented 2 years ago

Thanks for fast reply again.

  1. ESP32 board library is v1.04. - Problem still the same.
  2. Read from sdcard. Confirmed can read from SDcard. Exactly same error. "Couldn't find rom partition!" - Problem still the same.

Conclusion. - Give up.......