diff --git a/boards/samr21-xpro/include/periph_conf.h b/boards/samr21-xpro/include/periph_conf.h index acfccece08139c2b5b7b961119e9a8e5738cf662..395ce073da7c185d37cfbecc327b62ec47a905dd 100644 --- a/boards/samr21-xpro/include/periph_conf.h +++ b/boards/samr21-xpro/include/periph_conf.h @@ -105,8 +105,8 @@ extern "C" { */ static const uart_conf_t uart_config[] = { /* device, RX pin, TX pin, mux */ - {&SERCOM0->USART, GPIO_PIN(PA,5), GPIO_PIN(PA,4), GPIO_MUX_D}, - {&SERCOM5->USART, GPIO_PIN(PA,23), GPIO_PIN(PA,22), GPIO_MUX_D}, + {&SERCOM0->USART, GPIO_PIN(PA,5), GPIO_PIN(PA,4), GPIO_MUX_D, SERCOM_RX_PAD_1, UART_TX_PAD_0}, + {&SERCOM5->USART, GPIO_PIN(PA,23), GPIO_PIN(PA,22), GPIO_MUX_D, SERCOM_RX_PAD_1, UART_TX_PAD_0}, }; /* interrupt function name mapping */ diff --git a/cpu/samd21/periph/uart.c b/cpu/samd21/periph/uart.c index 44efebba4678ba57c2c48b486546de9e3f8b2fa1..62bd6152d7775d2962590bb5f8280afc18aab519 100644 --- a/cpu/samd21/periph/uart.c +++ b/cpu/samd21/periph/uart.c @@ -86,11 +86,12 @@ static int init_base(uart_t uart, uint32_t baudrate) /* reset the UART device */ dev->CTRLA.reg = SERCOM_USART_CTRLA_SWRST; while (dev->SYNCBUSY.reg & SERCOM_USART_SYNCBUSY_SWRST) {} - /* set asynchronous mode w/o parity, LSB first, PAD0 to TX, PAD1 to RX and + /* set asynchronous mode w/o parity, LSB first, PADn to TX, PADn to RX and * use internal clock */ dev->CTRLA.reg = (SERCOM_USART_CTRLA_DORD | - SERCOM_USART_CTRLA_RXPO(0x1) | - SERCOM_USART_CTRLA_SAMPR(0x1) | + SERCOM_USART_CTRLA_TXPO(uart_config[uart].tx_pad) | + SERCOM_USART_CTRLA_RXPO(uart_config[uart].rx_pad) | + SERCOM_USART_CTRLA_SAMPR(0x1) | // 1: x16 sample rate SERCOM_USART_CTRLA_MODE_USART_INT_CLK); /* set baudrate */ dev->BAUD.FRAC.FP = (baud % 10);