Require 3 hardware UARTs

Hi
I have same demand.
I found information here, and I could enabled Serial2 and Serial3 .

This page is in Japanese, so I summary in English.

  • No need to change in variant.cpp.
  • Add following lines on variant.h, Near line 172, after lines for “Serial1”, and before “#endif // __cplusplus”.
    File should be here.
    "C:\Users\Username\AppData\Local\Arduino15\packages\Seeeduino\hardware\samd\1.7.8\variants\XIAO_m0\variant.h " (version name may be different)

// Serial2
extern Uart Serial2;
#define PIN_SERIAL2_TX (4ul)
#define PIN_SERIAL2_RX (5ul)
#define PAD_SERIAL2_TX (UART_TX_PAD_0)
#define PAD_SERIAL2_RX (SERCOM_RX_PAD_1)
// Serial3
extern Uart Serial3;
#define PIN_SERIAL3_TX (10ul)
#define PIN_SERIAL3_RX (9ul)
#define PAD_SERIAL3_TX (UART_TX_PAD_2)
#define PAD_SERIAL3_RX (SERCOM_RX_PAD_1)

Then add Serial2.h, Serial2.cpp, Serial3.h, and Serial3.cpp as described in the page, into the folder “C:\Users\wdn\AppData\Local\Arduino15\packages\Seeeduino\hardware\samd\1.7.8\libraries”.

To use them just
#include “Serial2.h”
or
#include “Serial3.h”

If you use Serial2 (pin Tx=D4, Rx=D5), you can’t use I2C.
If you use I2C, do not include Serial2.

If you use Serial3 (pin Tx=D10, Rx=D9), you can’t use SPI.
If you use SPI, do not include Serial3.

It worked at least on my Xiao.