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 the defconfig file: 53 54 ``boards/arm/96b_carbon_nrf51/96b_carbon_nrf51_defconfig`` 55 56Connections and IOs 57=================== 58 59SPI 60--- 61 6296Boards Carbon nRF51 has one SPI, which for providing Bluetooth 63communication. The default SPI mapping for Zephyr is: 64 65- SPI1_NSS : P0.25 66- SPI1_SCK : P0.07 67- SPI1_MISO : P0.30 68- SPI1_MOSI : P0.00 69 70The SWD debug pins are broken out to an external header; all other 71connected pins are to the main STM32F401RET chip. 72 73.. _96b_carbon_nrf51_programming: 74 75Programming and Debugging 76************************* 77 78Flashing 79======== 80 81The 96Boards Carbon nRF51 can be flashed using an external SWD 82debugger, via the debug header labeled "BLE" on the board's 83silkscreen. The header is not populated; 0.1" male header must be 84soldered on first. 85 86.. figure:: img/96b_carbon_nrf51.jpg 87 :align: center 88 :alt: 96Boards Carbon nRF51 Debug 89 90 96Boards Carbon nRF51 Debug 91 92The following example assumes a Zephyr binary ``zephyr.elf`` will be 93flashed to the board. 94 95It uses the `Black Magic Debug Probe`_ as an SWD programmer, which can 96be connected to the BLE debug header using flying leads and its 20 Pin 97JTAG Adapter Board Kit. When plugged into your host PC, the Black 98Magic Debug Probe enumerates as a USB serial device as documented on 99its `Getting started page`_. 100 101It also uses the GDB binary provided with the Zephyr SDK, 102``arm-zephyr-eabi-gdb``. Other GDB binaries, such as the GDB from GCC 103ARM Embedded, can be used as well. 104 105.. code-block:: console 106 107 $ arm-zephyr-eabi-gdb -q zephyr.elf 108 (gdb) target extended-remote /dev/ttyACM0 109 Remote debugging using /dev/ttyACM0 110 (gdb) monitor swdp_scan 111 Target voltage: 3.3V 112 Available Targets: 113 No. Att Driver 114 1 nRF51 115 (gdb) attach 1 116 Attaching to Remote target 117 0xabcdef12 in ?? () 118 (gdb) load 119 120Debugging 121========= 122 123After you've flashed the chip, you can keep debugging using the same 124GDB instance. To reattach, just follow the same steps above, but don't 125run "load". You can then debug as usual with GDB. In particular, type 126"run" at the GDB prompt to restart the program you've flashed. 127 128As an aid to debugging, this board configuration directs a console 129output to a currently unused pin connected to the STM32F401RET. Users 130who are experienced in electronics rework can remove a resistor (R22) 131on the board and attach a wire to the nRF51822's UART output. 132 133.. _96b_carbon_nrf51_bluetooth: 134 135Providing Bluetooth to 96b_carbon 136********************************* 137 138This 96b_carbon_nrf51 Zephyr configuration can be used to provide 139Bluetooth functionality from the secondary nRF51822 chip to the 140primary STM32F401RE chip on the :ref:`96b_carbon_board`. 141 142To do this, build the ``samples/bluetooth/hci_spi/`` application 143provided with Zephyr with ``BOARD=96b_carbon_nrf51``, then flash it to 144the nRF51822 chip using the instructions :ref:`above 145<96b_carbon_nrf51_programming>`. (For instructions on how to build a 146Zephyr application, see :ref:`build_an_application`.) 147 148.. warning:: 149 150 Be sure to flash the hci_spi application to the nRF51822 chip and 151 not to the main STM32F401RET chip. While both chips are supported 152 by Zephyr, the hci_spi application providing Bluetooth support will 153 only run on the nRF51822 chip. 154 155References 156********** 157 158- `Board documentation from 96Boards`_ 159- `nRF51822 information from Nordic Semiconductor`_ 160 161.. _Black Magic Debug Probe: 162 https://github.com/blacksphere/blackmagic/wiki 163 164.. _Getting started page: 165 https://github.com/blacksphere/blackmagic/wiki/Getting-Started 166 167.. _Board documentation from 96Boards: 168 http://www.96boards.org/product/carbon/ 169 170.. _nRF51822 information from Nordic Semiconductor: 171 https://www.nordicsemi.com/eng/Products/Bluetooth-low-energy/nRF51822 172