diff --git a/boards/qn9080dk/Kconfig b/boards/qn9080dk/Kconfig new file mode 100644 index 0000000000..2d175d08ad --- /dev/null +++ b/boards/qn9080dk/Kconfig @@ -0,0 +1,21 @@ +# Copyright (c) 2020 iosabi +# +# 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 "qn9080dk" if BOARD_QN9080DK + +config BOARD_QN9080DK + bool + default y + select BOARD_COMMON_QN908X + select CPU_MODEL_QN9080XHN + + # Put defined MCU peripherals here (in alphabetical order) + select BOARD_HAS_XTAL32K + select BOARD_HAS_XTAL_32M + +source "$(RIOTBOARD)/common/qn908x/Kconfig" diff --git a/boards/qn9080dk/Makefile b/boards/qn9080dk/Makefile new file mode 100644 index 0000000000..f25f4d547b --- /dev/null +++ b/boards/qn9080dk/Makefile @@ -0,0 +1,6 @@ +MODULE = board + +# Use the common qn908x board. +DIRS += $(RIOTBOARD)/common/qn908x + +include $(RIOTBASE)/Makefile.base diff --git a/boards/qn9080dk/Makefile.dep b/boards/qn9080dk/Makefile.dep new file mode 100644 index 0000000000..5472bf8b8d --- /dev/null +++ b/boards/qn9080dk/Makefile.dep @@ -0,0 +1,3 @@ +ifneq (,$(filter saul_default,$(USEMODULE))) + USEMODULE += saul_gpio +endif diff --git a/boards/qn9080dk/Makefile.features b/boards/qn9080dk/Makefile.features new file mode 100644 index 0000000000..e79116aff7 --- /dev/null +++ b/boards/qn9080dk/Makefile.features @@ -0,0 +1,8 @@ +CPU = qn908x +CPU_MODEL = qn9080xhn + +# Put defined MCU peripherals here (in alphabetical order) +FEATURES_PROVIDED += periph_gpio periph_gpio_irq + +# Include the common qn908x board features. +include $(RIOTBOARD)/common/qn908x/Makefile.features diff --git a/boards/qn9080dk/Makefile.include b/boards/qn9080dk/Makefile.include new file mode 100644 index 0000000000..8b4d55b667 --- /dev/null +++ b/boards/qn9080dk/Makefile.include @@ -0,0 +1,8 @@ +CFLAGS += \ + -DCONFIG_BOARD_HAS_XTAL \ + -DCONFIG_BOARD_HAS_XTAL32K \ + -DCONFIG_BOARD_HAS_XTAL_32M \ + # + +# Include default QN908x board config +include $(RIOTBOARD)/common/qn908x/Makefile.include diff --git a/boards/qn9080dk/board.c b/boards/qn9080dk/board.c new file mode 100644 index 0000000000..d74d9ddf82 --- /dev/null +++ b/boards/qn9080dk/board.c @@ -0,0 +1,37 @@ +/* + * Copyright (C) 2020 iosabi + * + * 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_qn9080dk + * @{ + * + * @file + * @brief Board specific implementations for the QN9080DK base board + * + * @author iosabi + * + * @} + */ + +#include "cpu.h" +#include "board.h" + +#include "periph/gpio.h" + +void board_init(void) +{ + /* Initialize LEDs and Buttons. */ + gpio_init(LED_RED_PIN, GPIO_OUT); + gpio_init(LED_GREEN_PIN, GPIO_OUT); + gpio_init(LED_BLUE_PIN, GPIO_OUT); + gpio_init(BTN1_PIN, BTN1_MODE); + gpio_init(BTN2_PIN, BTN2_MODE); + + /* initialize the CPU */ + cpu_init(); +} diff --git a/boards/qn9080dk/doc.txt b/boards/qn9080dk/doc.txt new file mode 100644 index 0000000000..faf0de5aa1 --- /dev/null +++ b/boards/qn9080dk/doc.txt @@ -0,0 +1,62 @@ +/** +@defgroup boards_qn9080dk QN9080DK base board +@ingroup boards +@brief Support for the QN9080DK base board. + +### General information + +The QN9080DK is the developer board reference from NXP for the QN908x CPUs. +The developer kit comes with two boards: a larger PCB with a QFN "module" +including a QN9080DHN soldered onto it, altogether referred as the "base +board"; and separately a much smaller USB dongle with another QN9080 cpu. +This board module supports the "base board" only, including the definitions +of the gpio, buttons and LEDs specific to this board. + +This board packs a few peripherals and many GPIOs: + + * MMA8652FC, a 12-bit accelerometer + * + +The board also features a dedicated programmer hardware implemented using NXP's +LPC4322, with its dedicated USB port for connecting to a computer on one end +and the SWD port and one UART RX/TX pair connected to the QN9080 on the other +end. The LPC4322 also has a fast (50 ksps) ADC ADC122S021 connected to a +current sense amplifier to monitor the QN9080 current profile directly on +the board. + +For more information visit NXP's product description page for the +[QN9080-DK](https://www.nxp.com/QN9080DK) where you can find the User's +Guide. + +### User Interface + +Buttons: + +| Label | RIOT OS macro | MCU PIN | Function | +|:----- |:------------- |:-------- |:--------- | +| SW1 | BTN1_PIN | PA24 | User defined | +| SW2 | BTN2_PIN | PA19 | User defined | +| SW3 | | nRESET | QN9080 reset | + + +One RGB led, controlled by three GPIOs + +| Label | RIOT OS macro | MCU PIN | +|:----- |:------------- |:-------- | +| red | LED_RED_PIN | PA31 | +| green | LED_GREEN_PIN | PA25 | +| blue | LED_BLUE_PIN | PA13 | + +### Pinout + +Button1: + +### Flash the board + +The board can be flashed using the internal LPC4322 JTAG/SWD debugger or an +external debugger connected to P1, selected using JP2. + +OpenOCD support for the QN908x is experimental and available as pending +[patch](http://openocd.zylin.com/#/c/5584/). + + */ diff --git a/boards/qn9080dk/include/board.h b/boards/qn9080dk/include/board.h new file mode 100644 index 0000000000..421536c7c7 --- /dev/null +++ b/boards/qn9080dk/include/board.h @@ -0,0 +1,69 @@ +/* + * Copyright (C) 2020 iosabi + * + * 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_qn9080dk + * @{ + * + * @file + * @brief Board specific definitions for the QN9080DK base board + * + * @author iosabi + */ + +#ifndef BOARD_H +#define BOARD_H + +#include "cpu.h" +#include "periph_conf.h" +#include "periph_cpu.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @name Clock configuration + * @{ + */ +#ifndef CLOCK_CORECLOCK +/* Using 32MHz internal oscillator as default clock source */ +#define CLOCK_CORECLOCK (32000000ul) +#endif +/** @} */ + +/** + * @name LED configuration + * @{ + */ +#define LED_RED_PIN GPIO_PIN(PORT_A, 31) +#define LED_GREEN_PIN GPIO_PIN(PORT_A, 25) +#define LED_BLUE_PIN GPIO_PIN(PORT_A, 13) +/** @} */ + +/** + * @name User buttons + * @{ + */ +#define BTN1_PIN GPIO_PIN(PORT_A, 24) +#define BTN1_MODE GPIO_IN_PU +#define BTN2_PIN GPIO_PIN(PORT_A, 19) +#define BTN2_MODE GPIO_IN_PU +/** @} */ + +/** + * @brief Initialize board specific hardware + */ +void board_init(void); + +#ifdef __cplusplus +} +#endif + +#endif /* BOARD_H */ +/** @} */ diff --git a/boards/qn9080dk/include/gpio_params.h b/boards/qn9080dk/include/gpio_params.h new file mode 100644 index 0000000000..365a33d8d5 --- /dev/null +++ b/boards/qn9080dk/include/gpio_params.h @@ -0,0 +1,71 @@ +/* + * Copyright (C) 2020 iosabi + * + * 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_qn9080dk + * @{ + * + * @file + * @brief Board specific configuration of direct mapped GPIOs + * + * @author iosabi + */ + +#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 red", + .pin = LED_RED_PIN, + .mode = GPIO_OUT, + .flags = SAUL_GPIO_INIT_CLEAR, + }, + { + .name = "LED green", + .pin = LED_GREEN_PIN, + .mode = GPIO_OUT, + .flags = SAUL_GPIO_INIT_CLEAR, + }, + { + .name = "LED blue", + .pin = LED_BLUE_PIN, + .mode = GPIO_OUT, + .flags = SAUL_GPIO_INIT_CLEAR, + }, + { + .name = "Button(SW1)", + .pin = BTN1_PIN, + .mode = BTN1_MODE, + .flags = SAUL_GPIO_INVERTED, + }, + { + .name = "Button(SW2)", + .pin = BTN2_PIN, + .mode = BTN2_MODE, + .flags = SAUL_GPIO_INVERTED, + }, +}; + +#ifdef __cplusplus +} +#endif + +#endif /* GPIO_PARAMS_H */ +/** @} */ diff --git a/boards/qn9080dk/include/periph_conf.h b/boards/qn9080dk/include/periph_conf.h new file mode 100644 index 0000000000..a028149990 --- /dev/null +++ b/boards/qn9080dk/include/periph_conf.h @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2020 iosabi + * + * 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_qn9080dk + * @{ + * + * @file + * @brief Configuration of CPU peripherals for QN9080DK base board board + * + * @author iosabi + */ + +#ifndef PERIPH_CONF_H +#define PERIPH_CONF_H + +#include + +#include "cpu.h" +#include "periph_cpu.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* put here the board peripherals definitions: + - Available clocks + - Timers + - UARTs + - PWMs + - SPIs + - I2C + - ADC + - RTC + - RTT + etc + */ + +#ifdef __cplusplus +} +#endif + +#endif /* PERIPH_CONF_H */ +/** @} */