Repository navigation
Firmware Setup
The firmware is one Arduino sketch in gatecore-firmware/. Toolchain and library
installation is covered on Installation; this page is about
building and flashing the board.
- Open
gatecore-firmware/gatecore-firmware.ino. The folder name must staygatecore-firmware; the IDE rejects a sketch whose.inofile does not match its folder. - Select ESP32S3 Dev Module under
Tools > Board. - Set these board options:
- USB CDC On Boot: Disabled
- Flash Size: 16MB (128Mb)
-
Partition Scheme: Custom (uses
partitions.csv) - PSRAM: OPI PSRAM
- Upload the sketch.
Some ESP32-S3 boards need the BOOT button held while the upload starts.
.\gatecore-firmware\uploader.ps1 -Setup
.\gatecore-firmware\uploader.ps1 -Port COM5 -File gatecore-firmware\gatecore-firmware.ino
.\gatecore-firmware\uploader.ps1 -Port COM5 -File gatecore-firmware\gatecore-firmware.ino -Monitor
.\gatecore-firmware\uploader.ps1 -Port COM5 -MonitorOnly
.\gatecore-firmware\uploader.ps1 -List-Port can be omitted when exactly one COM port is present. -MonitorOnly
opens the monitor without compiling or uploading. The monitor defaults to
2000000 baud; -Baudrate changes it.
If PowerShell blocks the script:
powershell -ExecutionPolicy Bypass -File .\gatecore-firmware\uploader.ps1 -Port COM5 -File gatecore-firmware\gatecore-firmware.ino./gatecore-firmware/uploader.sh --setup # once
./gatecore-firmware/uploader.sh --port /dev/ttyUSB0 # build and upload
./gatecore-firmware/uploader.sh --port /dev/ttyUSB0 -m # then open the monitor
./gatecore-firmware/uploader.sh --port /dev/ttyUSB0 --monitor-only
./gatecore-firmware/uploader.sh --list # list boardsIf exactly one candidate port is present, --port can be omitted. If the
script lost its executable bit after a zip download, run
chmod +x gatecore-firmware/uploader.sh or call it as bash gatecore-firmware/uploader.sh.
Both uploaders use this FQBN:
esp32:esp32:esp32s3:FlashSize=16M,PSRAM=opi,PartitionScheme=custom
They compile and upload in two arduino-cli calls:
arduino-cli compile --fqbn "$FQBN" gatecore-firmware/gatecore-firmware.ino
arduino-cli upload -p /dev/ttyUSB0 --fqbn "$FQBN" gatecore-firmware/gatecore-firmware.inoThe FQBN does not set the monitor baud or the USB upload speed. The helpers set
the monitor to 2000000 baud separately, while arduino-cli uses the board
default for the upload. The 2000000 baud figure is the protocol/monitor speed,
not an Arduino IDE upload-speed option.
uploader.sh --setup registers the ESP32 board index, installs the core and
installs Adafruit PN532, LiquidCrystal I2C, and ArduinoJson@7.2.1. The
core and the other two libraries are not version-pinned by the script, so a
future release can change the build. The project is tested with the ESP32 core
3.x line.
The firmware uses 2000000 baud (SERIAL_BAUD in Config.h). gatecore-cli
uses the same default. If you change the constant, pass --baud (or set
RFID_BAUD) to the CLI and -Baudrate or --baud to the monitor helper.
Use the UART bridge connector. The sketch is built with USB CDC on boot disabled, so the native USB port does not carry the protocol.
| Constant | Default | Meaning |
|---|---|---|
SERIAL_BAUD |
2000000 | Serial speed |
MAX_USERS |
70000 | Database capacity |
MAX_NAME_LEN |
48 | Longest name, in UTF-8 bytes |
LCD_I2C_ADDR |
0x27 |
Change to 0x3F for the other common backpack |
NTP_GMT_OFFSET_SEC, NTP_DAYLIGHT_OFFSET_SEC
|
0, 0 | First-boot timezone; later overridden by gatecore-cli timezone
|
NTP_RESYNC_INTERVAL_MS |
6 hours | Clock resync period |
MAX_CONSECUTIVE_DENIALS |
5 | Denied badges in a row before lockout |
LOCKOUT_DURATION_MS |
30 s | Lockout length; serial commands still work |
IMPORT_IDLE_TIMEOUT_MS |
2 min | Serial silence after which an unfinished import is abandoned |
The CLI keeps matching limits in gatecore-cli/src/database.rs. If you change
MAX_NAME_LEN, MAX_USERS or the UID length, change the CLI constants too and
rebuild it. A users.bin whose header declares a different record size is
refused.
partitions.csv defines a 16 MB layout with two 1.5 MB OTA app slots, a 12 MB
LittleFS partition and a 64 KB core dump partition. Re-partitioning erases
LittleFS, so the user database starts empty. Export a backup first:
gatecore-cli export backup.binGateCore · gatecore-firmware 1.2.0 · gatecore-cli 2.0.1 · ESP32-S3 + PN532
README · Changelog · Issues · MIT License