Unable to call pinMode on esp32-s3

I am having issues calling pinMode. I am adding some Serial.println’s and the board is very obvisouly rebooting after calling pinMode.

Im very confused why pinMode is failing, and not sure how to debug. I’ve tried setting different pins then the ones in the code below but its no better

just as a little side note, I have a different sketch that successfully controlls an lcd screen over i2c using an adafruit library.

my code:

#include <Arduino.h>
void setup() {
  Serial.begin(115200);
  Serial.println("before pinMode");
  pinMode(42, OUTPUT);
  pinMode(41, OUTPUT);
  pinMode(40, OUTPUT);
  pinMode(39, OUTPUT);
  pinMode(38, OUTPUT);
  pinMode(37, OUTPUT);
}
void loop() {
  Serial.println("we loopin");
}

my platformio.ini:

[env:esp32-s3-devkitc-1]
platform = espressif32
board = esp32-s3-devkitc-1
framework = arduino
board_upload.flash_size = 16MB
board_build.partitions = default_16MB.csv
build_flags = 
    -DBOARD_HAS_PSRAM 
    -mfix-esp32-psram-cache-issue
board_build.arduino.memory_type = opi_opi

I am using this board: ESP32­-S3­-DevKitC-1 - ESP32-S3-WROOM-2 [32MB Flash 8MB PSRAM] : ID 5364 : Adafruit Industries, Unique & fun DIY electronics and kits

well I got lucky and found this right after that helped me pick some different pins. Not sure why the original ones wont work but whatever I guess

Also, I’d recommend not wastingn performance with -mfix-esp32-psram-cache-issue

  • that’s a flag to work around a silicon errata on a different chip. It’s simply not necessary on the S3.

Thank you for calling that out