Giter Club home page Giter Club logo

openmc's Introduction

OpenMC

PROJECT IS A WORK IN PROGRESS, PIN ASSIGNMENTS MAY CHANGE
Pins last changed in commit on August 15th 2021

So what is it ?

This project uses an ESP32 connected to a SDHC sdcard to emulate a PSX memory card. The ESP's Wifi capabilities can be used to upload memory card images via a basic web interface. An optional oled screen can be connected to display some informations.

PCB in the works

A PCB is in the works that will rely on Heltec's Wifi Kit 32 and a few additional components and will connect to the console via the memory card port.

Software setup

  1. Follow this guide to setup the ESP-IDF SDK : https://docs.espressif.com/projects/esp-idf/en/latest/esp32/get-started/index.html
  2. Clone this repo : git clone https://github.com/johnbaumann/OpenMC
  3. In the 'OpenMC' directory, open a terminal and setup environnment variables
  4. Connect your ESP32 and type idf.py build to compile the project.
  5. Type idf.py -p PORT [-b BAUD] flash to upload the binary to your ESP board (Make sure you change PORT to your actual com port).

You can check the serial monitor to make sure the boot process is correct using idf.py -p PORT monitor

Common errors

  • Certificate error at compilation time : espressif/esp-idf#5322 (comment)
  • Message about frequency mismatch (26Mhz vs 40Mhz) :
    Change XTAL frequency with idf.py menuconfig :
    Component config โ€“> ESP32-specific โ€“> Main XTAL frequency to 40 Mhz
    or set CONFIG_ESP32_XTAL_FREQ_40=y in the project's sdkconfig file.

The filesystem currently only supports ANSI encoded filenames, and the OLED display driver only supports the standard ASCII set.

Wifi :

The default mode is Wifi Access Point. The Wifi mode, SSID, and PSK settings can be loaded from the SD card via config.txt in the root directory.

Configuration :

An example config.txt is included in this repository, modify this and copy to the root directory of your FAT32 formatted SD card. Three settings are required to be considered a valid config: mode, ssid, and password Valid settings for mode: ap, client ssid should be between 1-32 characters password should be either 0 characters(leave blank for open auth), or a password 7-63 characters long PSK 64 digit hex passwords are not currently supported

SD card :

If no SD card is found, the web server will fail to start. A single file ram filesystem may be added down the road.

The default .mc file is currently hardcoded :

sprintf(loaded_file_path, "%s/default.mc", base_path);

https://github.com/enMC/blob/master/src/storage/storage.cc#L106

Accessing the web interface

You can access the web interface via your web browser by enterring the IP of the ESP on your local network. In AP mode, the default ip is 192.168.4.1.

From there, you can browse the content of the filesystem and upload new files it.

Hardware setup

Breadboarding

Needed hardware

  • A PSX
  • An ESP32 board (e.g : Heltec's Wifi kit 32, Nodemcu ESP32S V.1.1, etc. )
  • An SDHC sd card + SD card adapter
  • A 0.96" oled SPI screen (e.g : SD1306)
  • A breadboard with dupont wires

Connecting the ESP to the SD Card (SPI Mode)

Pinout

SDcard adapter
ESP32 to SDHC

SD card pins ESP32 gpio Pull-up Resistor
1 CS GPIO 5
2 DI GPIO 23 / MOSI 10K to 4 VDD
3 GND GND
4 VDD 3.3V
5 CLK/SCK GPIO 18
7 DO GPIO 19 / MISO 10K to 4 VDD

SD card pinout : https://pinouts.ru/Memory/sdcard_pinout.shtml

Connecting the ESP to the oled

Heltec Oled pinout

ESP32 gpio OLED pin
GND GND
3.3V VCC
GPIO 15 SCL
GPIO 4 SDA
GPIO 16 RST
GPIO 21 Backlight

The default gpio configuration is for Heltec's Wifi Kit 32 which has an integrated oled display.

If using a different devboard and oled screen (e.g ; a standalone SD1306 module), you might not have a RST and Backlight line to connect, in which case you should comment out l.16-17 in src/pins.h to reflect that. You should also edit the GPIO_NUM_X values to reflect your devboard's pinout.

// OLED
const gpio_num_t kOLEDPin_SDA = GPIO_NUM_4;        // Serial Data 
const gpio_num_t kOLEDPin_SCL = GPIO_NUM_15;       // Serial Clock
//const gpio_num_t kOLEDPin_RST = GPIO_NUM_16;       // Reset
//const gpio_num_t kOLEDPin_Backlight = GPIO_NUM_21; // Backlight control
// OLED

You should then comment out the code making use of those ; in src/oled/ssd1306.cc, l.504 to 508

// Reset OLED
//~ gpio_set_direction(kOLEDPin_RST, GPIO_MODE_OUTPUT);
//~ gpio_set_level(kOLEDPin_RST, 0);
//~ vTaskDelay(pdMS_TO_TICKS(100));
//~ gpio_set_level(kOLEDPin_RST, 1);

in src/main.cc, l. 72 to 75 :

// Reset OLED
//~ gpio_set_direction(kOLEDPin_RST, GPIO_MODE_OUTPUT);
//~ gpio_set_level(kOLEDPin_RST, 0);
//~ vTaskDelay(pdMS_TO_TICKS(100));
//~ gpio_set_level(kOLEDPin_RST, 1);

Nodemcu ESP32S 1.1 pins

If using the Nodemcu ESP32S 1.1 devkit, you should use those pins :

ESP32S gpio OLED pin
GND GND
3.3V VCC
GPIO 22 SCL
GPIO 21 SDA

src/pins.h :

// OLED
const gpio_num_t kOLEDPin_SDA = GPIO_NUM_21;        // Serial Data
const gpio_num_t kOLEDPin_SCL = GPIO_NUM_22;       // Serial Clock

Connecting the ESP to the Playstation

The ESP is connected to the PSX via a memory card/pad port, either via a salvaged memory card motherboard or a butchered PSX pad cable.

Memory card + header

PSX pad cable

ESP32 gpio PSX SIO pin
32 1 DATA
34 2 CMND
GND 4 GND
35 6 ATT
39 7 CLK
33 9 ACK

Be mindful that ACK is pin 9 on both the memory card and pad ports, but ACK is the 8th pin of the memory card port whereas it is the 9th pin of the pad slot.

_________________________
|       |       |       |
| 9 7 6 | 5 4 3 |  2 1  | CARD
|_______|_______|_______|
 _______________________
|       |       |       |
| 9 8 7 | 6 5 4 | 3 2 1 | PAD
 \______|_______|______/

PSX SIO pinout : https://psx-spx.consoledev.net/pinouts/#pinouts-controller-ports-and-memory-card-ports

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.