- /* Disable PIO mode and set appropriate UART pins peripheral mode */
- HWREG(UART_GPIO_BASE + GPIO_PDR) = UART_PINS;
- HWREG(UART_GPIO_BASE + GPIO_ABCDSR1) &= ~UART_PINS;
- HWREG(UART_GPIO_BASE + GPIO_ABCDSR2) &= ~UART_PINS;
+ /*
+ * Disable PIO mode and set appropriate UART pins peripheral mode.
+ * SAM3X,A,N,S,U: all of them has all UARTs on peripheral A.
+ */
+ HWREG(UART_PIO_BASE + PIO_PDR_OFF) = UART_PINS;
+ PIO_PERIPH_SEL(UART_PIO_BASE, UART_PINS, UART_PERIPH);