I'm now wondering if I can spare both RX pins so that I can use them for other tasks, since I'm only using TX functionality for both serials, and if possible, how should I modify the variant files.
Thank you
It's possible to disable the receiver in the SERCOM's CTRLB register, however this is enable protected, therefore it's necessary to disable the SERCOM before making the change and re-enabling it once more:
SERCOM3->USART.CTRLA.bit.ENABLE = 0; // Disable the USART
while (SERCOM3->USART.SYNCBUSY.bit.ENABLE); // Wait for synchronization
SERCOM3->USART.CTRLB.bit.RXEN = 0; // Disable the receiver
while (SERCOM1->USART.SYNCBUSY.bit.CTRLB); // Wait for synchronization
SERCOM3->USART.CTRLA.bit.ENABLE = 1; // Re-enable the USART
while (SERCOM3->USART.SYNCBUSY.bit.ENABLE); // Wait for synchronization
Unfortunately, it's not possible to make this change by simply modifying the variant files, since by default the Serialx.begin() function will enable both Tx and Rx functionality.
Another option is to create your own begin function specific to that SERCOM, but only enable the Tx. The code for the begin function is in the Uart.cpp and SERCOM.cpp Arduino (Adafruit) SAMD core files.
Yes, I think your suggestion will work, since Serial's begin() function (in file Uart.cpp) calls on pinPeripheral(), which will immediately set the receiver pin to a GPIO: