From cf5e207d62d17c36fd444c7269af92b67298a0cc Mon Sep 17 00:00:00 2001 From: Jue Date: Fri, 28 Oct 2022 20:11:05 +0200 Subject: [PATCH] cpu/sam0/uart: enable peripheral clock before accessing regs --- cpu/sam0_common/periph/uart.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cpu/sam0_common/periph/uart.c b/cpu/sam0_common/periph/uart.c index 25aca6d511..a0810a9da2 100644 --- a/cpu/sam0_common/periph/uart.c +++ b/cpu/sam0_common/periph/uart.c @@ -162,6 +162,9 @@ int uart_init(uart_t uart, uint32_t baudrate, uart_rx_cb_t rx_cb, void *arg) return UART_NODEV; } + /* enable peripheral clock */ + sercom_clk_en(dev(uart)); + /* must disable here first to ensure idempotency */ 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(uart); - /* enable peripheral clock */ - sercom_clk_en(dev(uart)); - /* reset the UART device */ _reset(dev(uart));