Serial port other than pins 13- 14 and 0-1

Hi:

I have sucesfully been able to communicate with an RS485 converter through the pines 0-1..
I also been able to communicete with an RS232 converter with pins 13-14...

Now I want to use the an MKR Relay Shield that uses pins 1 and 2 for relays, so I want to use other pines for the RS 485 comunication, for example pin 6 and 7, but It doesn't work..:

This is the original code:

#include <Arduino.h>
#include "wiring_private.h"
# define RS_RO    6 // With pin 1 works
# define RS_DI    7 // with pin 0 works

Uart RS_Slave_1 (&sercom3, RS_DI, RS_RO, SERCOM_RX_PAD_1, UART_TX_PAD_0);
pinPeripheral(RS_RO, PIO_SERCOM); 
pinPeripheral(RS_DI, PIO_SERCOM);

I know there are some limitations to the pines you can use for addtional serial communciations, but I haven't been able to fully understand it..., can anybody help?

Thanks in advance.

Pins 6 and 7 have SERCOM 3 pads 2 and 3 instead of 0 and 1.
SERCOM 3 is a SERCOM-ALT peripheral on those pins.

pin port SERCOM SERCOM-ALT
0 PA22 sc 3 pad 0 sc 5 pad 0
1 PA23 sc 3 pad 1 sc 5 pad 1
6 PA20 sc 5 pad 2 sc 3 pad 2
7 PA21 sc 5 pad 3 sc 3 pad 3

Untested:

Uart RS_Slave_1 (&sercom3, RS_DI, RS_RO, SERCOM_RX_PAD_3, UART_TX_PAD_2);
pinPeripheral(RS_RO, PIO_SERCOM_ALT); 
pinPeripheral(RS_DI, PIO_SERCOM_ALT);

Thanks very much. Tested and it woks :grinning:

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.