From fb6e3c01c74bcb29b5d84ed19eaa5e24088d95da Mon Sep 17 00:00:00 2001 From: Benjamin Valentin Date: Thu, 14 Dec 2023 14:59:22 +0100 Subject: [PATCH 1/2] boards/same54-xpro: configure pins for UART HW flow control --- boards/same54-xpro/Kconfig | 1 + boards/same54-xpro/Makefile.features | 1 + boards/same54-xpro/include/periph_conf.h | 20 ++++++-------------- 3 files changed, 8 insertions(+), 14 deletions(-) diff --git a/boards/same54-xpro/Kconfig b/boards/same54-xpro/Kconfig index e93ff5824310..4386463754b2 100644 --- a/boards/same54-xpro/Kconfig +++ b/boards/same54-xpro/Kconfig @@ -23,6 +23,7 @@ config BOARD_SAME54_XPRO select HAS_PERIPH_SPI select HAS_PERIPH_TIMER select HAS_PERIPH_UART + select HAS_PERIPH_UART_HW_FC select HAS_PERIPH_USBDEV select HAS_RIOTBOOT select HAS_TINYUSB_DEVICE diff --git a/boards/same54-xpro/Makefile.features b/boards/same54-xpro/Makefile.features index 3e3491ebeb04..2a0b7d1abcb8 100644 --- a/boards/same54-xpro/Makefile.features +++ b/boards/same54-xpro/Makefile.features @@ -12,6 +12,7 @@ FEATURES_PROVIDED += periph_sdmmc FEATURES_PROVIDED += periph_spi FEATURES_PROVIDED += periph_timer FEATURES_PROVIDED += periph_uart +FEATURES_PROVIDED += periph_uart_hw_fc FEATURES_PROVIDED += periph_adc FEATURES_PROVIDED += periph_usbdev FEATURES_PROVIDED += periph_freqm diff --git a/boards/same54-xpro/include/periph_conf.h b/boards/same54-xpro/include/periph_conf.h index 5a402d196bd8..33dbb72cfd13 100644 --- a/boards/same54-xpro/include/periph_conf.h +++ b/boards/same54-xpro/include/periph_conf.h @@ -115,10 +115,6 @@ static const uart_conf_t uart_config[] = { .dev = &SERCOM2->USART, .rx_pin = GPIO_PIN(PB, 24), .tx_pin = GPIO_PIN(PB, 25), -#ifdef MODULE_PERIPH_UART_HW_FC - .rts_pin = GPIO_UNDEF, - .cts_pin = GPIO_UNDEF, -#endif .mux = GPIO_MUX_D, .rx_pad = UART_PAD_RX_1, .tx_pad = UART_PAD_TX_0, @@ -130,12 +126,16 @@ static const uart_conf_t uart_config[] = { .rx_pin = GPIO_PIN(PA, 5), .tx_pin = GPIO_PIN(PA, 4), #ifdef MODULE_PERIPH_UART_HW_FC - .rts_pin = GPIO_UNDEF, - .cts_pin = GPIO_UNDEF, + .rts_pin = GPIO_PIN(PA, 6), + .cts_pin = GPIO_PIN(PA, 7), #endif .mux = GPIO_MUX_D, .rx_pad = UART_PAD_RX_1, +#ifdef MODULE_PERIPH_UART_HW_FC + .tx_pad = UART_PAD_TX_0_RTS_2_CTS_3, +#else .tx_pad = UART_PAD_TX_0, +#endif .flags = UART_FLAG_NONE, .gclk_src = SAM0_GCLK_PERIPH, }, @@ -143,10 +143,6 @@ static const uart_conf_t uart_config[] = { .dev = &SERCOM5->USART, .rx_pin = GPIO_PIN(PB, 17), .tx_pin = GPIO_PIN(PB, 16), -#ifdef MODULE_PERIPH_UART_HW_FC - .rts_pin = GPIO_UNDEF, - .cts_pin = GPIO_UNDEF, -#endif .mux = GPIO_MUX_C, .rx_pad = UART_PAD_RX_1, .tx_pad = UART_PAD_TX_0, @@ -157,10 +153,6 @@ static const uart_conf_t uart_config[] = { .dev = &SERCOM1->USART, .rx_pin = GPIO_PIN(PC, 23), .tx_pin = GPIO_PIN(PC, 22), -#ifdef MODULE_PERIPH_UART_HW_FC - .rts_pin = GPIO_UNDEF, - .cts_pin = GPIO_UNDEF, -#endif .mux = GPIO_MUX_C, .rx_pad = UART_PAD_RX_1, .tx_pad = UART_PAD_TX_0, From 8db01f6df1b8868554106ea83fb9195da979410a Mon Sep 17 00:00:00 2001 From: Benjamin Valentin Date: Thu, 14 Dec 2023 15:21:54 +0100 Subject: [PATCH 2/2] boards/same54-xpro: configure orange ethernet LED There is a software controlled LED on the RJ45 connector. Export it via SAUL. --- boards/same54-xpro/include/board.h | 9 +++++++++ boards/same54-xpro/include/gpio_params.h | 6 ++++++ 2 files changed, 15 insertions(+) diff --git a/boards/same54-xpro/include/board.h b/boards/same54-xpro/include/board.h index e6c548fb34cd..50a966787fef 100644 --- a/boards/same54-xpro/include/board.h +++ b/boards/same54-xpro/include/board.h @@ -56,6 +56,15 @@ extern "C" { #define LED0_ON (LED_PORT.OUTCLR.reg = LED0_MASK) #define LED0_OFF (LED_PORT.OUTSET.reg = LED0_MASK) #define LED0_TOGGLE (LED_PORT.OUTTGL.reg = LED0_MASK) + +#define LED1_PIN GPIO_PIN(PC, 15) + +#define LED_PORT PORT->Group[PC] +#define LED1_MASK (1 << 15) + +#define LED1_ON (LED_PORT.OUTCLR.reg = LED1_MASK) +#define LED1_OFF (LED_PORT.OUTSET.reg = LED1_MASK) +#define LED1_TOGGLE (LED_PORT.OUTTGL.reg = LED1_MASK) /** @} */ /** diff --git a/boards/same54-xpro/include/gpio_params.h b/boards/same54-xpro/include/gpio_params.h index 70e59b6ab569..22cddefaaa70 100644 --- a/boards/same54-xpro/include/gpio_params.h +++ b/boards/same54-xpro/include/gpio_params.h @@ -37,6 +37,12 @@ static const saul_gpio_params_t saul_gpio_params[] = .mode = GPIO_OUT, .flags = SAUL_GPIO_INVERTED }, + { + .name = "LED(ETH)", + .pin = LED1_PIN, + .mode = GPIO_OUT, + .flags = SAUL_GPIO_INVERTED + }, { .name = "Button(SW0)", .pin = BTN0_PIN,