Skip to content

Shaik0Ayman/ESP-FPGA-SIM

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ESP-FPGA-SIM

ESP-FPGA-SIM is a tiny educational tool that pretends your ESP32 is an FPGA so you don't have to buy an actual FPGA to learn digital logic (cus we are broke). It serves a web UI, accepts simple VHDL-like concurrent assignments, evaluates logic rules, and toggles GPIOs accordingly.

This README has two personalities:

  • The easy route (Arduino): "be a good boy" — use Arduino IDE or PlatformIO, and everything will mostly just work.
  • The i know my shit route (ESP-IDF + FreeRTOS): "suffer a little" — more power, more control, and the joy of wrestling with esp_netif and gpio_config_t bitmasks at 2 AM With 3 white Monsters worth of caffine.

Pick your Path and I'll guide you.

Quick facts

  • SoftAP SSID: ESP32_FPGASim
  • SoftAP password: 12345678
  • Websocket endpoint (Arduino sketch): /ws
  • Upload rules API: POST /updateLogic with JSON { "rules": [{"output": 19, "expression": "(A&B)|!C"}, ...] }

Files you care about

  • ESP32_LogicSim.ino — Arduino sketch (easy mode)
  • esp-idf/ — native ESP-IDF port (hard mode, includes main/ with main.cpp, LogicEngine.h, PinMap.h, WebInterface.h)
  • LogicEngine.h — expression parser/evaluator
  • PinMap.h — change inputs (A..G) and outputs here
  • WebInterface.h / webpage/ — the web UI (embedded strings and local editable copy)

Pins (defaults — change them in PinMap.h if you like pain-free reconfiguration)

  • Inputs A..G: 26, 27, 25, 33, 32, 35, 34
  • Outputs: 19, 18, 5, 17, 16, 4, 0, 2

Watch out: some pins are input-only or affect boot. If you set an output on a boot pin you will learn the meaning of the word "brick".

Operators supported (translator and evaluator)

  • AND → &
  • OR → |
  • XOR → ^
  • NOT → !
  • NAND → ~&
  • NOR → ~|
  • XNOR → ~^

Example VHDL (paste into the UI):

P19 <= (A and B) or not C;
P18 <= A xor B;

How to use — Arduino (the "good boy" route)

  1. Open the .ino in Arduino IDE or import into PlatformIO.
  2. Make sure you have these libraries installed: ESPAsyncWebServer, AsyncTCP, ArduinoJson.
  3. Build and flash to ESP32.
  4. Connect to WiFi SSID ESP32_FPGASim (pw 12345678) and open http://192.168.4.1/.

This path is fast, forgiving, and ideal if you want to hack VHDL → logic without wrestling with SDK internals.

How to use — ESP-IDF + FreeRTOS (the "suffer a little" route)

  1. Install ESP-IDF. Follow the official guide: https://docs.espressif.com/projects/esp-idf/en/latest/esp32/get-started/
  2. Open PowerShell and initialize the ESP-IDF environment (use the export.bat or the PowerShell shortcut provided by the installer).
  3. From this repo, change into esp-idf/ and run these commands:
cd '~\ESP-FPGA-SIM\esp-idf'
idf.py set-target esp32
idf.py menuconfig
idf.py build
idf.py -p <PORT> flash monitor

Replace <PORT> with your serial port (COMx). If you enjoy debugging, leave out the -p and stare at the logs until you feel enligh.

Notes about the ESP-IDF port

  • The native port uses esp_http_server and cJSON (no Arduino core required).
  • The web UI is embedded in main/WebInterface.h so you can flash a single binary and be done.
  • The client will attempt WebSocket for live pin updates but falls back to polling /pins if needed.

Which should you pick?

  • Want fast iteration, familiar APIs, and to avoid RTOS headaches? Use Arduino. Be a good boy.
  • Want more control, lower-level networking, and the joy of explicit init sequences? Use ESP-IDF and join the suffering club.

Troubleshooting quick hits

  • If the page doesn't update live, check the websocket or /pins polling endpoint.
  • If outputs don't change, inspect serial logs and make sure your rules uploaded successfully.
  • If flashing fails, double-check pin usage: avoid using boot-changing pins as outputs during development.

Want me to help? I can:

  • Move the web UI to LittleFS so you can edit JS/CSS without rebuilding.
  • Add a native WebSocket server for push updates.
  • Run a static scan and fix compile errors in the ESP-IDF port.

If you want the comfy chair and instant gratification, go Arduino. If you want to feel like a systems engineer and earn your bragging rights, go ESP-IDF. Either way, you'll end up with blinking LEDs and maybe a slightly bruised ego.

LMFAOOO

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors