1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-12-18 19:13:51 +01:00

cpu/sam0/uart: enable peripheral clock before accessing regs

This commit is contained in:
Jue 2022-10-28 20:11:05 +02:00
parent 4f25c1017d
commit cf5e207d62

View File

@ -162,6 +162,9 @@ int uart_init(uart_t uart, uint32_t baudrate, uart_rx_cb_t rx_cb, void *arg)
return UART_NODEV; return UART_NODEV;
} }
/* enable peripheral clock */
sercom_clk_en(dev(uart));
/* must disable here first to ensure idempotency */ /* must disable here first to ensure idempotency */
dev(uart)->CTRLA.reg = 0; dev(uart)->CTRLA.reg = 0;
@ -173,9 +176,6 @@ int uart_init(uart_t uart, uint32_t baudrate, uart_rx_cb_t rx_cb, void *arg)
/* configure pins */ /* configure pins */
_configure_pins(uart); _configure_pins(uart);
/* enable peripheral clock */
sercom_clk_en(dev(uart));
/* reset the UART device */ /* reset the UART device */
_reset(dev(uart)); _reset(dev(uart));