Page 1 of 3
NES emulator on an ESP32
Posted: Mon Oct 10, 2016 4:35 pm
by ESP_Sprite
Here's a new thing: a NES emulator for the ESP32. It's a proof of concept, does not have sound and the display driver is kinda hackish leading to a frame rate that is slightly sub-par, but it actually is playable. Video demonstrating it and some of the reasoning around it is here:
https://youtu.be/ympmRydFMmE
The source code of the emu is here:
https://github.com/espressif/esp32-nesemu Keep in mind that it is more of a proof-of-concept than a product, and while push requests generally will be honoured, we won't be doing much more work on it.
Re: NES emulator on an ESP32
Posted: Tue Oct 11, 2016 2:25 am
by WiFive
Nice project. No homemade cap touch control pad?
Look forward to SD card drivers. Will you post schematic of devkitJ?
Re: NES emulator on an ESP32
Posted: Tue Oct 11, 2016 9:40 pm
by rudi ;-)
WiFive wrote:
Look forward to SD card drivers. Will you post schematic of devkitJ?
+1
well done, nice helpfull founds [
Move LCD driver to 2nd CPU] in your code how you have done it.
thank you for share!
best wishes
rudi
Re: NES emulator on an ESP32
Posted: Fri Jan 06, 2017 11:51 pm
by rudi ;-)
hi
cause tested with ESP32 WROVER KIT V2 ( black )
found out, that we must change a small thing.
https://github.com/espressif/esp32-nese ... _lcd.c#L53
Code: Select all
/*orig WROVER KIT 1 ( red ) Backlight active high! */
// #define LCD_BKG_ON() GPIO.out_w1ts = (1 << PIN_NUM_BCKL) // Backlight ON
// #define LCD_BKG_OFF() GPIO.out_w1tc = (1 << PIN_NUM_BCKL) //Backlight OFF
/*rudi mod 06 jan 2017 on WROVER KIT V2 ( black ) Backlight active low! */
#define LCD_BKG_OFF() GPIO.out_w1ts = (1 << PIN_NUM_BCKL) // Backlight OFF
#define LCD_BKG_ON() GPIO.out_w1tc = (1 << PIN_NUM_BCKL) //Backlight ON
txs for your great work Jeroen!
now i need a PS1/PS2 Controller
i usually do not play
so sorry for this i have not PS1/PS2 controller here
- IMG_5832_s.jpg (134.27 KiB) Viewed 33109 times
see a sequenze on twitter
best wishes
rudi
Re: NES emulator on an ESP32
Posted: Mon Jan 09, 2017 7:30 pm
by rudi ;-)
hi
Add SPI Master driver was done before few days,
and with
this few changes
if you get a compile error cause
VSPICLK_OUT_MUX_IDX,
have a note to this
best wishes
rudi
Re: NES emulator on an ESP32
Posted: Tue Jan 10, 2017 3:39 am
by a2retro
Hi Rudi, The ESP32-WROVER-KIT V2 will upload the latest code
Code: Select all
Glenn@playpen MSYS ~/src/projects/esp32-nesemu
$ make flash
/home/Glenn/src/esp-idf/make/component_common.mk:1: Deprecated feature: No longer necessary to include component_common.mk from /home/Glenn/src/projects/esp32-nesemu/main/component.mk
Flashing binaries to serial port COM8 (app at offset 0x10000)...
esptool.py v2.0-dev
Connecting...
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 921600
Changed.
Attaching SPI flash...
Configuring flash size...
Auto-detected Flash size: 4MB
Compressed 350976 bytes to 140590...
Wrote 350976 bytes (140590 compressed) at 0x00010000 in 3.0 seconds (effective 928.8 kbit/s)...
Hash of data verified.
Compressed 3072 bytes to 99...
Wrote 3072 bytes (99 compressed) at 0x00008000 in 0.0 seconds (effective 1641.4 kbit/s)...
Hash of data verified.
Leaving...
Hard resetting...
and a ROM
Code: Select all
Glenn@playpen MSYS ~/src/projects/esp32-nesemu
$ esptool.py --chip esp32 --port "COM8" --baud $((230400*4)) write_flash -fs 4MB 0x00100000 MarioBros.nes
esptool.py v2.0-dev
Connecting...
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 921600
Changed.
Attaching SPI flash...
Configuring flash size...
Wrote 32768 bytes at 0x00100000 in 0.5 seconds (547.6 kbit/s)...
Hash of data verified.
Leaving...
Hard resetting...
but when it starts i get
Code: Select all
Couldn't map rom part!
Initialized. ROM@0x20000000
Malloc: 4140 at C:/msys32/home/Glenn/src/projects/esp32-nesemu/components/nofrendo/nes/nes_rom.c:444
Head: 0x20000000 (0 c0 7e 66)
GUI: is not a valid ROM image
GUI: ROM freed
GUI: ROM not loaded
NoFrendo died? WtF?
Did I miss a step?
Glenn
Re: NES emulator on an ESP32
Posted: Tue Jan 10, 2017 5:40 am
by a2retro
Code: Select all
[23:00] <a2retro> Couldn't map rom part! err=> 258
[23:03] <Sprite_tm> That's ESP_ERR_INVALID_ARG
[00:17] <a2retro> Part => 300000
[00:17] <a2retro> Src_addr plus size greater then g_rom_flashchip.chip_size
[00:17] <a2retro> Couldn't map rom part! err=> 102
[00:18] <a2retro> 300000 is part.size
[00:19] <a2retro> ESP_ERR_INVALID_ARG returned from flash_mmap.c lines 91-92
[00:24] <a2retro> Part => 300000
[00:24] <a2retro> Src_addr 0x00100000 plus size 0x00300000 greater then g_rom_flashchip.chip_size 0x00200000
[00:24] <a2retro> Couldn't map rom part! err=> 102
[00:24] <a2retro> thats as far as i can take it for now
[00:27] <a2retro> perhaps my sdkconfig file is messed up?
[00:29] <a2retro> $ cat partitions.csv
[00:29] <a2retro> # Name, Type, SubType, Offset, Size
[00:29] <a2retro> # Note: if you change the phy_init or app partition offset, make sure to change the offset in Kconfig.projbuild
[00:29] <a2retro> nvs, data, nvs, 0x9000, 0x6000
[00:29] <a2retro> phy_init, data, phy, 0xf000, 0x1000
[00:29] <a2retro> factory, app, factory, 0x10000, 0x0E0000
[00:29] <a2retro> nesgame, 0x40, 0x01, 0x100000, 0x300000
[00:36] <a2retro> sdkconfig has 4MB for flash size
Re: NES emulator on an ESP32
Posted: Tue Jan 10, 2017 6:12 am
by ESP_Sprite
Maybe your flash size is set incorrectly? It's in make menuconfig, under 'serial flasher config'.
Re: NES emulator on an ESP32
Posted: Tue Jan 10, 2017 2:14 pm
by a2retro
Hi it is set for 4MB. I also tried a make clean and then a rebuild but no joy so far.
Re: NES emulator on an ESP32
Posted: Tue Jan 10, 2017 2:44 pm
by a2retro
So after some googling i found and old workaround from ESP_igrr that forces the flash to be setup for 4MB.
SPIParamCfg(0x1540ef, 4*1024*1024, 64*1024, 4096, 256, 0xffff);
The game finally starts now but the back-light will not come on. When I press the enable button the back-light comes on momentarily, I can see the game screen and then it resets the game.