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
79:zephyr_file:`boards/96boards/nitrogen/96b_nitrogen_defconfig`
80
81Pin Mapping
82===========
83
84LED
85---
86
87- LED1 / User LED (green) = P0.29
88- LED2 / BT LED (blue) = P0.28
89
90Push buttons
91------------
92
93- BUTTON = SW1 = P0.27
94
95External Connectors
96-------------------
97
98Low Speed Header
99
100+--------+-------------+----------------------+
101| PIN #  | Signal Name | nRF52832 Functions   |
102+========+=============+======================+
103| 1      | GND         | GND                  |
104+--------+-------------+----------------------+
105| 3      | UART CTS    | P.014 / TRACEDATA[3] |
106+--------+-------------+----------------------+
107| 5      | UART TX     | P0.13                |
108+--------+-------------+----------------------+
109| 7      | UART RX     | P0.15 / TRACEDATA[2] |
110+--------+-------------+----------------------+
111| 9      | UART RTS    | P0.12                |
112+--------+-------------+----------------------+
113| 11     | UART TX     | P0.13                |
114+--------+-------------+----------------------+
115| 13     | UART RX     | P0.15 / TRACEDATA[2] |
116+--------+-------------+----------------------+
117| 15     | P0.22       | P0.22                |
118+--------+-------------+----------------------+
119| 17     | P0.20       | P0.20                |
120+--------+-------------+----------------------+
121| 19     | N/A         | N/A                  |
122+--------+-------------+----------------------+
123| 21     | N/A         | N/A                  |
124+--------+-------------+----------------------+
125| 23     | P0.02       | P0.02                |
126+--------+-------------+----------------------+
127| 25     | P0.04       | P0.04                |
128+--------+-------------+----------------------+
129| 27     | P0.06       | P0.06                |
130+--------+-------------+----------------------+
131| 29     | P0.08       | P0.08                |
132+--------+-------------+----------------------+
133| 31     | P0.16       | P0.16                |
134+--------+-------------+----------------------+
135| 33     | P0.18       | P0.18                |
136+--------+-------------+----------------------+
137| 35     | VCC         |                      |
138+--------+-------------+----------------------+
139| 37     | USB5V       |                      |
140+--------+-------------+----------------------+
141| 39     | GND         | GND                  |
142+--------+-------------+----------------------+
143
144+--------+-------------+----------------------+
145| PIN #  | Signal Name | nRF52832 Functions   |
146+========+=============+======================+
147| 2      | GND         | GND                  |
148+--------+-------------+----------------------+
149| 4      | PWR BTN     |                      |
150+--------+-------------+----------------------+
151| 6      | RST BTN     | P0.21 / RESET        |
152+--------+-------------+----------------------+
153| 8      | P0.26       | P0.26                |
154+--------+-------------+----------------------+
155| 10     | P0.25       | P0.25                |
156+--------+-------------+----------------------+
157| 12     | P0.24       | P0.24                |
158+--------+-------------+----------------------+
159| 14     | P0.23       | P0.23                |
160+--------+-------------+----------------------+
161| 16     | N/A         | N/A                  |
162+--------+-------------+----------------------+
163| 18     | N/A         | PC7                  |
164+--------+-------------+----------------------+
165| 20     | N/A         | PC9                  |
166+--------+-------------+----------------------+
167| 22     | N/A         | PB8                  |
168+--------+-------------+----------------------+
169| 24     | P0.03       | P0.03                |
170+--------+-------------+----------------------+
171| 26     | P0.05       | P0.05                |
172+--------+-------------+----------------------+
173| 28     | P0.07       | P0.07                |
174+--------+-------------+----------------------+
175| 30     | P0.11       | P0.11                |
176+--------+-------------+----------------------+
177| 32     | P0.17       | P0.17                |
178+--------+-------------+----------------------+
179| 34     | P0.19       | P0.19                |
180+--------+-------------+----------------------+
181| 36     | NC          |                      |
182+--------+-------------+----------------------+
183| 38     | NC          |                      |
184+--------+-------------+----------------------+
185| 40     | GND         | GND                  |
186+--------+-------------+----------------------+
187
188More detailed information about the connectors can be found in
189`96Boards IE Specification`_.
190
191System Clock
192============
193
194nRF52 has two external oscillators. The frequency of the slow clock is
19532.768 kHz. The frequency of the main clock is 32 MHz.
196
197Serial Port
198-----------
199
20096Boards Nitrogen has one UART, which is used as Zephyr console.
201Default settings is 115200 8N1.
202
203I2C
204---
205
20696Boards Nitrogen has one I2C. The default I2C mapping for Zephyr is:
207
208- I2C0_SCL : P0.22
209- I2C0_SDA : P0.20
210
211SPI
212---
213
21496Boards Nitrogen has one SPI. The default SPI mapping for Zephyr is:
215
216- SPI0_NSS  : P0.24
217- SPI0_SCK  : P0.26
218- SPI0_MISO : P0.25
219- SPI0_MOSI : P0.23
220
221Flashing Zephyr onto 96Boards Nitrogen
222**************************************
223
224The 96Boards Nitrogen board can be flashed via the `CMSIS DAP`_ interface,
225which is provided by the micro USB interface to the LPC11U35 chip.
226
227Using the CMSIS-DAP interface, the board can be flashed via the USB storage
228interface (drag-and-drop) and also via `pyOCD`_.
229
230To use ``pyOCD``, install the :ref:`pyocd-debug-host-tools` and make sure they
231are in your search path.
232
233Common Errors
234=============
235
236No connected boards
237-------------------
238
239If you don't use sudo when invoking pyocd-flashtool, you might get any of the
240following errors:
241
242.. code-block:: console
243
244   No available boards are connected
245
246.. code-block:: console
247
248   No connected boards
249
250.. code-block:: console
251
252   Error: There is no board connected.
253
254To fix the permission issue, simply add the following udev rule for the
255NXP LPC1768 interface:
256
257.. code-block:: console
258
259   $ echo 'ATTR{idProduct}=="0204", ATTR{idVendor}=="0d28", MODE="0666", GROUP="plugdev"' > /etc/udev/rules.d/50-cmsis-dap.rules
260
261Finally, unplug and plug the board again.
262
263ValueError: The device has no langid
264------------------------------------
265
266As described by `pyOCD issue 259`_, you might get the
267:code:`ValueError: The device has no langid` error when not running
268pyOCD as root (e.g. sudo).
269
270To fix the above error, add the udev rule shown in the previous section
271and install a more recent version of pyOCD.
272
273Flashing an Application to 96Boards Nitrogen
274============================================
275
276Here is an example for the :ref:`hello_world` application. This
277requires installing the :ref:`pyocd-debug-host-tools`.
278
279.. zephyr-app-commands::
280   :zephyr-app: samples/hello_world
281   :board: 96b_nitrogen
282   :goals: build flash
283
284Run your favorite terminal program to listen for output.
285
286.. code-block:: console
287
288   $ minicom -D <tty_device> -b 115200
289
290Replace :code:`<tty_device>` with the port where the board 96Boards Nitrogen
291can be found. For example, under Linux, :code:`/dev/ttyACM0`.
292The ``-b`` option sets baud rate ignoring the value from config.
293
294Press the Reset button and you should see the following message in your
295terminal:
296
297.. code-block:: console
298
299   Hello World! arm
300
301Debugging with GDB
302==================
303
304You can debug an application in the usual way.  Here is an example for the
305:ref:`hello_world` application. This also requires pyOCD.
306
307.. zephyr-app-commands::
308   :zephyr-app: samples/hello_world
309   :board: 96b_nitrogen
310   :maybe-skip-config:
311   :goals: debug
312
313.. _pyOCD:
314    https://github.com/mbedmicro/pyOCD
315
316.. _CMSIS DAP:
317    https://developer.mbed.org/handbook/CMSIS-DAP
318
319.. _Nordic Semiconductor Infocenter:
320    http://infocenter.nordicsemi.com/
321
322.. _seeed BLE Nitrogen:
323    http://wiki.seeed.cc/BLE_Nitrogen/
324
325.. _pyOCD issue 259:
326    https://github.com/mbedmicro/pyOCD/issues/259
327
328.. _96Boards IE Specification:
329    https://linaro.co/ie-specification
330