Require 3 hardware UARTs

Hello, I am in need of 3 UARTs for my project. I don’t wish to use SoftwareSerial library. After much searching I found that I will need to modify the variant.h and variant.cpp files to enable PIO_SERCOM and PIO_SERCOM_ALT for the Seeeduino XIAO. This is above my skill level and any help will be greatly appreciated.

You do need to modify variant.h and variant.cpp, and if this feature is needed by most people, we will provide an example.

1 Like

Thank you, much appreciated. I am sure it would benefit many hobbyist.

Yes, I second the request. I also need multiple UARTs.

I can also use multiple UARTs

I also need 3 UARTs.

Last November you said you would provide an example if multiple people request it. Is the example available yet?

Thx.

I also need multi-seiral,could you provide the example to me?

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.