I’ve created a custom PCB for a purpose-built USB gamepad with the ESP32-S2 specifically the S2fh2 variant. I was unable to find a existing board configuration using this variant built into PlatformIO, so I modified an existing board.json to create a custom board with the appropriate changes. I thought that was all I needed to do to get running, unfortunately, that was not the case. All I’m getting from my chip is repeated RTC_SW_SYS_RST
resets before entering my sketch. When the flash is wiped I get invalid header: 0xffffffff
over serial. After discussing with Copilot these symptoms don’t seem to indicate a hardware issue(I only trust Copilot so much so would appreciate some input). Also, I can’t halt the CPU immediately at reset over JTAG. In addition, I’m very outa my depth when it comes to configuring boards and would appreciate some help.
my github repo of the project if you want a more in depth look at the project: github.com/mickdassive/drone_sim_controler
contents of bustom board file esp32-s2fh2
{
"name": "Custom ESP32-S2FH2 Board",
"url": "https://google.com",
"vendor": "custom",
"build": {
"arduino": {
"ldscript": "esp32_out.ld"
},
"core": "esp32",
"extra_flags": "-DCUSTOM_BOARD",
"f_cpu": "240000000L",
"f_flash": "40000000L",
"flash_mode": "dio",
"mcu": "esp32s2",
"variant": "esp32s2"
},
"connectivity": [
"wifi",
"bluetooth",
"ethernet",
"can"
],
"debug": {
"openocd_board": "esp32s2.cfg"
},
"frameworks": [
"arduino",
"espidf"
],
"upload": {
"flash_size": "2MB",
"maximum_ram_size": 327680,
"maximum_size": 2097152,
"require_upload_port": true,
"speed": 460800
}
}
contents of my platformio.ini
; PlatformIO Project Configuration File
;
; Build options: build flags, source filter
; Upload options: custom upload port, speed and extra flags
; Library options: dependencies, extra library storages
; Advanced options: extra scripting
;
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html
[env:esp32-s2]
platform = espressif32
board = esp32-s2fh2
board_upload.flash_size=2MB
framework = arduino
monitor_speed = 115200
upload_speed = 921600
build_flags =
lib_deps =
adafruit/Adafruit TinyUSB Library@^3.5.0
lib_archive = false
debug_tool = jlink
debug_init_break =
debug_server =
openocd
-f
board/esp32s2-kaluga-1.cfg