diff --git a/boards/arm/nrf51_vbluno51/Kconfig.board b/boards/arm/nrf51_vbluno51/Kconfig.board new file mode 100644 index 00000000000..4f1b30b6f9f --- /dev/null +++ b/boards/arm/nrf51_vbluno51/Kconfig.board @@ -0,0 +1,9 @@ +# Kconfig - nRF51-VBLUNO51 board configuration +# +# Copyright (c) 2017 VNG IoT Lab Limited. +# +# SPDX-License-Identifier: Apache-2.0 + +config BOARD_NRF51_VBLUNO51 + bool "nRF51 VBLUno51 BLE" + depends on SOC_NRF51822_QFAC diff --git a/boards/arm/nrf51_vbluno51/Kconfig.defconfig b/boards/arm/nrf51_vbluno51/Kconfig.defconfig new file mode 100644 index 00000000000..56ea65ded55 --- /dev/null +++ b/boards/arm/nrf51_vbluno51/Kconfig.defconfig @@ -0,0 +1,62 @@ +# Kconfig - nRF51 VBLUno51 board configuration +# +# Copyright (c) 2017 VNG IoT Lab Limited. +# +# SPDX-License-Identifier: Apache-2.0 + +if BOARD_NRF51_VBLUNO51 + +config BOARD + default nrf51_vbluno51 + +if GPIO_NRF5 + +config GPIO_NRF5_P0 + default y + +endif # GPIO_NRF5 + +if UART_NRF5 + +config UART_NRF5_GPIO_TX_PIN + default 10 + +config UART_NRF5_GPIO_RX_PIN + default 11 + +config UART_NRF5_GPIO_RTS_PIN + default 12 + +config UART_NRF5_GPIO_CTS_PIN + default 13 + +endif # UART_NRF5 + +if I2C + +config I2C_NRF5 + def_bool y + +config I2C_0 + default y + +config I2C_0_IRQ_PRI + default 1 + +endif # I2C + +if I2C_NRF5 + +config I2C_NRF5_GPIO_SCL_PIN + default 30 + +config I2C_NRF5_GPIO_SCA_PIN + default 29 + +config I2C_0_DEFAULT_CFG + # Standard speed, master + default 0x11 + +endif # I2C_NRF5 + +endif # BOARD_NRF51_VBLUNO51 diff --git a/boards/arm/nrf51_vbluno51/Makefile b/boards/arm/nrf51_vbluno51/Makefile new file mode 100644 index 00000000000..c925263c43a --- /dev/null +++ b/boards/arm/nrf51_vbluno51/Makefile @@ -0,0 +1,2 @@ +# No C files (yet) +obj- += dummy.o diff --git a/boards/arm/nrf51_vbluno51/Makefile.board b/boards/arm/nrf51_vbluno51/Makefile.board new file mode 100644 index 00000000000..467efae2eab --- /dev/null +++ b/boards/arm/nrf51_vbluno51/Makefile.board @@ -0,0 +1,6 @@ +FLASH_SCRIPT = pyocd.sh +DEBUG_SCRIPT = pyocd.sh + +PYOCD_TARGET = nrf51 + +export FLASH_SCRIPT DEBUG_SCRIPT PYOCD_TARGET diff --git a/boards/arm/nrf51_vbluno51/board.h b/boards/arm/nrf51_vbluno51/board.h new file mode 100644 index 00000000000..2d55d888f19 --- /dev/null +++ b/boards/arm/nrf51_vbluno51/board.h @@ -0,0 +1,25 @@ +/* + * Copyright (c) 2017 VNG IoT Lab Limited. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#ifndef __INC_BOARD_H +#define __INC_BOARD_H + +#include + +/* Button*/ +#define BUT_GPIO_PIN 15 +#define BUT_GPIO_NAME CONFIG_GPIO_NRF5_P0_DEV_NAME +#define SW0_GPIO_PIN BUT_GPIO_PIN +#define SW0_GPIO_NAME BUT_GPIO_NAME + +/* Onboard GREEN LED 0 */ +#define LED0_GPIO_PIN 7 +#define LED0_GPIO_PORT CONFIG_GPIO_NRF5_P0_DEV_NAME + +#define LED_GPIO_PIN LED0_GPIO_PIN +#define LED_GPIO_PORT LED0_GPIO_PORT + +#endif /* __INC_BOARD_H */ diff --git a/boards/arm/nrf51_vbluno51/doc/img/nrf51_vbluno51.jpg b/boards/arm/nrf51_vbluno51/doc/img/nrf51_vbluno51.jpg new file mode 100644 index 00000000000..45273e2d7da Binary files /dev/null and b/boards/arm/nrf51_vbluno51/doc/img/nrf51_vbluno51.jpg differ diff --git a/boards/arm/nrf51_vbluno51/doc/img/nrf51_vbluno51_bot.jpg b/boards/arm/nrf51_vbluno51/doc/img/nrf51_vbluno51_bot.jpg new file mode 100644 index 00000000000..c61eaf4e0ea Binary files /dev/null and b/boards/arm/nrf51_vbluno51/doc/img/nrf51_vbluno51_bot.jpg differ diff --git a/boards/arm/nrf51_vbluno51/doc/img/vbluno51_frizting.png b/boards/arm/nrf51_vbluno51/doc/img/vbluno51_frizting.png new file mode 100644 index 00000000000..c422ce6a201 Binary files /dev/null and b/boards/arm/nrf51_vbluno51/doc/img/vbluno51_frizting.png differ diff --git a/boards/arm/nrf51_vbluno51/doc/img/vbluno51_nordic_pinout.png b/boards/arm/nrf51_vbluno51/doc/img/vbluno51_nordic_pinout.png new file mode 100644 index 00000000000..562b777e4fa Binary files /dev/null and b/boards/arm/nrf51_vbluno51/doc/img/vbluno51_nordic_pinout.png differ diff --git a/boards/arm/nrf51_vbluno51/doc/nrf51_vbluno51.rst b/boards/arm/nrf51_vbluno51/doc/nrf51_vbluno51.rst new file mode 100644 index 00000000000..0feb5d75807 --- /dev/null +++ b/boards/arm/nrf51_vbluno51/doc/nrf51_vbluno51.rst @@ -0,0 +1,141 @@ +.. _nrf51_vbluno51: + +nRF51-VBLUno51 +############## + +Overview +******** + +Zephyr uses the nrf51_vbluno51 board configuration to run on the VBLUno51 board, +a VNG Bluetooth Low Energy UNO using an nRF51822 ARM processor. + +.. figure:: img/nrf51_vbluno51.jpg + :align: center + :alt: nRF51_VBLUno51 + + nrf51_vbluno51 Top + +.. figure:: img/nrf51_vbluno51_bot.jpg + :align: center + :alt: nRF51_VBLUno51 Bottom + + nrf51_vbluno51 Bottom + +More information about the board can be found at the +`VBLUno51 wiki page`_. + +Hardware +******** + +VBLUno51 board has two external oscillators. The frequency of +the slow clock is 32.768 kHz. The frequency of the main clock +is 16 MHz. + +Supported Features +================== + +- CPU: + + Nordic nRF51822: ARM® Cortex™ M0 32bit. + + *Bluetooth Low Energy interface.* + + 256KB Flash, 32KB Ram. + + UART(1), I2C(2), SPI(1), PWM(3), SWD, Timer 16bit(3). + + 21 digital channels, 6 ADC 10bit channels. + + 1 Led and 1 Button onboard. + + GPIO Voltage: 0 – 3.3V. +- DAPLink (CMSIS-DAP) interface for program and debug: + + USB MSD: Drag and Drop programming flash memory. + + USB HID (DAP): CMSIS-DAP compliant debug channel. + + USB CDC: Virtual COM port for log, trace and terminal emulation. + +- Supports hardware flow control features (RTS/CTS). +- *Energy monitoring for BLE module by current measurement (Only VBLUno51_EM)* +- FOTA (Firmware over the air): Upgrade firmware over BLE interface. +- Build good applications with: + + Compiler and IDE: GCC, Keil MDK, IAR, Eclipse, Qt Creator. + + Frameworks: Arduino, ARM mbed-OS, Zephyr-OS, Nordic SDK, RIOT-OS, MyNewt-OS, ChibiOS, NuttX RTOS + + A lot of tutorials for Arduino, mbed-os and more. +- Pinout: Arduino Uno Rev3 compliant. +- Power: + + USB port. + + Power adapter: +9 -> +12V. + + 3V Battery: CR20xx holder + + Recharageable battery jump: +3.7 -> +12V +- Open source: Hardware design, firmware, packages, tutorial and example codes + +See `VBLUno51 wiki page`_ for full documents and tutorials about the VBLUno51 board. + +Connections and IOs +=================== + +LED +--- + +* LED = LED0 (green) = P0.7 + +Push buttons +------------ + +* BUTTON = BUT = SW0 = P0.15 + +More details +------------ + +.. figure:: img/vbluno51_nordic_pinout.png + :align: center + :alt: nRF51_VBLUno51 Pinout + + nrf51_vbluno51 Pinout + +.. figure:: img/vbluno51_frizting.png + :align: center + :alt: nRF51_VBLUno51 Fritzing part + + nrf51_vbluno51 Fritzing part + +Programming and Debugging +************************* + +Flashing +======== + +The VBLUno51 board has on-board DAPLink (CMSIS-DAP) interface for flashing and debugging. +You do not need any other programming device. +You only need to install pyOCD tool (https://pypi.python.org/pypi/pyOCD) + +This tutorial uses the blinky application :ref:`blinky-sample` + +See the :ref:`getting_started` for general information on setting up + your development environment. + +#. To build the Zephyr kernel along with the blinky sample app, enter: + + .. code-block:: console + + $ cd $ZEPHYR_BASE/samples/basic/blinky + $ make BOARD=nrf51_vbluno51 + +#. To build and flash the generated binary image to the board, enter: + + .. code-block:: console + + $ make BOARD=nrf51_vbluno51 flash + +Testing the VBLUno51 with Zephyr: buttons, LEDs, UART, BLE +********************************************************** + + Here are some sample applications that you can use to test different + components on the VBLUno51 board: + + * :ref:`hello_world` + * :ref:`blinky-sample` + * :ref:`button-sample` + * :ref:`bluetooth-beacon-sample` + * :ref:`peripheral_hr` + +References +********** + +.. target-notes:: + +.. _VBLUno51 website: http://iotviet.com.vn/store/detail?id=2 +.. _VBLUno51 wiki page: https://vngiotlab.github.io/vbluno/ diff --git a/boards/arm/nrf51_vbluno51/nrf51_vbluno51.yaml b/boards/arm/nrf51_vbluno51/nrf51_vbluno51.yaml new file mode 100644 index 00000000000..3107f16323f --- /dev/null +++ b/boards/arm/nrf51_vbluno51/nrf51_vbluno51.yaml @@ -0,0 +1,8 @@ +identifier: nrf51_vbluno51 +name: nRF51-VBLUno51 +type: mcu +arch: arm +toolchain: + - zephyr + - gccarmemb +ram: 32 diff --git a/boards/arm/nrf51_vbluno51/nrf51_vbluno51_defconfig b/boards/arm/nrf51_vbluno51/nrf51_vbluno51_defconfig new file mode 100644 index 00000000000..bb550e1e535 --- /dev/null +++ b/boards/arm/nrf51_vbluno51/nrf51_vbluno51_defconfig @@ -0,0 +1,17 @@ +CONFIG_ARM=y +CONFIG_SOC_FAMILY_NRF5=y +CONFIG_SOC_SERIES_NRF51X=y +CONFIG_SOC_NRF51822_QFAC=y +CONFIG_BOARD_NRF51_VBLUNO51=y + +# enable uart driver +CONFIG_SERIAL=y +CONFIG_UART_NRF5=y + +# enable console +CONFIG_CONSOLE=y +CONFIG_UART_CONSOLE=y + +# bluetooth +CONFIG_BLUETOOTH=y +CONFIG_BLUETOOTH_CONTROLLER=y diff --git a/dts/arm/Makefile b/dts/arm/Makefile index 655b43b9827..86b3f0215c7 100644 --- a/dts/arm/Makefile +++ b/dts/arm/Makefile @@ -35,6 +35,7 @@ dtb-$(CONFIG_BOARD_BBC_MICROBIT) = bbc_microbit.dts_compiled dtb-$(CONFIG_BOARD_CURIE_BLE) = curie_ble.dts_compiled dtb-$(CONFIG_BOARD_NRF51_BLENANO) = nrf51_blenano.dts_compiled dtb-$(CONFIG_BOARD_NRF51_PCA10028) = nrf51_pca10028.dts_compiled +dtb-$(CONFIG_BOARD_NRF51_VBLUNO51) = nrf51_vbluno51.dts_compiled dtb-$(CONFIG_BOARD_QUARK_SE_C1000_BLE) = quark_se_c1000_ble.dts_compiled dtb-$(CONFIG_BOARD_QEMU_CORTEX_M3) = qemu_cortex_m3.dts_compiled dtb-$(CONFIG_BOARD_SAM_E70_XPLAINED) = sam_e70_xplained.dts_compiled diff --git a/dts/arm/nrf51_vbluno51.dts b/dts/arm/nrf51_vbluno51.dts new file mode 100644 index 00000000000..886094ebd67 --- /dev/null +++ b/dts/arm/nrf51_vbluno51.dts @@ -0,0 +1,25 @@ +/* + * Copyright (c) 2017 VNG IoT Lab Limited + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/dts-v1/; +#include + +/ { + model = "VNG VBLUno51 BLE board"; + compatible = "vng,vbluno51", "nordic,nrf51822-qfac", + "nordic,nrf51822"; + + chosen { + zephyr,console = &uart0; + zephyr,sram = &sram0; + zephyr,flash = &flash0; + }; +}; + +&uart0 { + current-speed = <115200>; + status = "ok"; +}; diff --git a/dts/arm/nrf51_vbluno51.fixup b/dts/arm/nrf51_vbluno51.fixup new file mode 100644 index 00000000000..59499a1540e --- /dev/null +++ b/dts/arm/nrf51_vbluno51.fixup @@ -0,0 +1,4 @@ +#define CONFIG_NUM_IRQ_PRIO_BITS ARM_V6M_NVIC_E000E100_ARM_NUM_IRQ_PRIORITY_BITS +#define CONFIG_UART_NRF5_IRQ_PRI NORDIC_NRF_UART_40002000_IRQ_0_PRIORITY +#define CONFIG_UART_NRF5_BAUD_RATE NORDIC_NRF_UART_40002000_CURRENT_SPEED +#define CONFIG_UART_NRF5_NAME NORDIC_NRF_UART_40002000_LABEL