Help with Hardware Serial

I am attempting to establish a Uart connection between an ESP32C3 XIAO seeeduino and a WT901B Wit-Motion accel, gyro, etc, sensor. I ended up getting a handshake with the two being wired but when I tried implementing them with a custom PCB it doesn't work. I found the issue with the PCB, the RX and TX were not connected properly as the photo I had used for reference was mirrored and I hadn't noticed, anyways I removed the tracers and just wired them but it still isn't working. I tried different serial ports on the ESP but it just wont connect. I really don't know what the issue could be I have tried a lot and I'm not sure what I'm missing. I think it's possible its my code but I didn't change it from what it was in working condition. My code consists of parts of the Wit-Motion supplied code and a timer among a few other things. I was also running into issues with the serial monitor, after about 5-10 seconds it stops displaying anything. I ended up using puTTy for reading it but I don't know why Serial monitor isn't working.

-Upload Settings-
USB CDC on boot -enabled
CPU frequency -160MHz
Core Debug -none
Erase All Flash... -enabled
Flash Frequency -80MHz
Flash Mode -QIO (I tried DIO too but didn't make a difference)
Flash Size -4MB
Upload Speed -512000 (I tried lowering but it just changes it back)
Programmer -Epstool

Code:

#include <REG.h>
#include <wit_c_sdk.h>
#include <HardwareSerial.h>
#include <chrono>
#include <Arduino.h>

bool UP = false;
bool DOWN = false;
bool NEUTRAL = false;

bool neutralOccurred = false;

#define ACC_UPDATE		0x01
#define GYRO_UPDATE		0x02
#define ANGLE_UPDATE	0x04
#define MAG_UPDATE		0x08
#define READ_UPDATE		0x80
static volatile char s_cDataUpdate = 0, s_cCmd = 0xff; 

HardwareSerial MySerial0(0);

static void CmdProcess(void);
static void AutoScanSensor(void);
static void SensorUartSend(uint8_t *p_data, uint32_t uiSize);
static void SensorDataUpdata(uint32_t uiReg, uint32_t uiRegNum);
static void Delayms(uint16_t ucMs);
const uint32_t c_uiBaud[8] = {115200};


class Timer {
public:
    Timer() : m_running(false), m_elapsedTime(0) {}

    void start() {
        if (!m_running) {
            m_startTime = millis();
            m_running = true;
        }
    }

    void stop() {
        if (m_running) {
            m_elapsedTime += millis() - m_startTime;
            m_running = false;
        }
    }

    void reset() {
        m_elapsedTime = 0;
        m_running = false;
    }

    unsigned long getElapsedTime() const {
        if (m_running) {
            return m_elapsedTime + (millis() - m_startTime);
        } else {
            return m_elapsedTime;
        }
    }

private:
    bool m_running;
    unsigned long m_startTime;
    unsigned long m_elapsedTime; // in milliseconds
};

Timer timer;

//********************

void setup() {
  Serial.begin(9600);
  MySerial0.begin(115200, 20, 21);
	WitInit(WIT_PROTOCOL_NORMAL, 0x50);
	WitSerialWriteRegister(SensorUartSend);
	WitRegisterCallBack(SensorDataUpdata);
  WitDelayMsRegister(Delayms);
	Serial.print("\r\n********************** wit-motion normal example  ************************\r\n");
	AutoScanSensor();

}
int i;
float fAcc[3], fGyro[3], fAngle[3];
void loop() {
    
  while (MySerial0.available())
    {
      WitSerialDataIn(MySerial0.read());
    while (Serial.available())
    {
      CopeCmdData(Serial.read());
    }
    CmdProcess();
    if(s_cDataUpdate)
    {
      for(i = 0; i < 3; i++)
      {
        fAcc[i] = sReg[AX+i] / 32768.0f * 16.0f;
        fGyro[i] = sReg[GX+i] / 32768.0f * 2000.0f;
        fAngle[i] = sReg[Roll+i] / 32768.0f * 180.0f;
      }
      if(s_cDataUpdate & ACC_UPDATE)
      {
        Serial.print("acc:");
        Serial.print(fAcc[0], 3);
        Serial.print(" ");
        Serial.print(fAcc[1], 3);
        Serial.print(" ");
        Serial.print(fAcc[2], 3);
        Serial.print("\r\n");
        s_cDataUpdate &= ~ACC_UPDATE;
      }
      s_cDataUpdate = 0;
    }


    if (sqrt((fAcc[0]*fAcc[0])+(fAcc[1]*fAcc[1])+(fAcc[2]*fAcc[2])) > 1.05)
      {
        DOWN = true;
        UP = false;
        NEUTRAL = false;
        Serial.print("Down-");
      }
      if (sqrt((fAcc[0]*fAcc[0])+(fAcc[1]*fAcc[1])+(fAcc[2]*fAcc[2])) < .95)
      {
        UP = true;
        DOWN = false;
        NEUTRAL = false;
        Serial.print("Up+");
      }
      if (  (sqrt((fAcc[0]*fAcc[0])+(fAcc[1]*fAcc[1])+(fAcc[2]*fAcc[2])) < 1.05)  &&  (sqrt((fAcc[0]*fAcc[0])+(fAcc[1]*fAcc[1])+(fAcc[2]*fAcc[2])) > .95)  )
      {
        NEUTRAL = true;
        UP = false;
        DOWN = false;
        Serial.print("Neutral=");
      }
handleEvents(UP, NEUTRAL);
handleEvents2(DOWN, NEUTRAL);
Show();

    }
}


//*******************************

void handleEvents(bool UP, bool NEUTRAL) {
    static bool upDetected = false; // Flag to track if UP has been detected

    if (UP && !upDetected) {
        upDetected = true; // Set UP detected
    } else if (upDetected && NEUTRAL) {
        // If UP has been detected and NEUTRAL occurs, perform the action
        timer.stop();
        upDetected = false; // Reset UP detection
    } else if (!UP && NEUTRAL) {
        // If NEUTRAL occurs without UP, reset UP detection
        upDetected = false;
    }
}

//*******************************

void handleEvents2(bool DOWN, bool NEUTRAL) {
    static bool downDetected = false; // Flag to track if DOWN has been detected

    if (DOWN && !downDetected) {
        if (neutralOccurred) {
            // If DOWN event occurs after NEUTRAL, start the timer
            timer.reset();
        }
        downDetected = true; // Set DOWN detected
    } else if (downDetected && NEUTRAL) {
        // If DOWN has been detected and NEUTRAL occurs, perform the action
        timer.start();
        downDetected = false; // Reset DOWN detection
    }

    // Update the state of NEUTRAL event
    neutralOccurred = NEUTRAL;


}

void Show()
{
  Serial.print(timer.getElapsedTime());
  Serial.print(" , milliseconds  :   ");
  delay(50);
}

//******************************

void CopeCmdData(unsigned char ucData)
{
	static unsigned char s_ucData[50], s_ucRxCnt = 0;
	
	s_ucData[s_ucRxCnt++] = ucData;
	if(s_ucRxCnt<3)return;										//Less than three data returned
	if(s_ucRxCnt >= 50) s_ucRxCnt = 0;
	if(s_ucRxCnt >= 3)
	{
		if((s_ucData[1] == '\r') && (s_ucData[2] == '\n'))
		{
			s_cCmd = s_ucData[0];
			memset(s_ucData,0,50);
			s_ucRxCnt = 0;
		}
		else 
		{
			s_ucData[0] = s_ucData[1];
			s_ucData[1] = s_ucData[2];
			s_ucRxCnt = 2;
			
		}
	}
}

static void CmdProcess(void)
{
	switch(s_cCmd)
	{
		case 'a':	if(WitStartAccCali() != WIT_HAL_OK) Serial.print("\r\nSet AccCali Error\r\n");
			break;
		case 'm':	if(WitStartMagCali() != WIT_HAL_OK) Serial.print("\r\nSet MagCali Error\r\n");
			break;
		case 'e':	if(WitStopMagCali() != WIT_HAL_OK) Serial.print("\r\nSet MagCali Error\r\n");
			break;
		case 'u':	if(WitSetBandwidth(BANDWIDTH_5HZ) != WIT_HAL_OK) Serial.print("\r\nSet Bandwidth Error\r\n");
			break;
		case 'U':	if(WitSetBandwidth(BANDWIDTH_256HZ) != WIT_HAL_OK) Serial.print("\r\nSet Bandwidth Error\r\n");
			break;
		case 'B':	if(WitSetUartBaud(WIT_BAUD_115200) != WIT_HAL_OK) Serial.print("\r\nSet Baud Error\r\n");
              else 
              {
                MySerial0.begin(c_uiBaud[WIT_BAUD_115200]);
                Serial.print(" 115200 Baud rate modified successfully\r\n");
              }
			break;
		case 'b':	if(WitSetUartBaud(WIT_BAUD_9600) != WIT_HAL_OK) Serial.print("\r\nSet Baud Error\r\n");
              else 
              {
                MySerial0.begin(c_uiBaud[WIT_BAUD_9600]); 
                Serial.print(" 9600 Baud rate modified successfully\r\n");
              }
			break;
		case 'r': if(WitSetOutputRate(RRATE_1HZ) != WIT_HAL_OK)  Serial.print("\r\nSet Baud Error\r\n");
			        else Serial.print("\r\nSet Baud Success\r\n");
			break;
		case 'R':	if(WitSetOutputRate(RRATE_10HZ) != WIT_HAL_OK) Serial.print("\r\nSet Baud Error\r\n");
              else Serial.print("\r\nSet Baud Success\r\n");
			break;
    case 'C': if(WitSetContent(RSW_ACC|RSW_GYRO|RSW_ANGLE|RSW_MAG) != WIT_HAL_OK) Serial.print("\r\nSet RSW Error\r\n");
      break;
    case 'c': if(WitSetContent(RSW_ACC) != WIT_HAL_OK) Serial.print("\r\nSet RSW Error\r\n");
      break;
		default :break;
	}
	s_cCmd = 0xff;
}
static void SensorUartSend(uint8_t *p_data, uint32_t uiSize)
{
  MySerial0.write(p_data, uiSize);
  MySerial0.flush();
}
static void Delayms(uint16_t ucMs)
{
  delay(ucMs);
}
static void SensorDataUpdata(uint32_t uiReg, uint32_t uiRegNum)
{
	int i;
    for(i = 0; i < uiRegNum; i++)
    {
        switch(uiReg)
        {
            case AZ:
				s_cDataUpdate |= ACC_UPDATE;
            break;
            case GZ:
				s_cDataUpdate |= GYRO_UPDATE;
            break;
            case HZ:
				s_cDataUpdate |= MAG_UPDATE;
            break;
            case Yaw:
				s_cDataUpdate |= ANGLE_UPDATE;
            break;
            default:
				s_cDataUpdate |= READ_UPDATE;
			break;
        }
		uiReg++;
    }
}

static void AutoScanSensor(void)
{
	int i, iRetry;
	
	for(i = 0; i < sizeof(c_uiBaud)/sizeof(c_uiBaud[0]); i++)
	{
		MySerial0.begin(c_uiBaud[i]);
    MySerial0.flush();
		iRetry = 2;
		s_cDataUpdate = 0;
		do
		{
			WitReadReg(AX, 3);
			delay(200);
      while (MySerial0.available())
      {
        WitSerialDataIn(MySerial0.read());
      }
			if(s_cDataUpdate != 0)
			{
				Serial.print(c_uiBaud[i]);
				Serial.print(" baud find sensor\r\n\r\n");
				return ;
			}
			iRetry--;
		}while(iRetry);		
	}
	Serial.print("can not find sensor\r\n");
	Serial.print("please check your connection\r\n");
}

This is the PCB (the WT901B is getting power):

GPIO20 U0RXD and GPIO21 U0TXD are used for Serial programming/debugging
and you have specified pins 20 and 21 for

  MySerial0.begin(115200, 20, 21);

hence Serial does not work

the following code for a ESP32-C3-MINI-1 uses pins 2 and 3 for Serial1

// ESP32-C3-MINI-1 Serial1 test - for loopback test connect pins 2 and 3

// note GPIO20 U0RXD and GPIO21 U0TXD are used for Serial programming/debugging

#define RXD1 3
#define TXD1 2

void setup() {
  // initialize both serial ports:
  Serial.begin(115200);
  Serial1.begin(115200, SERIAL_8N1, RXD1, TXD1);
  Serial.println();
  Serial.println("\n\nESP32-C3 serial1  test Rx pin 3 Tx pin 2");
  Serial.write("   for loopback test connect pin 3 to pin 2\n");
}

void loop() {
  // read from port 1, send to port 0:
  if (Serial1.available()) {
    int inByte = Serial1.read();
    Serial.write(inByte);
  }

  // read from port 0, send to port 1:
  if (Serial.available()) {
    int inByte = Serial.read();
    //Serial.write(inByte);   //echo keyboard
    Serial1.write(inByte);
  }
}

connecting pins 2 and 3 to form a loopback test characters entered on Serial monitor are echoed back to the display

ESP32-C3 serial1  test Rx pin 3 Tx pin 2
   for loopback test connect pin 3 to pin 2
test 1 hello
test2 1234567890
test 3 !"£$%^&*()
test 4 abcdefghijklmnopqrstuvwxyz

could you try pins 2 and 3 for

MySerial0.begin(115200, 2, 3);

I modified it and used this

#include <REG.h>
#include <wit_c_sdk.h>
#include <HardwareSerial.h>
#include <chrono>
#include <Arduino.h>

bool UP = false;
bool DOWN = false;
bool NEUTRAL = false;

bool neutralOccurred = false;

#define ACC_UPDATE		0x01
#define GYRO_UPDATE		0x02
#define ANGLE_UPDATE	0x04
#define MAG_UPDATE		0x08
#define READ_UPDATE		0x80
static volatile char s_cDataUpdate = 0, s_cCmd = 0xff; 

HardwareSerial MySerial0(0);

static void CmdProcess(void);
static void AutoScanSensor(void);
static void SensorUartSend(uint8_t *p_data, uint32_t uiSize);
static void SensorDataUpdata(uint32_t uiReg, uint32_t uiRegNum);
static void Delayms(uint16_t ucMs);
const uint32_t c_uiBaud[8] = {4800, 9600, 19200, 38400, 57600, 115200, 230400};


class Timer {
public:
    Timer() : m_running(false), m_elapsedTime(0) {}

    void start() {
        if (!m_running) {
            m_startTime = millis();
            m_running = true;
        }
    }

    void stop() {
        if (m_running) {
            m_elapsedTime += millis() - m_startTime;
            m_running = false;
        }
    }

    void reset() {
        m_elapsedTime = 0;
        m_running = false;
    }

    unsigned long getElapsedTime() const {
        if (m_running) {
            return m_elapsedTime + (millis() - m_startTime);
        } else {
            return m_elapsedTime;
        }
    }

private:
    bool m_running;
    unsigned long m_startTime;
    unsigned long m_elapsedTime; // in milliseconds
};

Timer timer;

//********************

void setup() {
  Serial.begin(9600);
  MySerial0.begin(115200, 2, 3);
	WitInit(WIT_PROTOCOL_NORMAL, 0x50);
	WitSerialWriteRegister(SensorUartSend);
	WitRegisterCallBack(SensorDataUpdata);
  WitDelayMsRegister(Delayms);
	Serial.print("\r\n********************** wit-motion normal example  ************************\r\n");
	AutoScanSensor();

}
int i;
float fAcc[3], fGyro[3], fAngle[3];
void loop() {
    
  while (MySerial0.available())
    {
      WitSerialDataIn(MySerial0.read());
    while (Serial.available())
    {
      CopeCmdData(Serial.read());
    }
    CmdProcess();
    if(s_cDataUpdate)
    {
      for(i = 0; i < 3; i++)
      {
        fAcc[i] = sReg[AX+i] / 32768.0f * 16.0f;
        fGyro[i] = sReg[GX+i] / 32768.0f * 2000.0f;
        fAngle[i] = sReg[Roll+i] / 32768.0f * 180.0f;
      }
      if(s_cDataUpdate & ACC_UPDATE)
      {
        Serial.print("acc:");
        Serial.print(fAcc[0], 3);
        Serial.print(" ");
        Serial.print(fAcc[1], 3);
        Serial.print(" ");
        Serial.print(fAcc[2], 3);
        Serial.print("\r\n");
        s_cDataUpdate &= ~ACC_UPDATE;
      }
      s_cDataUpdate = 0;
    }


    if (sqrt((fAcc[0]*fAcc[0])+(fAcc[1]*fAcc[1])+(fAcc[2]*fAcc[2])) > 1.05)
      {
        DOWN = true;
        UP = false;
        NEUTRAL = false;
        Serial.print("Down-");
      }
      if (sqrt((fAcc[0]*fAcc[0])+(fAcc[1]*fAcc[1])+(fAcc[2]*fAcc[2])) < .95)
      {
        UP = true;
        DOWN = false;
        NEUTRAL = false;
        Serial.print("Up+");
      }
      if (  (sqrt((fAcc[0]*fAcc[0])+(fAcc[1]*fAcc[1])+(fAcc[2]*fAcc[2])) < 1.05)  &&  (sqrt((fAcc[0]*fAcc[0])+(fAcc[1]*fAcc[1])+(fAcc[2]*fAcc[2])) > .95)  )
      {
        NEUTRAL = true;
        UP = false;
        DOWN = false;
        Serial.print("Neutral=");
      }
handleEvents(UP, NEUTRAL);
handleEvents2(DOWN, NEUTRAL);
Show();

    }
}


//*******************************

void handleEvents(bool UP, bool NEUTRAL) {
    static bool upDetected = false; // Flag to track if UP has been detected

    if (UP && !upDetected) {
        upDetected = true; // Set UP detected
    } else if (upDetected && NEUTRAL) {
        // If UP has been detected and NEUTRAL occurs, perform the action
        timer.stop();
        upDetected = false; // Reset UP detection
    } else if (!UP && NEUTRAL) {
        // If NEUTRAL occurs without UP, reset UP detection
        upDetected = false;
    }
}

//*******************************

void handleEvents2(bool DOWN, bool NEUTRAL) {
    static bool downDetected = false; // Flag to track if DOWN has been detected

    if (DOWN && !downDetected) {
        if (neutralOccurred) {
            // If DOWN event occurs after NEUTRAL, start the timer
            timer.reset();
        }
        downDetected = true; // Set DOWN detected
    } else if (downDetected && NEUTRAL) {
        // If DOWN has been detected and NEUTRAL occurs, perform the action
        timer.start();
        downDetected = false; // Reset DOWN detection
    }

    // Update the state of NEUTRAL event
    neutralOccurred = NEUTRAL;


}

void Show()
{
  Serial.print(timer.getElapsedTime());
  Serial.print(" , milliseconds  :   ");
  delay(50);
}

//******************************

void CopeCmdData(unsigned char ucData)
{
	static unsigned char s_ucData[50], s_ucRxCnt = 0;
	
	s_ucData[s_ucRxCnt++] = ucData;
	if(s_ucRxCnt<3)return;										//Less than three data returned
	if(s_ucRxCnt >= 50) s_ucRxCnt = 0;
	if(s_ucRxCnt >= 3)
	{
		if((s_ucData[1] == '\r') && (s_ucData[2] == '\n'))
		{
			s_cCmd = s_ucData[0];
			memset(s_ucData,0,50);
			s_ucRxCnt = 0;
		}
		else 
		{
			s_ucData[0] = s_ucData[1];
			s_ucData[1] = s_ucData[2];
			s_ucRxCnt = 2;
			
		}
	}
}

static void CmdProcess(void)
{
	switch(s_cCmd)
	{
		case 'a':	if(WitStartAccCali() != WIT_HAL_OK) Serial.print("\r\nSet AccCali Error\r\n");
			break;
		case 'm':	if(WitStartMagCali() != WIT_HAL_OK) Serial.print("\r\nSet MagCali Error\r\n");
			break;
		case 'e':	if(WitStopMagCali() != WIT_HAL_OK) Serial.print("\r\nSet MagCali Error\r\n");
			break;
		case 'u':	if(WitSetBandwidth(BANDWIDTH_5HZ) != WIT_HAL_OK) Serial.print("\r\nSet Bandwidth Error\r\n");
			break;
		case 'U':	if(WitSetBandwidth(BANDWIDTH_256HZ) != WIT_HAL_OK) Serial.print("\r\nSet Bandwidth Error\r\n");
			break;
		case 'B':	if(WitSetUartBaud(WIT_BAUD_115200) != WIT_HAL_OK) Serial.print("\r\nSet Baud Error\r\n");
              else 
              {
                MySerial0.begin(c_uiBaud[WIT_BAUD_115200]);
                Serial.print(" 115200 Baud rate modified successfully\r\n");
              }
			break;
		case 'b':	if(WitSetUartBaud(WIT_BAUD_9600) != WIT_HAL_OK) Serial.print("\r\nSet Baud Error\r\n");
              else 
              {
                MySerial0.begin(c_uiBaud[WIT_BAUD_9600]); 
                Serial.print(" 9600 Baud rate modified successfully\r\n");
              }
			break;
		case 'r': if(WitSetOutputRate(RRATE_1HZ) != WIT_HAL_OK)  Serial.print("\r\nSet Baud Error\r\n");
			        else Serial.print("\r\nSet Baud Success\r\n");
			break;
		case 'R':	if(WitSetOutputRate(RRATE_10HZ) != WIT_HAL_OK) Serial.print("\r\nSet Baud Error\r\n");
              else Serial.print("\r\nSet Baud Success\r\n");
			break;
    case 'C': if(WitSetContent(RSW_ACC|RSW_GYRO|RSW_ANGLE|RSW_MAG) != WIT_HAL_OK) Serial.print("\r\nSet RSW Error\r\n");
      break;
    case 'c': if(WitSetContent(RSW_ACC) != WIT_HAL_OK) Serial.print("\r\nSet RSW Error\r\n");
      break;
		default :break;
	}
	s_cCmd = 0xff;
}
static void SensorUartSend(uint8_t *p_data, uint32_t uiSize)
{
  MySerial0.write(p_data, uiSize);
  MySerial0.flush();
}
static void Delayms(uint16_t ucMs)
{
  delay(ucMs);
}
static void SensorDataUpdata(uint32_t uiReg, uint32_t uiRegNum)
{
	int i;
    for(i = 0; i < uiRegNum; i++)
    {
        switch(uiReg)
        {
            case AZ:
				s_cDataUpdate |= ACC_UPDATE;
            break;
            case GZ:
				s_cDataUpdate |= GYRO_UPDATE;
            break;
            case HZ:
				s_cDataUpdate |= MAG_UPDATE;
            break;
            case Yaw:
				s_cDataUpdate |= ANGLE_UPDATE;
            break;
            default:
				s_cDataUpdate |= READ_UPDATE;
			break;
        }
		uiReg++;
    }
}

static void AutoScanSensor(void)
{
	int i, iRetry;
	
	for(i = 0; i < sizeof(c_uiBaud)/sizeof(c_uiBaud[0]); i++)
	{
		MySerial0.begin(c_uiBaud[i]);
    MySerial0.flush();
		iRetry = 2;
		s_cDataUpdate = 0;
		do
		{
			WitReadReg(AX, 3);
			delay(200);
      while (MySerial0.available())
      {
        WitSerialDataIn(MySerial0.read());
      }
			if(s_cDataUpdate != 0)
			{
				Serial.print(c_uiBaud[i]);
				Serial.print(" baud find sensor\r\n\r\n");
				return ;
			}
			iRetry--;
		}while(iRetry);		
	}
	Serial.print("can not find sensor\r\n");
	Serial.print("please check your connection\r\n");
}

I changed the pins definition and it didn't seem to do anything I also tried switching the RX and TX pins as a sanity check and it didn't make a difference.
I just wanted some closure on whether or not I still needed to include the hardware serial:

HardwareSerial MySerial0(0);

And also I just wanted to be clear that this was a ESP32C3 XIAO seed studio not a ESP32C3 mini, I'm sure the chip is the same but I just was curious if the pins would be different as the pin definitions are labeled as 20 and 21 in the data-sheets:
xiao_esp32c3_pinout_top
And just for reference this is the WT901B:
download
Anyways am I doing something wrong or could my device be malfunctioning because it did work as it was but no matter what it is just not working.

I made that the ESP was outputting the sufficient 3.3 volts and it was.
I also checked if it was the sensor not sending data but it seemed like it was functioning properly.

I realize now that In the programming I showed the TX and RX were swapped so I tried the other way but nothing.

did you try the program of post 2 doing a simple loopback test?

can you give us a link to your WT901B Wit-Motion sensor

how have you connected and powered it?

upload a photo?

Link for info Here
Link for product Here

I tried setting up the test but wasn't quite sure how I will try again but for clarification am I just supposed to switch "for loopback test connect pin 3 to pin 2" with whatever the test is going to be?

just to check Serial1 is working you connect pin 2 to pin 3 - characters entered on keyboard should be echoed back to the display
if OK remove link and connect
pin RXD1 3 to WT901B TX
pin TXD1 2 to WT901B RX

serial data from the WT901B should then appear on the serial monitor

Ended up getting it working thanks, however what ended up working was pins 20 and 21 not 3 and 2. do you know what that's about?

// ESP32-C3-MINI-1 Serial1 test - for loopback test connect pins 2 and 3

// note GPIO20 U0RXD and GPIO21 U0TXD are used for Serial programming/debugging

#define RXD1 20
#define TXD1 21

void setup() {
  // initialize both serial ports:
  Serial.begin(115200);
  Serial1.begin(115200, SERIAL_8N1, RXD1, TXD1);
  Serial.println();
  Serial.println("\n\nESP32-C3 serial1  test Rx pin 3 Tx pin 2");
  //Serial.write("   for loopback test connect pin 3 to pin 2\n");
}

void loop() {
  // read from port 1, send to port 0:
  if (Serial1.available()) {
    int inByte = Serial1.read();
    Serial.write(inByte);
  }

  // read from port 0, send to port 1:
  if (Serial.available()) {
    int inByte = Serial.read();
    //Serial.write(inByte);   //echo keyboard
    Serial1.write(inByte);
  }
}

OMG! Thank you so much for this answer! I was trying to connect a GPS module to pins 20 21 that were the only two i had available on a Lolin C3 Mini board and i could not make it work.
Turned out i had to use Serial1.begin(9600, SERIAL_8N1, 20, 21) instead of Serial.begin(); (take note of the extra '1' next to word Serial)