From 8509f358f5952ba050446f875794b3d45d0dda1b Mon Sep 17 00:00:00 2001 From: Jue Date: Mon, 17 Oct 2022 23:09:31 +0200 Subject: [PATCH] boards/xg23-pk6068a: initial commit --- boards/xg23-pk6068a/Kconfig | 21 ++++ boards/xg23-pk6068a/Makefile | 3 + boards/xg23-pk6068a/Makefile.dep | 7 ++ boards/xg23-pk6068a/Makefile.features | 9 ++ boards/xg23-pk6068a/Makefile.include | 6 + boards/xg23-pk6068a/board.c | 30 +++++ boards/xg23-pk6068a/doc.txt | 18 +++ boards/xg23-pk6068a/include/board.h | 136 ++++++++++++++++++++ boards/xg23-pk6068a/include/gpio_params.h | 63 ++++++++++ boards/xg23-pk6068a/include/periph_conf.h | 147 ++++++++++++++++++++++ dist/tools/doccheck/exclude_patterns | 23 ++++ examples/twr_aloha/Makefile | 3 + 12 files changed, 466 insertions(+) create mode 100644 boards/xg23-pk6068a/Kconfig create mode 100644 boards/xg23-pk6068a/Makefile create mode 100644 boards/xg23-pk6068a/Makefile.dep create mode 100644 boards/xg23-pk6068a/Makefile.features create mode 100644 boards/xg23-pk6068a/Makefile.include create mode 100644 boards/xg23-pk6068a/board.c create mode 100644 boards/xg23-pk6068a/doc.txt create mode 100644 boards/xg23-pk6068a/include/board.h create mode 100644 boards/xg23-pk6068a/include/gpio_params.h create mode 100644 boards/xg23-pk6068a/include/periph_conf.h diff --git a/boards/xg23-pk6068a/Kconfig b/boards/xg23-pk6068a/Kconfig new file mode 100644 index 000000000000..d16612bad977 --- /dev/null +++ b/boards/xg23-pk6068a/Kconfig @@ -0,0 +1,21 @@ +# Copyright (c) 2022 SSV Software Systems GmbH +# +# This file is subject to the terms and conditions of the GNU Lesser +# General Public License v2.1. See the file LICENSE in the top level +# directory for more details. + +config BOARD + default "xg23-pk6068a" if BOARD_XG23_PK6068A + +config BOARD_XG23_PK6068A + bool + default y + select CPU_MODEL_EFR32ZG23A020F512GM48 + + # Put defined MCU peripherals here (in alphabetical order) + select HAS_PERIPH_I2C + select HAS_PERIPH_SPI + select HAS_PERIPH_TIMER + select HAS_PERIPH_UART + + # Put other features for this board (in alphabetical order) diff --git a/boards/xg23-pk6068a/Makefile b/boards/xg23-pk6068a/Makefile new file mode 100644 index 000000000000..f8fcbb53a065 --- /dev/null +++ b/boards/xg23-pk6068a/Makefile @@ -0,0 +1,3 @@ +MODULE = board + +include $(RIOTBASE)/Makefile.base diff --git a/boards/xg23-pk6068a/Makefile.dep b/boards/xg23-pk6068a/Makefile.dep new file mode 100644 index 000000000000..4245778abebc --- /dev/null +++ b/boards/xg23-pk6068a/Makefile.dep @@ -0,0 +1,7 @@ +ifneq (,$(filter saul_default,$(USEMODULE))) + USEMODULE += saul_gpio +endif + +ifneq (,$(filter ztimer,$(USEMODULE))) + USEMODULE += ztimer_periph_lptimer +endif diff --git a/boards/xg23-pk6068a/Makefile.features b/boards/xg23-pk6068a/Makefile.features new file mode 100644 index 000000000000..7d67da3f5172 --- /dev/null +++ b/boards/xg23-pk6068a/Makefile.features @@ -0,0 +1,9 @@ +CPU = efm32 +CPU_FAM = efr32zg23 +CPU_MODEL = efr32zg23a020f512gm48 + +# Put defined MCU peripherals here (in alphabetical order) +FEATURES_PROVIDED += periph_i2c +FEATURES_PROVIDED += periph_spi +FEATURES_PROVIDED += periph_timer +FEATURES_PROVIDED += periph_uart diff --git a/boards/xg23-pk6068a/Makefile.include b/boards/xg23-pk6068a/Makefile.include new file mode 100644 index 000000000000..8c86c429445e --- /dev/null +++ b/boards/xg23-pk6068a/Makefile.include @@ -0,0 +1,6 @@ +# use JLink for flashing +PROGRAMMER ?= jlink +JLINK_DEVICE = EFR32ZG23BXXXF512 +JLINK_PRE_FLASH = r +FLASH_ADDR = 0x08000000 +BAUD ?= 115200 diff --git a/boards/xg23-pk6068a/board.c b/boards/xg23-pk6068a/board.c new file mode 100644 index 000000000000..0b732363379b --- /dev/null +++ b/boards/xg23-pk6068a/board.c @@ -0,0 +1,30 @@ +/* + * Copyright (C) 2022 SSV Software Systems GmbH + * + * This file is subject to the terms and conditions of the GNU Lesser + * General Public License v2.1. See the file LICENSE in the top level + * directory for more details. + */ + +/** + * @ingroup boards_xg23-pk6068a + * @{ + * + * @file + * @brief Board specific implementations for the xG23-PK6068A board + * + * @author Juergen Fitschen + * + * @} + */ + +#include "cpu.h" +#include "board.h" +#include "periph/gpio.h" + +void board_init(void) +{ + /* Enable VCOM iface */ + gpio_init(VCOM_EN_PIN, GPIO_OUT); + gpio_set(VCOM_EN_PIN); +} diff --git a/boards/xg23-pk6068a/doc.txt b/boards/xg23-pk6068a/doc.txt new file mode 100644 index 000000000000..49790ea54f71 --- /dev/null +++ b/boards/xg23-pk6068a/doc.txt @@ -0,0 +1,18 @@ +/** + * @defgroup boards_xg23-pk6068a xG23-PK6068A + * @ingroup boards + * @brief Support for the xG23-PK6068A board. + * + * ### General information + * + * Some general information about the board + * + * ### Pinout + * + * A detailed description of the board pinout (if available) + * + * ### Flash the board + * + * Some notes about how to flash the board + * + */ diff --git a/boards/xg23-pk6068a/include/board.h b/boards/xg23-pk6068a/include/board.h new file mode 100644 index 000000000000..9dbaf80c37f1 --- /dev/null +++ b/boards/xg23-pk6068a/include/board.h @@ -0,0 +1,136 @@ +/* + * Copyright (C) 2022 SSV Software Systems GmbH + * + * This file is subject to the terms and conditions of the GNU Lesser + * General Public License v2.1. See the file LICENSE in the top level + * directory for more details. + */ + +/** + * @ingroup boards_xg23-pk6068a + * @{ + * + * @file + * @brief Board specific definitions for the xG23-PK6068A + * + * @author Juergen Fitschen + */ + +#ifndef BOARD_H +#define BOARD_H + +#include "cpu.h" +#include "periph_conf.h" +#include "periph_cpu.h" +#include "periph/gpio.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Initialize pm_layered with no pre-defined blockers + * + * All peripheral drivers keep track of required pm modes. + */ +#define PM_BLOCKER_INITIAL { 0, 0, 0 } + +/** + * @name ztimer configuration + * @{ + */ +#define CONFIG_ZTIMER_LPTIMER_DEV TIMER_DEV(1) +#define CONFIG_ZTIMER_LPTIMER_FREQ LFXO_FREQ +#define CONFIG_ZTIMER_LPTIMER_WIDTH 24 +#define CONFIG_ZTIMER_LPTIMER_BLOCK_PM_MODE -1 +/** @} */ + +/** + * @brief Power mode required for GPIO IRQs + * + * If all GPIO IRQs are expected on port A or B, EM3 is the lowest allowed + * power mode. No power level has to be blocked in this case. + * If GPIO IRQs shall be fired on port C or D, we must stay in EM1. + * Uncomment the line down below in this case. + */ +/* #define GPIO_INT_PM_BLOCKER PM_MODE_EM2 */ + +/** + * @name Board VCOM interface + * + * Define the GPIO pin to enable the VCOM interface + */ +#define VCOM_UART UART_DEV(0) +#define VCOM_EN_PIN GPIO_PIN(PB, 0) + +/** + * @name Push button pin definitions + * @{ + */ +#define PB0_PIN GPIO_PIN(PB, 1) +#define PB1_PIN GPIO_PIN(PB, 3) +/** @} */ + +/** + * @name LED pin definitions + * @{ + */ +#define LED0_PIN GPIO_PIN(PB, 2) +#define LED1_PIN GPIO_PIN(PD, 3) +/** @} */ + +/** + * @name Macros for controlling the on-board LEDs + * @{ + */ +#define LED0_ON gpio_set(LED0_PIN) +#define LED0_OFF gpio_clear(LED0_PIN) +#define LED0_TOGGLE gpio_toggle(LED0_PIN) +#define LED1_ON gpio_set(LED1_PIN) +#define LED1_OFF gpio_clear(LED1_PIN) +#define LED1_TOGGLE gpio_toggle(LED1_PIN) +/** @} */ + +/** + * @name Display configuration + * + * Connection to the on-board Sharp Memory LCD (LS013B7DH03). + * @{ + */ +#define DISP_SPI SPI_DEV(0) +#define DISP_SCS_PIN GPIO_PIN(PC, 8) +#define DISP_EXTCOMIN_PIN GPIO_PIN(PC, 6) +#define DISP_ENABLE_PIN GPIO_PIN(PC, 9) +/** @} */ + +/** + * @name Flash configuration + * + * Connection to the on-board MX25R8035F. + * @{ + */ +#define FLASH_SPI SPI_DEV(0) +#define FLASH_CS_PIN GPIO_PIN(PC, 4) +/** @} */ + +/** + * @name Sensor configuration + * + * Connection to the on-board Si7021 temperature & humidity sensor. + * @{ + */ +#define SENSOR_I2C I2C_DEV(0) +#define SENSOR_ENABLE_PIN GPIO_PIN(PC, 9) +/** @} */ + +/** + * @brief Initialize board specific hardware + */ +void board_init(void); + +#ifdef __cplusplus +} +#endif + +#endif /* BOARD_H */ +/** @} */ diff --git a/boards/xg23-pk6068a/include/gpio_params.h b/boards/xg23-pk6068a/include/gpio_params.h new file mode 100644 index 000000000000..4e1787d3b5ab --- /dev/null +++ b/boards/xg23-pk6068a/include/gpio_params.h @@ -0,0 +1,63 @@ +/* + * Copyright (C) 2022 SSV Software Systems GmbH + * + * This file is subject to the terms and conditions of the GNU Lesser + * General Public License v2.1. See the file LICENSE in the top level + * directory for more details. + */ + +/** + * @ingroup boards_xg23-pk6068a + * @{ + * + * @file + * @brief Board specific configuration of direct mapped GPIOs + * + * @author Juergen Fitschen + */ + +#ifndef GPIO_PARAMS_H +#define GPIO_PARAMS_H + +#include "board.h" +#include "saul/periph.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief GPIO pin configuration + */ +static const saul_gpio_params_t saul_gpio_params[] = +{ + { + .name = "LED 0", + .pin = LED0_PIN, + .mode = GPIO_OUT + }, + { + .name = "LED 1", + .pin = LED1_PIN, + .mode = GPIO_OUT + }, + { + .name = "Button 1", + .pin = PB0_PIN, + .mode = GPIO_IN_PU, + .flags = SAUL_GPIO_INVERTED + }, + { + .name = "Button 2", + .pin = PB1_PIN, + .mode = GPIO_IN_PU, + .flags = SAUL_GPIO_INVERTED + } +}; + +#ifdef __cplusplus +} +#endif + +#endif /* GPIO_PARAMS_H */ +/** @} */ diff --git a/boards/xg23-pk6068a/include/periph_conf.h b/boards/xg23-pk6068a/include/periph_conf.h new file mode 100644 index 000000000000..00cb513b38c1 --- /dev/null +++ b/boards/xg23-pk6068a/include/periph_conf.h @@ -0,0 +1,147 @@ +/* + * Copyright (C) 2022 SSV Software Systems GmbH + * + * This file is subject to the terms and conditions of the GNU Lesser + * General Public License v2.1. See the file LICENSE in the top level + * directory for more details. + */ + +/** + * @ingroup boards_xg23-pk6068a + * @{ + * + * @file + * @brief Configuration of CPU peripherals for xG23-PK6068A board + * + * @author Juergen Fitschen + */ + +#ifndef PERIPH_CONF_H +#define PERIPH_CONF_H + +#include + +#include "cpu.h" +#include "periph_cpu.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @name Clock configuration + * @{ + */ +#define HFXO_FREQ (39000000UL) +#define CMU_HFXOINIT CMU_HFXOINIT_DEFAULT + +#define LFXO_FREQ (32768UL) +#define CMU_LFXOINIT CMU_LFXOINIT_DEFAULT + +static const clk_mux_t clk_mux_config[] = { + { .clk = cmuClock_SYSCLK, .src = cmuSelect_HFXO }, + { .clk = cmuClock_EM01GRPACLK, .src = cmuSelect_HFXO }, + { .clk = cmuClock_EM01GRPCCLK, .src = cmuSelect_HFXO }, + { .clk = cmuClock_EM23GRPACLK, .src = cmuSelect_LFXO }, + { .clk = cmuClock_EUSART0CLK, .src = cmuSelect_HFXO }, +}; +#define CLK_MUX_NUMOF ARRAY_SIZE(clk_mux_config) + +static const clk_div_t clk_div_config[] = { + { .clk = cmuClock_HCLK, .div = 1 }, + { .clk = cmuClock_PCLK, .div = 1 }, + { .clk = cmuClock_LSPCLK, .div = 2 }, +}; +#define CLK_DIV_NUMOF ARRAY_SIZE(clk_div_config) +/** @} */ + +/** + * @name I2C configuration + * @{ + */ +static const i2c_conf_t i2c_config[] = { + { + .dev = I2C0, + .sda_pin = GPIO_PIN(PC, 7), + .scl_pin = GPIO_PIN(PC, 5), + .cmu = cmuClock_I2C0, + .irq = I2C0_IRQn, + .speed = I2C_SPEED_NORMAL + } +}; + +#define I2C_NUMOF ARRAY_SIZE(i2c_config) +#define I2C_0_ISR isr_i2c0 +/** @} */ + +/** + * @name SPI configuration + * @{ + */ +static const spi_dev_t spi_config[] = { + { + .dev = USART0, + .mosi_pin = GPIO_PIN(PC, 1), + .miso_pin = GPIO_PIN(PC, 2), + .clk_pin = GPIO_PIN(PC, 3), + .cmu = cmuClock_USART0, + .irq = USART0_RX_IRQn + } +}; + +#define SPI_NUMOF ARRAY_SIZE(spi_config) +/** @} */ + +/** + * @name Timer configuration + * + * The implementation can use one low-energy timer + * or two regular timers in cascade mode. + * @{ + */ +static const timer_conf_t timer_config[] = { + { + .dev = TIMER0, + .cmu = cmuClock_TIMER0, + .irq = TIMER0_IRQn + }, + { + .dev = LETIMER0, + .cmu = cmuClock_LETIMER0, + .irq = LETIMER0_IRQn + } +}; + +#define TIMER_0_ISR isr_timer0 +#define TIMER_1_ISR isr_letimer0 + +#define TIMER_0_MAX_VALUE TIMER_MAX_VALUE +#define TIMER_1_MAX_VALUE LETIMER_MAX_VALUE + +#define TIMER_NUMOF ARRAY_SIZE(timer_config) +/** @} */ + +/** + * @name UART configuration + * @{ + */ +static const uart_conf_t uart_config[] = { + { + .dev = EUSART1, + .rx_pin = GPIO_PIN(PA, 9), + .tx_pin = GPIO_PIN(PA, 8), + .cmu = cmuClock_EUSART1, + .irq = EUSART1_RX_IRQn + } +}; +#define UART_0_ISR_RX isr_eusart1_rx + +#define UART_NUMOF ARRAY_SIZE(uart_config) +/** @} */ + +#ifdef __cplusplus +} +#endif + +#endif /* PERIPH_CONF_H */ +/** @} */ diff --git a/dist/tools/doccheck/exclude_patterns b/dist/tools/doccheck/exclude_patterns index 6492771fa715..c0c0011d6225 100644 --- a/dist/tools/doccheck/exclude_patterns +++ b/dist/tools/doccheck/exclude_patterns @@ -13110,3 +13110,26 @@ boards/sltb009a/include/periph_conf\.h:[0-9]+: warning: Member TIMER_[A-Z0-9_]+ boards/sltb009a/include/periph_conf\.h:[0-9]+: warning: Member timer_config\[\] \(variable) of file periph_conf\.h is not documented. boards/sltb009a/include/periph_conf\.h:[0-9]+: warning: Member UART_[A-Z0-9_]+ \(macro definition) of file periph_conf\.h is not documented. boards/sltb009a/include/periph_conf\.h:[0-9]+: warning: Member uart_config\[\] \(variable) of file periph_conf\.h is not documented. +boards/xg23\-pk6068a/include/board\.h:[0-9]+: warning: Member CONFIG_ZTIMER_[A-Z_]+ \(macro definition\) of file board\.h is not documented\. +boards/xg23\-pk6068a/include/board\.h:[0-9]+: warning: Member VCOM_[A-Z_]+ \(macro definition\) of file board\.h is not documented\. +boards/xg23\-pk6068a/include/board\.h:[0-9]+: warning: Member PB[0-1]_PIN \(macro definition\) of file board\.h is not documented\. +boards/xg23\-pk6068a/include/board\.h:[0-9]+: warning: Member DISP_[A-Z_]+ \(macro definition\) of file board\.h is not documented\. +boards/xg23\-pk6068a/include/board\.h:[0-9]+: warning: Member FLASH_[A-Z_]+ \(macro definition\) of file board\.h is not documented\. +boards/xg23\-pk6068a/include/board\.h:[0-9]+: warning: Member SENSOR_[A-Z0-9_]+ \(macro definition\) of file board\.h is not documented\. +boards/xg23\-pk6068a/include/periph_conf\.h:[0-9]+: warning: Member HFXO_FREQ \(macro definition\) of file periph_conf\.h is not documented\. +boards/xg23\-pk6068a/include/periph_conf\.h:[0-9]+: warning: Member CMU_HFXOINIT \(macro definition\) of file periph_conf\.h is not documented\. +boards/xg23\-pk6068a/include/periph_conf\.h:[0-9]+: warning: Member LFXO_FREQ \(macro definition\) of file periph_conf\.h is not documented\. +boards/xg23\-pk6068a/include/periph_conf\.h:[0-9]+: warning: Member CMU_LFXOINIT \(macro definition\) of file periph_conf\.h is not documented\. +boards/xg23\-pk6068a/include/periph_conf\.h:[0-9]+: warning: Member CLK_MUX_NUMOF \(macro definition\) of file periph_conf\.h is not documented\. +boards/xg23\-pk6068a/include/periph_conf\.h:[0-9]+: warning: Member CLK_DIV_NUMOF \(macro definition\) of file periph_conf\.h is not documented\. +boards/xg23\-pk6068a/include/periph_conf\.h:[0-9]+: warning: Member clk_mux_config\[\] \(variable\) of file periph_conf\.h is not documented\. +boards/xg23\-pk6068a/include/periph_conf\.h:[0-9]+: warning: Member clk_div_config\[\] \(variable\) of file periph_conf\.h is not documented\. +boards/xg23\-pk6068a/include/periph_conf\.h:[0-9]+: warning: Member I2C_[0-9A-Z_]+ \(macro definition\) of file periph_conf\.h is not documented\. +boards/xg23\-pk6068a/include/periph_conf\.h:[0-9]+: warning: Member i2c_config\[\] \(variable\) of file periph_conf\.h is not documented\. +boards/xg23\-pk6068a/include/periph_conf\.h:[0-9]+: warning: Member SPI_NUMOF \(macro definition\) of file periph_conf\.h is not documented\. +boards/xg23\-pk6068a/include/periph_conf\.h:[0-9]+: warning: Member spi_config\[\] \(variable\) of file periph_conf\.h is not documented\. +boards/xg23\-pk6068a/include/periph_conf\.h:[0-9]+: warning: Member TIMER_[0-9A-Z_]+ \(macro definition\) of file periph_conf\.h is not documented\. +boards/xg23\-pk6068a/include/periph_conf\.h:[0-9]+: warning: Member timer_config\[\] \(variable\) of file periph_conf\.h is not documented\. +boards/xg23\-pk6068a/include/periph_conf\.h:[0-9]+: warning: Member UART_0_ISR_RX \(macro definition\) of file periph_conf\.h is not documented\. +boards/xg23\-pk6068a/include/periph_conf\.h:[0-9]+: warning: Member UART_NUMOF \(macro definition\) of file periph_conf\.h is not documented\. +boards/xg23\-pk6068a/include/periph_conf\.h:[0-9]+: warning: Member uart_config\[\] \(variable\) of file periph_conf\.h is not documented\. diff --git a/examples/twr_aloha/Makefile b/examples/twr_aloha/Makefile index 94a79a03ca5b..d9d4e161850e 100644 --- a/examples/twr_aloha/Makefile +++ b/examples/twr_aloha/Makefile @@ -40,6 +40,9 @@ USEMODULE += event_timeout_ztimer USEMODULE += event_periodic USEMODULE += test_utils_result_output +# Collision between defines of Silabs SDK and mynewt-core +BOARD_BLACKLIST := xg23-pk6068a + # All uwb-core applications need to enable `-fms-extensions` CFLAGS += -fms-extensions ifneq (,$(filter llvm,$(TOOLCHAIN)))