1.. _96b_carbon_nrf51_board: 2 396Boards Carbon nRF51 4##################### 5 6Overview 7******** 8 9This is the secondary nRF51822 chip on the 96Boards Carbon and provides 10Bluetooth functionality to the main STM32F401RET chip via SPI. 11 12.. note:: 13 14 If you're looking to reprogram the main STMicro part, see 15 :ref:`96b_carbon_board`. Users should not use this configuration 16 unless they want to reprogram the secondary chip which provides 17 Bluetooth connectivity. 18 19 20Hardware 21******** 22 23The 96Boards Carbon nRF51 has two external oscillators. The frequency 24of the slow clock is 32.768 kHz. The frequency of the main clock is 16 25MHz. 26 27See :ref:`96b_carbon_board` for other general information about the 28board; that configuration is for the same physical board, just a 29different chip. 30 31Supported Features 32================== 33 34+-----------+------------+-------------------------------------+ 35| Interface | Controller | Driver/Component | 36+===========+============+=====================================+ 37| NVIC | on-chip | nested vector interrupt controller | 38+-----------+------------+-------------------------------------+ 39| RTC | on-chip | system clock | 40+-----------+------------+-------------------------------------+ 41| UART | on-chip | serial port | 42+-----------+------------+-------------------------------------+ 43| GPIO | on-chip | gpio | 44+-----------+------------+-------------------------------------+ 45| FLASH | on-chip | flash | 46+-----------+------------+-------------------------------------+ 47| SPIS | on-chip | SPI slave | 48+-----------+------------+-------------------------------------+ 49| RADIO | on-chip | Bluetooth | 50+-----------+------------+-------------------------------------+ 51 52The default configuration can be found in 53:zephyr_file:`boards/96boards/carbon/96b_carbon_nrf51822_defconfig` 54 55Connections and IOs 56=================== 57 58SPI 59--- 60 6196Boards Carbon nRF51 has one SPI, which for providing Bluetooth 62communication. The default SPI mapping for Zephyr is: 63 64- SPI1_NSS : P0.25 65- SPI1_SCK : P0.07 66- SPI1_MISO : P0.30 67- SPI1_MOSI : P0.00 68 69The SWD debug pins are broken out to an external header; all other 70connected pins are to the main STM32F401RET chip. 71 72.. _96b_carbon_nrf51_programming: 73 74Programming and Debugging 75************************* 76 77Flashing 78======== 79 80The 96Boards Carbon nRF51 can be flashed using an external SWD 81debugger, via the debug header labeled "BLE" on the board's 82silkscreen. The header is not populated; 0.1" male header must be 83soldered on first. 84 85.. figure:: img/96b_carbon_nrf51.jpg 86 :align: center 87 :alt: 96Boards Carbon nRF51 Debug 88 89 96Boards Carbon nRF51 Debug 90 91The following example assumes a Zephyr binary ``zephyr.elf`` will be 92flashed to the board. 93 94It uses the `Black Magic Debug Probe`_ as an SWD programmer, which can 95be connected to the BLE debug header using flying leads and its 20 Pin 96JTAG Adapter Board Kit. When plugged into your host PC, the Black 97Magic Debug Probe enumerates as a USB serial device as documented on 98its `Getting started page`_. 99 100It also uses the GDB binary provided with the Zephyr SDK, 101``arm-zephyr-eabi-gdb``. Other GDB binaries, such as the GDB from GCC 102ARM Embedded, can be used as well. 103 104.. code-block:: console 105 106 $ arm-zephyr-eabi-gdb -q zephyr.elf 107 (gdb) target extended-remote /dev/ttyACM0 108 Remote debugging using /dev/ttyACM0 109 (gdb) monitor swdp_scan 110 Target voltage: 3.3V 111 Available Targets: 112 No. Att Driver 113 1 nRF51 114 (gdb) attach 1 115 Attaching to Remote target 116 0xabcdef12 in ?? () 117 (gdb) load 118 119Debugging 120========= 121 122After you've flashed the chip, you can keep debugging using the same 123GDB instance. To reattach, just follow the same steps above, but don't 124run "load". You can then debug as usual with GDB. In particular, type 125"run" at the GDB prompt to restart the program you've flashed. 126 127As an aid to debugging, this board configuration directs a console 128output to a currently unused pin connected to the STM32F401RET. Users 129who are experienced in electronics rework can remove a resistor (R22) 130on the board and attach a wire to the nRF51822's UART output. 131 132.. _96b_carbon_nrf51_bluetooth: 133 134Providing Bluetooth to 96b_carbon 135********************************* 136 137This ``96b_carbon/nrf51822`` Zephyr board configuration can be used to provide 138Bluetooth functionality from the secondary nRF51822 chip to the 139primary STM32F401RE chip on the :ref:`96b_carbon_board`. 140 141To do this, build the ``samples/bluetooth/hci_spi/`` application 142provided with Zephyr with ``BOARD=96b_carbon/nrf51822``, then flash it to 143the nRF51822 chip using the instructions :ref:`above 144<96b_carbon_nrf51_programming>`. (For instructions on how to build a 145Zephyr application, see :ref:`build_an_application`.) 146 147.. warning:: 148 149 Be sure to flash the hci_spi application to the nRF51822 chip and 150 not to the main STM32F401RET chip. While both chips are supported 151 by Zephyr, the hci_spi application providing Bluetooth support will 152 only run on the nRF51822 chip. 153 154References 155********** 156 157- `Board documentation from 96Boards`_ 158- `nRF51822 information from Nordic Semiconductor`_ 159 160.. _Black Magic Debug Probe: 161 https://github.com/blacksphere/blackmagic/wiki 162 163.. _Getting started page: 164 https://github.com/blacksphere/blackmagic/wiki/Getting-Started 165 166.. _Board documentation from 96Boards: 167 http://www.96boards.org/product/carbon/ 168 169.. _nRF51822 information from Nordic Semiconductor: 170 https://www.nordicsemi.com/eng/Products/Bluetooth-low-energy/nRF51822 171