Sparkfun ESP32-WROOM-32UE - upload fails - solved

I’ve just purchased a sparkfun esp32-wroom-32ue, and I’m trying to get it to work with PIO. Here’s my sketch:

#include <Arduino.h>
int ledPin = 13;
void setup() {
  pinMode(ledPin, OUTPUT);
  Serial.begin(9600);
}
void loop() {
  Serial.print("Hello");
  digitalWrite(ledPin, HIGH);
  delay(500);
  Serial.println(" world!");
  digitalWrite(ledPin, LOW);
  delay(500);
}

Works great using the Arduino-IDE. Builds fine on PIO, but when I go to deploy -

> Executing task in folder Sparkfun Thing: C:\Users\greg\.platformio\penv\Scripts\pio.exe run --target upload <

Processing sparkfun_samd51_thing_plus (platform: atmelsam; board: sparkfun_samd51_thing_plus; framework: arduino)
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/atmelsam/sparkfun_samd51_thing_plus.html
PLATFORM: Atmel SAM (5.1.1) > SparkFun SAMD51 Thing Plus
HARDWARE: SAMD51J20A 120MHz, 192KB RAM, 496KB Flash     
DEBUG: Current (atmel-ice) External (atmel-ice, jlink)  
PACKAGES:
 - framework-arduino-samd-sparkfun 1.7.5
 - framework-cmsis 1.40500.0 (4.5.0)
 - framework-cmsis-atmel 1.2.0
 - tool-bossac 1.10700.190624 (1.7.0)
 - toolchain-gccarmnoneeabi 1.70201.0 (7.2.1)
LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 8 compatible libraries
Scanning dependencies...
No dependencies
Building in release mode
Checking size .pio\build\sparkfun_samd51_thing_plus\firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [          ]   1.1% (used 2228 bytes from 196608 bytes)
Flash: [          ]   2.2% (used 10928 bytes from 507904 bytes)
Configuring upload protocol...
AVAILABLE: atmel-ice, jlink, sam-ba
CURRENT: upload_protocol = sam-ba
Looking for upload port...
Auto-detected: COM10
Forcing reset using 1200bps open/close on port COM10
Waiting for the new upload port...
Uploading .pio\build\sparkfun_samd51_thing_plus\firmware.bin

SAM-BA operation failed
*** [upload] Error 1
========================================================================================= [FAILED] Took 10.99 seconds =========================================================================================
The terminal process "C:\Users\greg\.platformio\penv\Scripts\pio.exe 'run', '--target', 'upload'" terminated with exit code: 1.

Terminal will be reused by tasks, press any key to close it.

Googling for ‘SAM-BA operation failed’ turns up very little. Any nudge in the right direction would be greatly appreciated. Thanks!

GregM

Nevermind. I’m an idiot.

When I picked from the boards, I picked ‘the first’ sparkfun thing. Didn’t realize it was a samd51 processor - my dumbness.

Created a new project, picked the sparkfun esp32, and what do you know. Works fine.