Skip to content

Commit

Permalink
boards/qn9080dk: New board for the QN908x
Browse files Browse the repository at this point in the history
The QN9080DK is the developer board reference from NXP for the QN908x
CPUs. The developer kit comes with two boards: a larger PCB with many
peripherals and a much smaller "USB dongle". This board adds initial
support for the larger "DK board". At the moment, with the minimal CPU
support this board only configures the GPIOs available in the board,
namely the RGB LED and the two user buttons.
  • Loading branch information
iosabi committed Nov 30, 2020
1 parent 469f87c commit 1b1c588
Show file tree
Hide file tree
Showing 11 changed files with 378 additions and 0 deletions.
21 changes: 21 additions & 0 deletions 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"
6 changes: 6 additions & 0 deletions boards/qn9080dk/Makefile
@@ -0,0 +1,6 @@
MODULE = board

# Use the common qn908x board.
DIRS += $(RIOTBOARD)/common/qn908x

include $(RIOTBASE)/Makefile.base
3 changes: 3 additions & 0 deletions boards/qn9080dk/Makefile.dep
@@ -0,0 +1,3 @@
ifneq (,$(filter saul_default,$(USEMODULE)))
USEMODULE += saul_gpio
endif
8 changes: 8 additions & 0 deletions 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
8 changes: 8 additions & 0 deletions 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
37 changes: 37 additions & 0 deletions 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 <iosabi@protonmail.com>
*
* @}
*/

#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();
}
62 changes: 62 additions & 0 deletions 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/).

*/
69 changes: 69 additions & 0 deletions 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 <iosabi@protonmail.com>
*/

#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 */
/** @} */
71 changes: 71 additions & 0 deletions 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 <iosabi@protonmail.com>
*/

#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 */
/** @} */
49 changes: 49 additions & 0 deletions 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 <iosabi@protonmail.com>
*/

#ifndef PERIPH_CONF_H
#define PERIPH_CONF_H

#include <stdint.h>

#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 */
/** @} */
44 changes: 44 additions & 0 deletions cpu/qn908x/include/vendor/fsl_common.h
@@ -0,0 +1,44 @@
/*
* 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 cpu_qn908x
* @{
*
* @file
* @brief Wrapper header for SDK drivers.
*
* Vendor SDK drivers include "fsl_common.h" with many definitions and extra
* dependencies on more headers that are not used in the RIOT-OS port. This
* header is a wrapper intended to keep the SDK headers unchanged and provide
* the essential definitions needed by other SDK modules.
*
* @author iosabi <iosabi@protonmail.com>
*/

#ifndef FSL_COMMON_H
#define FSL_COMMON_H

#include <stdint.h>
#include <stdbool.h>
#include <assert.h>

#include "irq.h"
#include "vectors_cortexm.h"

#include "QN908XC.h"
#include "QN908XC_features.h"

/* RIOT-OS equivalent functions. */
#define DisableGlobalIRQ irq_disable
#define EnableGlobalIRQ irq_restore

#define __Vectors cortex_vector_base

#endif /* FSL_COMMON_H */
/** @} */

0 comments on commit 1b1c588

Please sign in to comment.