1.. _96b_nitrogen_board:
2
396Boards Nitrogen
4#################
5
6Overview
7********
8
9The 96Boards Nitrogen hardware provides support for the Nordic Semiconductor
10nRF52832 ARM Cortex-M4F CPU.
11
12.. figure:: img/96b_nitrogen.jpg
13     :align: center
14     :alt: 96Boards Nitrogen
15
16     96Boards Nitrogen
17
18More information about the board can be found at the `seeed BLE Nitrogen`_
19website. The `Nordic Semiconductor Infocenter`_ contains the processor's
20information and the datasheet.
21
22Hardware
23********
24
2596Boards Nitrogen provides the following hardware components:
26
27- nRF52832 microcontroller with 512kB Flash, 64kB RAM
28- ARM |reg| 32-bit Cortex |reg|-M4 CPU with FPU
29- Bluetooth LE
30- NFC
31- LPC11U35 on board SWD debugger
32
33  - SWD debugger firmware
34  - USB to UART
35  - Drag and Drop firmware upgrade
36
37- 7 LEDs
38
39  - USR1, BT, PWR, CDC, DAP, MSD, Battery charge
40
41- SWD debug connectors
42
43  - nRF52832 SWD connector
44  - nRF52832 Uart connector
45
46- On board chip antenna
47- 1.8V work voltage
48- 2x20pin 2.0mm pitch Low speed connector
49
50Supported Features
51==================
52
53The Zephyr 96b_nitrogen board configuration supports the following hardware
54features:
55
56+-----------+------------+--------------------------------------+
57| Interface | Controller | Driver/Component                     |
58+===========+============+======================================+
59| NVIC      | on-chip    | nested vectored interrupt controller |
60+-----------+------------+--------------------------------------+
61| RTC       | on-chip    | system clock                         |
62+-----------+------------+--------------------------------------+
63| UART      | on-chip    | serial port                          |
64+-----------+------------+--------------------------------------+
65| GPIO      | on-chip    | gpio                                 |
66+-----------+------------+--------------------------------------+
67| FLASH     | on-chip    | flash                                |
68+-----------+------------+--------------------------------------+
69| RADIO     | on-chip    | Bluetooth                            |
70+-----------+------------+--------------------------------------+
71| RTT       | on-chip    | console                              |
72+-----------+------------+--------------------------------------+
73
74Other hardware features have not been enabled yet for this board.
75See `Nordic Semiconductor Infocenter`_ for a complete list of nRF52-based
76board hardware features.
77
78The default configuration can be found in the defconfig file:
79
80        ``boards/arm/96b_nitrogen/96b_nitrogen_defconfig``
81
82Pin Mapping
83===========
84
85LED
86---
87
88- LED1 / User LED (green) = P0.29
89- LED2 / BT LED (blue) = P0.28
90
91Push buttons
92------------
93
94- BUTTON = SW1 = P0.27
95
96External Connectors
97-------------------
98
99Low Speed Header
100
101+--------+-------------+----------------------+
102| PIN #  | Signal Name | nRF52832 Functions   |
103+========+=============+======================+
104| 1      | GND         | GND                  |
105+--------+-------------+----------------------+
106| 3      | UART CTS    | P.014 / TRACEDATA[3] |
107+--------+-------------+----------------------+
108| 5      | UART TX     | P0.13                |
109+--------+-------------+----------------------+
110| 7      | UART RX     | P0.15 / TRACEDATA[2] |
111+--------+-------------+----------------------+
112| 9      | UART RTS    | P0.12                |
113+--------+-------------+----------------------+
114| 11     | UART TX     | P0.13                |
115+--------+-------------+----------------------+
116| 13     | UART RX     | P0.15 / TRACEDATA[2] |
117+--------+-------------+----------------------+
118| 15     | P0.22       | P0.22                |
119+--------+-------------+----------------------+
120| 17     | P0.20       | P0.20                |
121+--------+-------------+----------------------+
122| 19     | N/A         | N/A                  |
123+--------+-------------+----------------------+
124| 21     | N/A         | N/A                  |
125+--------+-------------+----------------------+
126| 23     | P0.02       | P0.02                |
127+--------+-------------+----------------------+
128| 25     | P0.04       | P0.04                |
129+--------+-------------+----------------------+
130| 27     | P0.06       | P0.06                |
131+--------+-------------+----------------------+
132| 29     | P0.08       | P0.08                |
133+--------+-------------+----------------------+
134| 31     | P0.16       | P0.16                |
135+--------+-------------+----------------------+
136| 33     | P0.18       | P0.18                |
137+--------+-------------+----------------------+
138| 35     | VCC         |                      |
139+--------+-------------+----------------------+
140| 37     | USB5V       |                      |
141+--------+-------------+----------------------+
142| 39     | GND         | GND                  |
143+--------+-------------+----------------------+
144
145+--------+-------------+----------------------+
146| PIN #  | Signal Name | nRF52832 Functions   |
147+========+=============+======================+
148| 2      | GND         | GND                  |
149+--------+-------------+----------------------+
150| 4      | PWR BTN     |                      |
151+--------+-------------+----------------------+
152| 6      | RST BTN     | P0.21 / RESET        |
153+--------+-------------+----------------------+
154| 8      | P0.26       | P0.26                |
155+--------+-------------+----------------------+
156| 10     | P0.25       | P0.25                |
157+--------+-------------+----------------------+
158| 12     | P0.24       | P0.24                |
159+--------+-------------+----------------------+
160| 14     | P0.23       | P0.23                |
161+--------+-------------+----------------------+
162| 16     | N/A         | N/A                  |
163+--------+-------------+----------------------+
164| 18     | N/A         | PC7                  |
165+--------+-------------+----------------------+
166| 20     | N/A         | PC9                  |
167+--------+-------------+----------------------+
168| 22     | N/A         | PB8                  |
169+--------+-------------+----------------------+
170| 24     | P0.03       | P0.03                |
171+--------+-------------+----------------------+
172| 26     | P0.05       | P0.05                |
173+--------+-------------+----------------------+
174| 28     | P0.07       | P0.07                |
175+--------+-------------+----------------------+
176| 30     | P0.11       | P0.11                |
177+--------+-------------+----------------------+
178| 32     | P0.17       | P0.17                |
179+--------+-------------+----------------------+
180| 34     | P0.19       | P0.19                |
181+--------+-------------+----------------------+
182| 36     | NC          |                      |
183+--------+-------------+----------------------+
184| 38     | NC          |                      |
185+--------+-------------+----------------------+
186| 40     | GND         | GND                  |
187+--------+-------------+----------------------+
188
189More detailed information about the connectors can be found in
190`96Boards IE Specification`_.
191
192System Clock
193============
194
195nRF52 has two external oscillators. The frequency of the slow clock is
19632.768 kHz. The frequency of the main clock is 32 MHz.
197
198Serial Port
199-----------
200
20196Boards Nitrogen has one UART, which is used as Zephyr console.
202Default settings is 115200 8N1.
203
204I2C
205---
206
20796Boards Nitrogen has one I2C. The default I2C mapping for Zephyr is:
208
209- I2C0_SCL : P0.22
210- I2C0_SDA : P0.20
211
212SPI
213---
214
21596Boards Nitrogen has one SPI. The default SPI mapping for Zephyr is:
216
217- SPI0_NSS  : P0.24
218- SPI0_SCK  : P0.26
219- SPI0_MISO : P0.25
220- SPI0_MOSI : P0.23
221
222Flashing Zephyr onto 96Boards Nitrogen
223**************************************
224
225The 96Boards Nitrogen board can be flashed via the `CMSIS DAP`_ interface,
226which is provided by the micro USB interface to the LPC11U35 chip.
227
228Using the CMSIS-DAP interface, the board can be flashed via the USB storage
229interface (drag-and-drop) and also via `pyOCD`_.
230
231To use ``pyOCD``, install the :ref:`pyocd-debug-host-tools` and make sure they
232are in your search path.
233
234Common Errors
235=============
236
237No connected boards
238-------------------
239
240If you don't use sudo when invoking pyocd-flashtool, you might get any of the
241following errors:
242
243.. code-block:: console
244
245   No available boards are connected
246
247.. code-block:: console
248
249   No connected boards
250
251.. code-block:: console
252
253   Error: There is no board connected.
254
255To fix the permission issue, simply add the following udev rule for the
256NXP LPC1768 interface:
257
258.. code-block:: console
259
260   $ echo 'ATTR{idProduct}=="0204", ATTR{idVendor}=="0d28", MODE="0666", GROUP="plugdev"' > /etc/udev/rules.d/50-cmsis-dap.rules
261
262Finally, unplug and plug the board again.
263
264ValueError: The device has no langid
265------------------------------------
266
267As described by `pyOCD issue 259`_, you might get the
268:code:`ValueError: The device has no langid` error when not running
269pyOCD as root (e.g. sudo).
270
271To fix the above error, add the udev rule shown in the previous section
272and install a more recent version of pyOCD.
273
274Flashing an Application to 96Boards Nitrogen
275============================================
276
277Here is an example for the :ref:`hello_world` application. This
278requires installing the :ref:`pyocd-debug-host-tools`.
279
280.. zephyr-app-commands::
281   :zephyr-app: samples/hello_world
282   :board: 96b_nitrogen
283   :goals: build flash
284
285Run your favorite terminal program to listen for output.
286
287.. code-block:: console
288
289   $ minicom -D <tty_device> -b 115200
290
291Replace :code:`<tty_device>` with the port where the board 96Boards Nitrogen
292can be found. For example, under Linux, :code:`/dev/ttyACM0`.
293The ``-b`` option sets baud rate ignoring the value from config.
294
295Press the Reset button and you should see the the following message in your
296terminal:
297
298.. code-block:: console
299
300   Hello World! arm
301
302Debugging with GDB
303==================
304
305You can debug an application in the usual way.  Here is an example for the
306:ref:`hello_world` application. This also requires pyOCD.
307
308.. zephyr-app-commands::
309   :zephyr-app: samples/hello_world
310   :board: 96b_nitrogen
311   :maybe-skip-config:
312   :goals: debug
313
314.. _pyOCD:
315    https://github.com/mbedmicro/pyOCD
316
317.. _CMSIS DAP:
318    https://developer.mbed.org/handbook/CMSIS-DAP
319
320.. _Nordic Semiconductor Infocenter:
321    http://infocenter.nordicsemi.com/
322
323.. _seeed BLE Nitrogen:
324    http://wiki.seeed.cc/BLE_Nitrogen/
325
326.. _pyOCD issue 259:
327    https://github.com/mbedmicro/pyOCD/issues/259
328
329.. _96Boards IE Specification:
330    https://linaro.co/ie-specification
331