diff --git a/boards/arm/96b_carbon_nrf51/96b_carbon_nrf51_defconfig b/boards/arm/96b_carbon_nrf51/96b_carbon_nrf51_defconfig new file mode 100644 index 00000000000..7a25289a5ba --- /dev/null +++ b/boards/arm/96b_carbon_nrf51/96b_carbon_nrf51_defconfig @@ -0,0 +1,34 @@ +CONFIG_ARM=y +CONFIG_SOC_FAMILY_NRF5=y +CONFIG_SOC_SERIES_NRF51X=y +CONFIG_SOC_NRF51822_QFAC=y +CONFIG_BOARD_96B_CARBON_NRF51=y + +# enable uart driver +CONFIG_SERIAL=y +CONFIG_UART_NRF5=y +CONFIG_UART_NRF5_GPIO_TX_PIN=29 +CONFIG_UART_NRF5_GPIO_RX_PIN=11 + +# enable console +CONFIG_CONSOLE=y +CONFIG_UART_CONSOLE=y + +# bluetooth +CONFIG_BLUETOOTH=y +CONFIG_BLUETOOTH_CONTROLLER=y + +# spi +CONFIG_SPI=y +CONFIG_SPI_1=y +CONFIG_SPI_1_NAME="SPI_1" +CONFIG_SPI_1_IRQ_PRI=1 +CONFIG_SPI_NRF5=y +CONFIG_SPIS1_NRF5=y +CONFIG_SPIS1_NRF5_GPIO_SCK_PIN=7 +CONFIG_SPIS1_NRF5_GPIO_MOSI_PIN=0 +CONFIG_SPIS1_NRF5_GPIO_MISO_PIN=30 +CONFIG_SPIS1_NRF5_GPIO_CSN_PIN=25 + +#enable DTS +CONFIG_HAS_DTS=y diff --git a/boards/arm/96b_carbon_nrf51/Kconfig.board b/boards/arm/96b_carbon_nrf51/Kconfig.board new file mode 100644 index 00000000000..8a56f0a5755 --- /dev/null +++ b/boards/arm/96b_carbon_nrf51/Kconfig.board @@ -0,0 +1,9 @@ +# Kconfig - 96Boards Carbon nRF51 board configuration +# +# Copyright (c) 2016, 2017 Linaro Limited. +# +# SPDX-License-Identifier: Apache-2.0 + +config BOARD_96B_CARBON_NRF51 + bool "96Boards Carbon (nRF51)" + depends on SOC_NRF51822_QFAC diff --git a/boards/arm/96b_carbon_nrf51/Kconfig.defconfig b/boards/arm/96b_carbon_nrf51/Kconfig.defconfig new file mode 100644 index 00000000000..198fd9705cd --- /dev/null +++ b/boards/arm/96b_carbon_nrf51/Kconfig.defconfig @@ -0,0 +1,25 @@ +# Kconfig - 96Boards Carbon nRF51 board default configuration +# +# Copyright (c) 2016, 2017 Linaro Limited. +# +# SPDX-License-Identifier: Apache-2.0 + +if BOARD_96B_CARBON_NRF51 + +config BOARD + default 96b_carbon_nrf51 + +if UART_NRF5 + +config GPIO + default y + +config GPIO_NRF5 + default y + +config GPIO_NRF5_P0 + default y + +endif # UART_NRF5 + +endif # BOARD_96B_CARBON_NRF51 diff --git a/boards/arm/96b_carbon_nrf51/Makefile b/boards/arm/96b_carbon_nrf51/Makefile new file mode 100644 index 00000000000..6bea3d3a2dd --- /dev/null +++ b/boards/arm/96b_carbon_nrf51/Makefile @@ -0,0 +1 @@ +obj- += dummy.o diff --git a/boards/arm/96b_carbon_nrf51/board.h b/boards/arm/96b_carbon_nrf51/board.h new file mode 100644 index 00000000000..5abf3619d88 --- /dev/null +++ b/boards/arm/96b_carbon_nrf51/board.h @@ -0,0 +1,12 @@ +/* + * Copyright (c) 2016, 2017 Linaro Limited. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#ifndef __INC_BOARD_H +#define __INC_BOARD_H + +#include + +#endif /* __INC_BOARD_H */ diff --git a/boards/arm/96b_carbon_nrf51/doc/96b_carbon_nrf51.rst b/boards/arm/96b_carbon_nrf51/doc/96b_carbon_nrf51.rst new file mode 100644 index 00000000000..829e9513140 --- /dev/null +++ b/boards/arm/96b_carbon_nrf51/doc/96b_carbon_nrf51.rst @@ -0,0 +1,136 @@ +.. _96b_carbon_nrf51_board: + +96Boards Carbon nRF51 +##################### + +.. note:: + + If you're looking to reprogram the main STMicro part, see + :ref:`96b_carbon_board`. Users should not use this configuration + unless they want to reprogram the secondary chip which provides + Bluetooth connectivity. + +Overview +******** + +Zephyr applications use the 96b_carbon_nrf51 configuration to run on +the secondary nRF51822 chip on the 96Boards Carbon. This chip provides +Bluetooth functionality to the main STM32F401RET chip via SPI. + +Hardware +******** + +The 96Boards Carbon nRF51 has two external oscillators. The frequency +of the slow clock is 32.768 kHz. The frequency of the main clock is 16 +MHz. + +See :ref:`96b_carbon_board` for other general information about the +board; that configuration is for the same physical board, just a +different chip. + +Supported Features +================== + ++-----------+------------+-------------------------------------+ +| Interface | Controller | Driver/Component | ++===========+============+=====================================+ +| NVIC | on-chip | nested vector interrupt controller | ++-----------+------------+-------------------------------------+ +| RTC | on-chip | system clock | ++-----------+------------+-------------------------------------+ +| UART | on-chip | serial port | ++-----------+------------+-------------------------------------+ +| GPIO | on-chip | gpio | ++-----------+------------+-------------------------------------+ +| FLASH | on-chip | flash | ++-----------+------------+-------------------------------------+ +| SPIS | on-chip | SPI slave | ++-----------+------------+-------------------------------------+ +| RADIO | on-chip | bluetooth | ++-----------+------------+-------------------------------------+ + +The default configuration can be found in the defconfig file: + + ``boards/arm/96b_carbon_nrf51/96b_carbon_nrf51_defconfig`` + +Connections and IOs +=================== + +The SWD debug pins are broken out to an external header; all other +connected pins are to the main STM32F401RET chip. + +Programming and Debugging +************************* + +Flashing +======== + +The 96Boards Carbon nRF51 can be flashed using an external SWD +debugger, via the debug header labeled "BLE" on the board's +silkscreen. The header is not populated; 0.1" male header must be +soldered on first. + +.. figure:: img/96b-carbon-nrf51-debug.png + :align: center + :alt: 96Boards Carbon nRF51 Debug + + 96Boards Carbon nRF51 Debug + +The following example assumes a Zephyr binary ``zephyr.elf`` will be +flashed to the board. + +It uses the `Black Magic Debug Probe`_ as an SWD programmer, which can +be connected to the BLE debug header using flying leads and its 20 Pin +JTAG Adapter Board Kit. When plugged into your host PC, the Black +Magic Debug Probe enumerates as a USB serial device as documented on +its `Getting started page`_. + +It also uses the GDB binary provided with the Zephyr SDK, +``arm-zephyr-eabi-gdb``. Other GDB binaries, such as the GDB from GCC +ARM Embedded, can be used as well. + +.. code-block:: console + + $ arm-zephyr-eabi-gdb -q zephyr.elf + (gdb) target extended-remote /dev/ttyACM0 + Remote debugging using /dev/ttyACM0 + (gdb) monitor swdp_scan + Target voltage: 3.3V + Available Targets: + No. Att Driver + 1 nRF51 + (gdb) attach 1 + Attaching to Remote target + 0xabcdef12 in ?? () + (gdb) load + +Debugging +========= + +After you've flashed the chip, you can keep debugging using the same +GDB instance. To reattach, just follow the same steps above, but don't +run "load". You can then debug as usual with GDB. In particular, type +"run" at the GDB prompt to restart the program you've flashed. + +As an aid to debugging, this board configuration directs a console +output to a currently unused pin connected to the STM32F401RET. Users +who are experienced in electronics rework can remove a resistor (R22) +on the board and attach a wire to the nRF51822's UART output. + +References +********** + +- `Board documentation from 96Boards`_ +- `nRF51822 information from Nordic Semiconductor`_ + +.. _Black Magic Debug Probe: + https://github.com/blacksphere/blackmagic/wiki + +.. _Getting started page: + https://github.com/blacksphere/blackmagic/wiki/Getting-Started + +.. _Board documentation from 96Boards: + http://www.96boards.org/product/carbon/ + +.. _nRF51822 information from Nordic Semiconductor: + https://www.nordicsemi.com/eng/Products/Bluetooth-low-energy/nRF51822 diff --git a/boards/arm/96b_carbon_nrf51/doc/img/96b-carbon-nrf51-debug.png b/boards/arm/96b_carbon_nrf51/doc/img/96b-carbon-nrf51-debug.png new file mode 100644 index 00000000000..a3484a46229 Binary files /dev/null and b/boards/arm/96b_carbon_nrf51/doc/img/96b-carbon-nrf51-debug.png differ diff --git a/dts/arm/96b_carbon_nrf51.dts b/dts/arm/96b_carbon_nrf51.dts new file mode 100644 index 00000000000..2d40f1be3dc --- /dev/null +++ b/dts/arm/96b_carbon_nrf51.dts @@ -0,0 +1,25 @@ +/* + * Copyright (c) 2017 Linaro Limited + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/dts-v1/; +#include + +/ { + model = "Seeed Studio Carbon nRF51 96board"; + compatible = "seeed,carbon_nrf51", "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/96b_carbon_nrf51.fixup b/dts/arm/96b_carbon_nrf51.fixup new file mode 100644 index 00000000000..afcf87a74b5 --- /dev/null +++ b/dts/arm/96b_carbon_nrf51.fixup @@ -0,0 +1,3 @@ +#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 diff --git a/dts/arm/Makefile b/dts/arm/Makefile index 614ebfc62d1..b4717cb7da6 100644 --- a/dts/arm/Makefile +++ b/dts/arm/Makefile @@ -13,6 +13,7 @@ dtb-$(CONFIG_BOARD_V2M_BEETLE) = v2m_beetle.dts_compiled dtb-$(CONFIG_BOARD_MPS2_AN385) = mps2_an385.dts_compiled dtb-$(CONFIG_BOARD_OLIMEXINO_STM32) = olimexino_stm32.dts_compiled dtb-$(CONFIG_BOARD_96B_CARBON) = 96b_carbon.dts_compiled +dtb-$(CONFIG_BOARD_96B_CARBON_NRF51) = 96b_carbon_nrf51.dts_compiled dtb-$(CONFIG_BOARD_NUCLEO_F401RE) = nucleo_f401re.dts_compiled dtb-$(CONFIG_BOARD_NUCLEO_F411RE) = nucleo_f411re.dts_compiled dtb-$(CONFIG_BOARD_NUCLEO_F103RB) = nucleo_f103rb.dts_compiled