Also managed to get a third UART going on the Zero as well.
Add the two following lines to the end of the "g_APinDescription" array in the file ..Computer\AppData\Roaming\Arduino15\packages\arduino\hardware\samd\1.6.1\variants\arduino_zero\variant.cpp:
// 44..45 - SERCOM2
{ PORTA, 14, PIO_SERCOM, PIN_ATTR_NONE, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, // SERCOM2/PAD[2]
{ PORTA, 15, PIO_SERCOM, PIN_ATTR_NONE, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, // SERCOM2/PAD[3]
The example code below creates a UART class "Serial3" and connects it to SERCOM2. The Tx pin is on digital pin 2 (D2) and Rx on digital pin 5 (D5). It simply echos back characters sent from the COM terminal. Note that on Arduino.org's Zero Pro/M0 Pro/M0 the Tx pin is on digital pin 4 (D4).
// Serial3 pin and pad definitions (in Arduino files Variant.h & modified Variant.cpp)
#define PIN_SERIAL3_RX (45ul) // Pin description number for PIO_SERCOM on D5
#define PIN_SERIAL3_TX (44ul) // Pin description number for PIO_SERCOM on D2
#define PAD_SERIAL3_TX (UART_TX_PAD_2) // SERCOM pad 2
#define PAD_SERIAL3_RX (SERCOM_RX_PAD_3) // SERCOM pad 3
// Instantiate the Serial3 class
Uart Serial3(&sercom2, PIN_SERIAL3_RX, PIN_SERIAL3_TX, PAD_SERIAL3_RX, PAD_SERIAL3_TX);
void setup()
{
Serial3.begin(115200); // Begin Serial3
}
void loop()
{
if (Serial3.available()) // Check if incoming data is available
{
byte byteRead = Serial3.read(); // Read the most recent byte
Serial3.write(byteRead); // Echo the byte back out on the serial port
}
}
void SERCOM2_Handler() // Interrupt handler for SERCOM2
{
Serial3.IrqHandler();
}