Trying to use Serial and Serial2 on ESP32 S3

My project uses ESP32-S3-WROOM-1 Soc with a USB C port connected to D+ and D-. The Serial2 out put is connected to a RS485 interface.

My problem is I can send/receive data on ether port but not both at the same time.
in platformio.ini if I use

board= = adafruit_feather_esp32s3

I can use Serial but not Serial2.

if I use

board = esp32-s3-devkitc-1

I can write to Serial2 but not Serial.

I can upload my program with both options.

I have tested this with a simple program to do alternate writes to Serial and Serial2

Any hints as to why this is?

; 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

; writes to Serial but not Serial 2
board = adafruit_feather_esp32s3

; writes to Serial2 but not Serial
;board = esp32-s3-devkitc-1

platform = espressif32@^6.1.0
framework = arduino

board_build.mcu = esp32s3
board_build.f_cpu = 240000000L
board_build.f_flash = 80000000L
board_build.flash_mode = dio


board_flags =
;    -mfix-esp32-psram-cache-issue

monitor_speed = 115200
upload_port = /dev/ttyACM0

program file

include <HardwareSerial.h>

/* Pin assignments for RS485 communication */
#define RxPin 16
#define TxPin 17
#define RXENB 37

// led info lights
#define BLUELED_PIN 7
#define REDLED_PIN 6

void RedLED(bool value)
  digitalWrite(REDLED_PIN, value);

void BlueLED(bool value)
  digitalWrite(BLUELED_PIN, value);

void Flash(uint8_t number, uint16_t On, int pin)
  for(int i = number; i > 0; i--)
    digitalWrite(pin, HIGH);
    digitalWrite(pin, LOW);

unsigned char TxEnablePin = 37;

void setup() 
  String sBuff;
  //File tFile;  

  Serial2.begin(9600, SERIAL_8N1, RX, TX);

  pinMode(TxEnablePin, OUTPUT);
  digitalWrite(TxEnablePin, HIGH);  // set tx mode

  Flash(1, 2000, BLUELED_PIN);
  Serial.println("Setup finished");

char frame[30];

void loop()

  Flash(1, 50, BLUELED_PIN);
  Flash(1, 50, REDLED_PIN);


According to

it looks like you have a typo here:

Shouldn’t it be
Serial2.begin(9600, SERIAL_8N1, RxPin, TxPin);

It’s always the obvious things, thanks for pointing it out. Mostly sorted - the Adafruit feather board now works.
The esp32 S3 devkitc still won’t write to Serial.

The ESP32-S3-DevKitC-1 comes with 2 ports.
One of them is connected to the internal USB the other is connected to an USB to Serial chip and then to the UART pins of the ESP32.

When the USB-CDC-MODE is enabled, all Serial.print statements are routed to the native USB port on the ESP32 and Serial0 is routed to the UART pins (means the other USB-Port which is connected via USB to UART chip).