ESP32-S3-WROOM-1 loses CDC serial port when starting SPI

mathijs
Posts: 1
Joined: Mon May 15, 2023 6:37 pm

ESP32-S3-WROOM-1 loses CDC serial port when starting SPI

Postby mathijs » Mon May 15, 2023 7:04 pm

Hi,

I've created a custom board using an ESP32-S3-WROOM-1 which is connected to a Wiznet W6100 chip over SPI. The ESP32S3 is connected to USB over pins 13/14 (GPIO19/GPIO20). I can flash the chip without problems.

The W6100 in SPI mode is connected to the following pins:
18 (GPIO10): chip select
19 (GPIO11): MOSI
20 (GPIO12): SCLK
21 (GPIO13): MISO

Every time I try to connect to the SPI device, the ESP32S3 loses its serial connection. Rebooting in the bootloader restores the connection. Changing the pins to input / output manually gives the same result.

Simplest version which crashes right after

Code: Untitled.c Select all

Serial.println("Setting VSPI_SCK"):

Code: main.cpp Select all


#include <Arduino.h>
#include <SPI.h>

#define VSPI_SCK 19
#define VSPI_MISO 21
#define VSPI_MOSI 20
#define VSPI_SS 18

void setup() {
Serial.begin(115200);
Serial.println("Starting");

Serial.println("Setting VSPI_SS");
pinMode(VSPI_SS, OUTPUT); //HSPI SS
Serial.println("Setting VSPI_SCK");
delay(1000);
pinMode(VSPI_SCK, OUTPUT); //HSPI SS
Serial.println("Setting VSPI_MISO");
delay(1000);
pinMode(VSPI_MISO, INPUT); //HSPI SS
Serial.println("Setting SS");
delay(1000);
pinMode(VSPI_MISO, OUTPUT); //HSPI SS
Serial.println("Init ethernet");
}

void loop() {}
My platformio project:

Code: platformio.ini Select all


[env:esp32-s3-custom]
platform = espressif32
board = custom_pcb
board_build.arduino.memory_type = dio_opi
framework = arduino
monitor_speed = 115200
build_flags =
-D PIO_FRAMEWORK_ARDUINO_ENABLE_CDC
-D USBCON
-DCORE_DEBUG_LEVEL=5
-DBOARD_HAS_PSRAM
-mfix-esp32-psram-cache-issue
lib_ldf_mode = deep+
lib_deps =
https://github.com/WIZnet-ArduinoEthernet/Ethernet.git
adafruit/Adafruit NeoPixel@^1.11.0
and the board definition:

Code: custom_pcb.json Select all


{
"build": {
"arduino": {
"ldscript": "esp32s3_out.ld",
"partitions": "default_8MB.csv",
"memory_type": "qio_opi"
},
"core": "esp32",
"extra_flags": [
"-DBOARD_HAS_PSRAM",
"-DARDUINO_USB_MODE=1",
"-DARDUINO_USB_CDC_ON_BOOT=1"
],
"f_cpu": "240000000L",
"f_flash": "80000000L",
"flash_mode": "qio",
"hwids": [
[
"0x303A",
"0x1001"
]
],
"mcu": "esp32s3",
"variant": "esp32s3"
},
"connectivity": [
"wifi"
],
"debug": {
"openocd_target": "esp32s3.cfg"
},
"frameworks": [
"arduino",
"espidf"
],
"name": "custom_pcb",
"upload": {
"flash_size": "8MB",
"maximum_ram_size": 327680,
"maximum_size": 16777216,
"use_1200bps_touch": true,
"wait_for_upload_port": true,
"require_upload_port": true,
"speed": 460800
},
"url": "https://www.google.nl",
"vendor": "ME"
}
Does anyone have a clue what could cause this?

Sprite
Espressif staff
Espressif staff
Posts: 10596
Joined: Thu Nov 26, 2015 4:08 am

Re: ESP32-S3-WROOM-1 loses CDC serial port when starting SPI

Postby Sprite » Tue May 16, 2023 8:31 am

pinMode and friends take the GPIO number, not the pin number. In other words, you're reconfiguring GPIO 19 and 20 and as such losing USB.

Who is online

Users browsing this forum: Bytespider and 3 guests