moononournation / arduino-nofrendo

Clone from source http://www.baisoku.org/nofrendo-2.0pre1.zip
Other
81 stars 37 forks source link

Can't start game on SD Card #3

Closed Sampozzo closed 1 year ago

Sampozzo commented 3 years ago

Hello, thank you for your great project i have big fun with it!! My problem is that games can't start from SD card, SPIFFS is ok.

I did a little menu at boot to select the game, it show in console that i can read from SD card, but if i try to start a game the esp32 crashes and reboot.

I used your suggested pins and configuration in hw_config.h:

#define FILESYSTEM_BEGIN SPIClass spi = SPIClass(HSPI); spi.begin(14, 2, 15, 13); SD.begin(13, spi, 8000000, FSROOT); FS filesystem = SD;

Your can see in console that the roms can be listed:

`[D][esp32-hal-psram.c:47] psramInit(): PSRAM enabled [E][esp32-hal-cpu.c:115] removeApbChangeCallback(): not found func=400EC25C arg=3FFBEE08 /fs/1942.nes
/fs/Tetris.nes
/fs/Arkanoid.nes /fs/Galaga.nes
_my_malloc: 256 at src\sound.c:27 _my_malloc: 980 at .pio\libdeps\az-delivery-devkit-v4\arduino-nofrendo\src\bitmap.c:48 video driver: Simple DirectMedia Layer at 256x240 _my_malloc: 15 at .pio\libdeps\az-delivery-devkit-v4\arduino-nofrendo\src\nofrendo.c:242 [W][sd_diskio.cpp:101] sdWait(): Wait Failed [E][sd_diskio.cpp:123] sdSelectCard(): Select Failed Guru Meditation Error: Core 1 panic'ed (LoadProhibited). Exception was unhandled.
Core 1 register dump: PC : 0x400ebfd8 PS : 0x00060330 A0 : 0x800e53d0 A1 : 0x3ffb1830
A2 : 0x00000000 A3 : 0x3ffb1899 A4 : 0x00000006 A5 : 0x00000040
A6 : 0x00000010 A7 : 0xffffffc9 A8 : 0x00000002 A9 : 0x00000001 A10 : 0x00000000 A11 : 0x00000000 A12 : 0x00000000 A13 : 0x00000001
A14 : 0xff000000 A15 : 0x00000000 SAR : 0x00000004 EXCCAUSE: 0x0000001c EXCVADDR: 0x00000000 LBEG : 0x4008b9a5 LEND : 0x4008b9b5 LCOUNT : 0xfffffffd

ELF file SHA256: 0000000000000000

Backtrace: 0x400ebfd8:0x3ffb1830 0x400e53cd:0x3ffb1850 0x400e8f62:0x3ffb1870 0x400e919c:0x3ffb18c0 0x400e92bd:0x3ffb18f0 0x40124226:0x3ffb1930 0x40122be6:0x3ffb1950 0x40124b19:0x3ffb1990 0x40127e63:0x3ffb19c0 0x4000bdbb:0x3ffb19e0 0x4008b5c9:0x3ffb1a00 0x4008b586:0x3ffb1a20 0x40105c76:0x3ffb1a40 0x40105ce9:0x3ffb1a70 0x400d53c9:0x3ffb1a90 0x400d3339:0x3ffb1ef0 0x400d650f:0x3ffb1f10 0x400d183d:0x3ffb1f40 0x400d6497:0x3ffb1f60 0x400d1236:0x3ffb1f80 0x400ecd71:0x3ffb1fb0 0x4008d6aa:0x3ffb1fd0

Rebooting...`

I'm using an ESP32-WROOVER-B with 8mb spram and 4mb flash. SPIFFS works great even with big roms.

Any idea?

Thank you again.

Sampozzo commented 3 years ago

I forget to mention that i ported your Arduino IDE example to platform.io, but it doesn't work on Arduino iDE too.

Sampozzo commented 3 years ago

Hello, someone can help me on this?

Sampozzo commented 3 years ago

I solved my problem removing the SD part in hw_config.h and in the main file on top::

#define SD_CLK 14
#define SD_MISO 2
#define SD_MOSI 15
#define SD_CS 13
SPIClass spiSD(HSPI);

in setup:

//FILESYSTEM_BEGIN

  SPI.end(); 
  spiSD.begin(SD_CLK, SD_MISO, SD_MOSI, SD_CS);
  if (!SD.begin(SD_CS, spiSD))
  {
    Serial.println("Card Mount Failed");`
}
 else
  {
    Serial.println("Card Mount Successful");
  }
  File root = SD.open("/");

I don't know why this works for me. I hope this helps someone with my same problem.

linkov commented 2 years ago

@Sampozzo Can you please share your project, I added M5Stack_TreeView to choose rom and now I get this after I select ROM:


--- Miniterm on /dev/cu.usbserial-01B9087E  9600,8,N,1 ---
--- Quit: Ctrl+C | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H ---
��l����ה����J9�!Ϊ��eS��P�VƗ�)��%/�);\�����/h�]9�!�rnI�)���9��H/���/!@�!�㩻�I)!�զr����k��)/9)]!�X�)�L@�^l!LŹ��L��L���4 Jl�9��Uљ���Z��sU��Cwe��)%  �-B����S���BWC�\�L��C��En�9�!.�!�B���
�
�9LAJ!�)))��
            ^��դ�ↄ
--- exit ---
Sampozzo commented 2 years ago

Hi @linkov i shared a little project based on arduino-nofredo ready for paltform.io. It loads a game from spiffs, but it is simple to use SD too, i will share and example as soon as i can.

You can find it here: https://github.com/ZioTester/NESP32 Sorry but blog post is in italian language.

linkov commented 2 years ago

@Sampozzo hey, figured it out, thanks for your support! :D . You can check the repo here: https://github.com/FvnctionHQ/m5stack-nes