Please, I need help with SERCOM configuration of SAMD51

I am using ATSAMD51G19 microcontroller, and I want to configure it to use 2 UARTs.
UART 1 pins:
TX -> PA00
RX -> PA01

UART 2 pins:
TX -> PA04
RX -> PA05
RTS -> PA06
CTS -> PA07

I tried a code using microchip studio, and everything is working perfectly, but nothing is working at all in Arduino IDE. I am using Adafruit ItsyBitsy M4 board manager.

In the variant file, I added the following:

  // ----------------------
  // 38 - 55
  { PORTA,  27, PIO_DIGITAL, PIN_ATTR_DIGITAL, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_11 },
  { PORTA,  26, PIO_DIGITAL, PIN_ATTR_DIGITAL, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_10 },
  { PORTA,  28, PIO_DIGITAL, PIN_ATTR_DIGITAL, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE },
  { PORTB,   4, PIO_DIGITAL, PIN_ATTR_DIGITAL, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_4 },
  { PORTB,   5, PIO_DIGITAL, PIN_ATTR_DIGITAL, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_5 },
  { PORTB,   6, PIO_DIGITAL, PIN_ATTR_DIGITAL, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_6 },
  { PORTB,   7, PIO_DIGITAL, PIN_ATTR_DIGITAL, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_7 },
  { PORTB,  12, PIO_DIGITAL, PIN_ATTR_DIGITAL, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_12 },
  { PORTB,  13, PIO_DIGITAL, PIN_ATTR_DIGITAL, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_13 },
  { PORTB,  14, PIO_DIGITAL, PIN_ATTR_DIGITAL, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_14 },
  { PORTB,  15, PIO_DIGITAL, PIN_ATTR_DIGITAL, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_15 },
  { PORTB,  16, PIO_DIGITAL, PIN_ATTR_DIGITAL, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_0 },
  { PORTB,  17, PIO_DIGITAL, PIN_ATTR_DIGITAL, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_1 },
  { PORTB,  18, PIO_DIGITAL, PIN_ATTR_DIGITAL, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_2 },
  { PORTB,  19, PIO_DIGITAL, PIN_ATTR_DIGITAL, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_3 },
  { PORTB,  20, PIO_DIGITAL, PIN_ATTR_DIGITAL, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_4 },
  { PORTB,  21, PIO_DIGITAL, PIN_ATTR_DIGITAL, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_5 },
  { PORTB,   0, PIO_DIGITAL, PIN_ATTR_DIGITAL, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_0 },
  
  // TELIT UART pins
  // 56 - 59
  { PORTA,  4, PIO_SERCOM, PIN_ATTR_DIGITAL, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_4 }, // UART TX (SERCOM0 PAD 0)
  { PORTA,  5, PIO_SERCOM, PIN_ATTR_DIGITAL, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_5 }, // UART RX (SERCOM0 PAD 1)
  { PORTA,  6, PIO_SERCOM, PIN_ATTR_DIGITAL, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_6 }, // UART RTS (SERCOM0 PAD 2)
  { PORTA,  7, PIO_SERCOM, PIN_ATTR_DIGITAL, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_7 }, // UART CTS (SERCOM0 PAD 3)
  
  // GNSS UART pins
  // 60 - 61
  { PORTA,  0, PIO_SERCOM, PIN_ATTR_DIGITAL, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_0 }, // UART TX (SERCOM1 PAD 0)
  { PORTA,  1, PIO_SERCOM, PIN_ATTR_DIGITAL, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_1 }, // UART RX (SERCOM1 PAD 1)
  
  //SPI pins
  // 62 - 64
  { PORTA,  18, PIO_SERCOM, PIN_ATTR_DIGITAL, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_2 }, //MISO (SERCOM 3 PAD 2)
  { PORTA,  17, PIO_SERCOM, PIN_ATTR_DIGITAL, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_1 }, //MOSI (SERCOM 3 PAD 0)
  { PORTA,  16, PIO_SERCOM, PIN_ATTR_DIGITAL, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_0 }, //SCK (SERCOM 3 PAD 1)

Thanks a lot in advance for your help!

Here is one example of the approach I successfully use with Arduino IDE 1.8.19, e.g. with Adafruit's Feather M0. There are lots of other possible configurations.

#include <Arduino.h>   // required before wiring_private.h
#include "wiring_private.h" // pinPeripheral() function

Uart Serial2 (&sercom1, 11, 10, SERCOM_RX_PAD_0, UART_TX_PAD_2);
void SERCOM1_Handler()
{
  Serial2.IrqHandler();
}

void setup() {
  Serial.begin(115200);
  while(!Serial);
  Serial.println("Serial2 test");
  
  Serial2.begin(115200);
  
  // Assign pins 10 & 11 SERCOM functionality
  pinPeripheral(10, PIO_SERCOM);
  pinPeripheral(11, PIO_SERCOM);
}

// echo back and forth between Serial2 port and USB serial.
void loop() {
  if (Serial.available()) Serial2.write(Serial.read());
  if (Serial2.available()) Serial.write(Serial2.read());
  
}

I tried this a lot..
I do really think it is clock configuration issue, but I don't know how to solve it..

For help from the forum, please post useful information about the actual problem, including the complete code and full text of error messages. Details of the exact MCU board are needed, too.

Thank you so much for your reply.

As I stated earlier, I am using ATSAMD51G19 microcontroller, on a custom PCB/board. I already mentioned the UART pins above.
I am going to share part of the code I am using to read any data from the devices I am trying to read data from.

// Use this form to specify the TX and RX pin numbers AND PAD designators
//  Note that on SAMD51, the TX pad is fixed.
#define sercom_UseSerialPinsPads(_sercom, _ser, _rx, _tx, _rxpad, _txpad, _rts, _cts)                                             \
	Uart _ser(&sercom##_sercom, _rx, _tx, _rxpad, _txpad, (_rts != -1 ? _rts : 255), (_cts != -1 ? _cts : 255));                    \
	void SERCOM##_sercom##_0_Handler(void)                                                                                          \
	{                                                                                                                               \
		_ser.IrqHandler();                                                                                                            \
	}                                                                                                                               \
	void SERCOM##_sercom##_1_Handler(void)                                                                                          \
	{                                                                                                                               \
		_ser.IrqHandler();                                                                                                            \
	}                                                                                                                               \
	void SERCOM##_sercom##_2_Handler(void)                                                                                          \
	{                                                                                                                               \
		_ser.IrqHandler();                                                                                                            \
	}                                                                                                                               \
	void SERCOM##_sercom##_3_Handler(void)                                                                                          \
	{                                                                                                                               \
		_ser.IrqHandler();                                                                                                            \
	}
/**********************************************************************************************************************************/

// Define a UART on SERCOM0 with TX=PA04 (PAD0) and RX=PA05 (PAD1) and RTS=PA06 (PAD2) and CTS=PA07 (PAD3)
sercom_UseSerialPinsPads(0, TelitSerial, GSM_RX_PIN, GSM_TX_PIN, SERCOM_RX_PAD_1, UART_TX_RTS_CTS_PAD_0_2_3, GSM_RTS_PIN, GSM_CTS_PIN);

// Define a UART on SERCOM1 with TX=PA01 (PAD0) and RX=PA02 (PAD1)
sercom_UseSerialPinsPads(1, GnssSerial, GNSS_RX_PIN, GNSS_TX_PIN, SERCOM_RX_PAD_1, UART_TX_PAD_0, -1, -1);

#define SERIAL_USB Serial

void setup()
{
	SERIAL_USB.begin(115200);  // Debug USB Serial
	while(! SERIAL_USB)
	{
		;  // Wait for Serial Monitor
	}

	// Initialize the serial object
	TelitSerial.begin(115200);  // Set the baud rate

	SERIAL_USB.print("Telit UART Initialized\r\n");

	// Initialize GNSS UART
	GnssSerial.begin(38400);  // Set the baud rate

	SERIAL_USB.print("GNSS UART Initialized\r\n");

	/* Configure GNSS module pins mode to output: */
	pinMode(GNSS_RESET_PIN, OUTPUT);
	pinMode(GNSS_ENABLE_PIN, OUTPUT);

	digitalWrite(GNSS_ENABLE_PIN, LOW); /* Configure GNSS enable pin to low */
	digitalWrite(GNSS_RESET_PIN, HIGH); /* Configure GNSS reset pin to high */

	// Configure GNSS UART pins (SERCOM4)
	if(pinPeripheral(GNSS_TX_PIN, PIO_SERCOM) != 0)
	{
		Serial.println("Failed to configure GNSS TX (PA01)");
	}
	else
	{
		Serial.println("GNSS TX (PA01) configured successfully");
	}
	if(pinPeripheral(GNSS_RX_PIN, PIO_SERCOM) != 0)
	{
		Serial.println("Failed to configure GNSS RX (PA00)");
	}
	else
	{
		Serial.println("GNSS RX (PA00) configured successfully");
	}

	/* Configure LTE module pins mode to output: */
	pinMode(GSM_ENABLE_PIN, OUTPUT);
	pinMode(GSM_POWER_ON_OFF_PIN, OUTPUT);

	Serial.println("Turning LTE module on");
	digitalWrite(GSM_ENABLE_PIN, LOW);       /* Configure 3.8 volts to GSM module */
	digitalWrite(GSM_POWER_ON_OFF_PIN, LOW); /* Configure LTE power-off pin to LOW */
	delay(5000);
	watchdogReset();
	digitalWrite(GSM_POWER_ON_OFF_PIN, HIGH); /* Configure LTE power-on pin to high */
	Serial.println("Finished powering LTE module on");

	// Configure Telit UART pins (SERCOM0)
	if(pinPeripheral(GSM_TX_PIN, PIO_SERCOM) != 0)
	{
		Serial.println("Failed to configure Telit TX (PA04)");
	}
	else
	{
		Serial.println("Telit TX (PA04) configured successfully");
	}
	if(pinPeripheral(GSM_RX_PIN, PIO_SERCOM) != 0)
	{
		Serial.println("Failed to configure Telit RX (PA05)");
	}
	else
	{
		Serial.println("Telit RX (PA05) configured successfully");
	}
	if(pinPeripheral(GSM_CTS_PIN, PIO_SERCOM) != 0)
	{
		Serial.println("Failed to configure Telit CTS (PA06)");
	}
	else
	{
		Serial.println("Telit CTS (PA06) configured successfully");
	}
	if(pinPeripheral(GSM_RTS_PIN, PIO_SERCOM) != 0)
	{
		Serial.println("Failed to configure Telit RTS (PA07)");
	}
	else
	{
		Serial.println("Telit RTS (PA07) configured successfully");
	}
#endif

	Serial.println("LTE module is turned on");
}

void loop()
{
	// Check if data is available from the modem
	if(TelitSerial.available())
	{
		Serial.print("Received from modem: ");
		while(TelitSerial.available())
		{
			char c = TelitSerial.read();
			SERIAL_USB.print(c);  // Echo received data to Serial Monitor
		}
	}

	// Check if data is available from the modem
	if(GnssSerial.available() > 0)
	{
		SERIAL_USB.print("Received from GNSS modem: ");
		while(GnssSerial.available())
		{
			char c = GnssSerial.read();
			SERIAL_USB.print(c);  // Echo received data to Serial Monitor
		}
	}

	// Send test data to the modem
	while(SERIAL_USB.available())
	{
		char c = SERIAL_USB.read();
		SERIAL_USB.print(c);
		TelitSerial.print(c);  // Echo received data to Serial Monitor
	}
}

My main problem is that I can't see any data received by the UART, although when I programmed the microcontroller via Atmel/microchip studio, everything works perfectly.