-
-
Notifications
You must be signed in to change notification settings - Fork 7k
Description
in https://www.arduino.cc/en/Tutorial/SamdSercom
in the UART tutorial the RX and TX pins are swapped
Uart mySerial (&sercom3, 0, 1, SERCOM_RX_PAD_1, UART_TX_PAD_0)
for sercom3 pad 1 is pin 1 so RX is pin 1 (SERCOM_RX_PAD_1 = this sercom is uart with RX on pad 1)
for sercom3 pad 0 is pin 0 so TX is pin 0 (UART_TX_PAD_0 = uart TX pad is pad 0)
the first two parameters of the constructor should be 1, 0 but the constructor doesn't care. it only sets the default pin modes for the pins (which works for Serial1 but not here since pin 1 and 0 are io pins at default)
then in setup() the right pin modes are set for the pins 0 and 1 but the comments are wrong. it should be
pinPeripheral(0, PIO_SERCOM); //Assign SERCOM function to pin 0 (TX)
pinPeripheral(1, PIO_SERCOM); //Assign SERCOM function to pin 1 (RX)