The first step is looking where it crashes. Activating the crash decoder has been discussed in multiple topics (ESP32, Arduino, Efuse, External Flash, SHA 256 error - #2 by maxgerhardt).
Add
build_type = debug
monitor_filters = esp32_exception_decoder
to the platformio.ini, upload and monitor again.