1.. _ubx_bmd340eval_nrf52840:
2
3u-blox EVK-BMD-34/38: BMD-340-EVAL and BMD-341-EVAL
4###################################################
5
6Overview
7********
8
9The BMD-340-EVAL and BMD-341-EVAL hardware provides support for the
10u-blox BMD-340 and BMD-341 Bluetooth 5.0 modules, based on the
11Nordic Semiconductor nRF52840 ARM Cortex-M4F CPU. the BMD-340 and
12BMD-341 are identical in operation except for the antenna. The
13BMD-340 has a PCB antenna while the BMD-341 has a U.FL connector.
14Both support the following devices:
15
16* :abbr:`ADC (Analog to Digital Converter)`
17* CLOCK
18* FLASH
19* :abbr:`GPIO (General Purpose Input Output)`
20* :abbr:`I2C (Inter-Integrated Circuit)`
21* :abbr:`MPU (Memory Protection Unit)`
22* :abbr:`NVIC (Nested Vectored Interrupt Controller)`
23* :abbr:`PWM (Pulse Width Modulation)`
24* RADIO (Bluetooth Low Energy and 802.15.4)
25* :abbr:`RTC (nRF RTC System Clock)`
26* Segger RTT (RTT Console)
27* :abbr:`SPI (Serial Peripheral Interface)`
28* :abbr:`UART (Universal asynchronous receiver-transmitter)`
29* :abbr:`USB (Universal Serial Bus)`
30* :abbr:`WDT (Watchdog Timer)`
31
32.. figure:: img/BMD-34-38-EVAL.jpg
33     :align: center
34     :alt: BMD-340-EVAL
35
36     BMD-340-EVAL (Credit: u-blox AG)
37
38More information about the BMD-340-EVAL, BMD-340 module, BMD-341-EVAL,
39and BMD-341 module can be found at the `u-blox website`_.
40All of the Nordic Semiconductor examples for the nRF52840 DK
41(nrf52840dk_nrf52840) may be used without modification.
42
43..note::
44	The BMD-340 and BMD-341 are identical except for the antenna.
45	Throughout this board support package, the filenames utilize
46	the ubx_bmd340eval_nrf52840.
47
48Hardware
49********
50
51The BMD-340 on the BMD-340-EVAL (or BMD-341 on the BMD-341-EVAL)
52contains an internal high-frequency oscillator at 32MHz.
53There is also a low frequency (slow) oscillator of 32.768kHz.
54The BMD-340 and BMD-341 do not include the slow crystal;
55however, the BMD-340-EVAL and BMD-341-EVAL do.
56
57.. note::
58
59	When targeting a custom design without a slow crystal, be sure
60	to modify code to utilize the internal RC oscillator for the
61	slow clock.
62
63Supported Features
64==================
65
66The BMD-340-EVAL and BMD-341-EVAL board configuration supports
67the following hardware features:
68
69+-----------+------------+----------------------+
70| Interface | Controller | Driver/Component     |
71+===========+============+======================+
72| ADC       | on-chip    | adc                  |
73+-----------+------------+----------------------+
74| CLOCK     | on-chip    | clock_control        |
75+-----------+------------+----------------------+
76| FLASH     | on-chip    | flash                |
77+-----------+------------+----------------------+
78| GPIO      | on-chip    | gpio                 |
79+-----------+------------+----------------------+
80| I2C(M)    | on-chip    | i2c                  |
81+-----------+------------+----------------------+
82| MPU       | on-chip    | arch/arm             |
83+-----------+------------+----------------------+
84| NVIC      | on-chip    | arch/arm             |
85+-----------+------------+----------------------+
86| PWM       | on-chip    | pwm                  |
87+-----------+------------+----------------------+
88| RADIO     | on-chip    | Bluetooth,           |
89|           |            | IEEE 802.15.4        |
90+-----------+------------+----------------------+
91| RTC       | on-chip    | system clock         |
92+-----------+------------+----------------------+
93| RTT       | Segger     | console              |
94+-----------+------------+----------------------+
95| SPI(M/S)  | on-chip    | spi                  |
96+-----------+------------+----------------------+
97| UART      | on-chip    | serial               |
98+-----------+------------+----------------------+
99| USB       | on-chip    | usb                  |
100+-----------+------------+----------------------+
101| WDT       | on-chip    | watchdog             |
102+-----------+------------+----------------------+
103
104Other hardware features have not been enabled yet for this board.
105See the `u-blox website`_ for a complete list of BMD-340-EVAL
106and BMD-341-EVAL hardware features.
107
108Connections and IOs
109===================
110
111LED
112---
113
114* LED1 (red) = P0.13
115* LED2 (red) = P0.14
116* LED3 (green) = P0.15
117* LED4 (green) = P0.16
118* D5 (red) = OB LED 1
119* D6 (green) = OB LED 2
120
121Push buttons
122------------
123
124* BUTTON1 = SW1 = P0.11
125* BUTTON2 = SW2 = P0.12
126* BUTTON3 = SW3 = P0.24
127* BUTTON4 = SW4 = P0.25
128* BOOT = SW5 = boot/reset
129
130External Connectors
131-------------------
132
133.. figure:: img/bmd-340-eval_pin_out.jpg
134     :align: center
135     :alt: BMD-340-EVAL pin-out
136
137.. note::
138	The pin numbers noted below are referenced to
139	the pin 1 markings on the BMD-340-EVAL or
140	BMD-341-EVAL for each header
141
142J-Link Prog Connector (J2)
143
144+-------+--------------+
145| PIN # | Signal Name  |
146+=======+==============+
147| 1     | VDD          |
148+-------+--------------+
149| 2     | IMCU_TMSS    |
150+-------+--------------+
151| 3     | GND          |
152+-------+--------------+
153| 4     | IMCU_TCKS    |
154+-------+--------------+
155| 5     | V5V          |
156+-------+--------------+
157| 6     | IMCU_TDOS    |
158+-------+--------------+
159| 7     | Cut off      |
160+-------+--------------+
161| 8     | IMCU_TDIS    |
162+-------+--------------+
163| 9     | Cut off      |
164+-------+--------------+
165| 10    | IMCU_RESET   |
166+-------+--------------+
167
168Debug OUT (J3)
169
170+-------+----------------+
171| PIN # | Signal Name    |
172+=======+================+
173| 1     | EXT_VTG        |
174+-------+----------------+
175| 2     | EXT_SWDIO      |
176+-------+----------------+
177| 3     | GND            |
178+-------+----------------+
179| 4     | EXT_SWDCLK     |
180+-------+----------------+
181| 5     | GND            |
182+-------+----------------+
183| 6     | EXT_SWO        |
184+-------+----------------+
185| 7     | N/C            |
186+-------+----------------+
187| 8     | N/C            |
188+-------+----------------+
189| 9     | EXT_GND_DETECT |
190+-------+----------------+
191| 10    | EXT_RESET      |
192+-------+----------------+
193
194Debug IN (J26)
195
196+-------+----------------+
197| PIN # | Signal Name    |
198+=======+================+
199| 1     | BMD-340_VCC    |
200+-------+----------------+
201| 2     | BMD-340_SWDIO  |
202+-------+----------------+
203| 3     | GND            |
204+-------+----------------+
205| 4     | BMD-340_SWDCLK |
206+-------+----------------+
207| 5     | GND            |
208+-------+----------------+
209| 6     | BMD-340_SWO    |
210+-------+----------------+
211| 7     | N/C            |
212+-------+----------------+
213| 8     | N/C            |
214+-------+----------------+
215| 9     | GND            |
216+-------+----------------+
217| 10    | BMD-340_RESET  |
218+-------+----------------+
219
220Auxiliary (J9)
221
222+-------+----------------+
223| PIN # | Signal Name    |
224+=======+================+
225| 1     | P0.10 / NFC2   |
226+-------+----------------+
227| 2     | P0.09 / NFC1   |
228+-------+----------------+
229| 3     | P0.08          |
230+-------+----------------+
231| 4     | P0.07          |
232+-------+----------------+
233| 5     | P0.06          |
234+-------+----------------+
235| 6     | P0.05 / AIN3   |
236+-------+----------------+
237| 7     | P0.01 / XL2    |
238+-------+----------------+
239| 8     | P0.00 / XL1    |
240+-------+----------------+
241
242Auxiliary (J10)
243
244+-------+-------------------+
245| PIN # | Signal Name       |
246+=======+===================+
247| 1     | P0.11 / TRACED[2] |
248+-------+-------------------+
249| 2     | P0.12 / TRACED[1] |
250+-------+-------------------+
251| 3     | P0.13             |
252+-------+-------------------+
253| 4     | P0.14             |
254+-------+-------------------+
255| 5     | P0.15             |
256+-------+-------------------+
257| 6     | P0.16             |
258+-------+-------------------+
259| 7     | P0.17 / QSPI_CS   |
260+-------+-------------------+
261| 8     | P0.18 / RESET     |
262+-------+-------------------+
263| 9     | P0.19 / QSPI_CLK  |
264+-------+-------------------+
265| 10    | P0.20 / QSPI_D0   |
266+-------+-------------------+
267| 11    | P0.21 / QSPI_D1   |
268+-------+-------------------+
269| 12    | P0.22 / QSPI_D2   |
270+-------+-------------------+
271| 13    | P0.23 / QSPI_D3   |
272+-------+-------------------+
273| 14    | P0.24             |
274+-------+-------------------+
275| 15    | P0.25             |
276+-------+-------------------+
277| 16    | P1.00 / TRACED[0] |
278+-------+-------------------+
279| 17    | P1.09 / TRACED[3] |
280+-------+-------------------+
281| 18    | No connection     |
282+-------+-------------------+
283
284Arduino Headers
285---------------
286
287Power (J5)
288
289+-------+--------------+-------------------------+
290| PIN # | Signal Name  | BMD-34x Functions       |
291+=======+==============+=========================+
292| 1     | VSHLD        | N/A                     |
293+-------+--------------+-------------------------+
294| 2     | VSHLD        | N/A                     |
295+-------+--------------+-------------------------+
296| 3     | RESET        | P0.18 / RESET           |
297+-------+--------------+-------------------------+
298| 4     | VSHLD        | N/A                     |
299+-------+--------------+-------------------------+
300| 5     | V5V          | N/A                     |
301+-------+--------------+-------------------------+
302| 6     | GND          | N/A                     |
303+-------+--------------+-------------------------+
304| 7     | GND          | N/A                     |
305+-------+--------------+-------------------------+
306| 8     | N/C          | N/A                     |
307+-------+--------------+-------------------------+
308
309Analog in (J8)
310
311+-------+--------------+-------------------------+
312| PIN # | Signal Name  | BMD-34x Functions       |
313+=======+==============+=========================+
314| 1     | A0           | P0.03 / AIN1            |
315+-------+--------------+-------------------------+
316| 2     | A1           | P0.04 / AIN2            |
317+-------+--------------+-------------------------+
318| 3     | A2           | P0.28 / AIN4            |
319+-------+--------------+-------------------------+
320| 4     | A3           | P0.29 / AIN5            |
321+-------+--------------+-------------------------+
322| 5     | A4           | P0.30 / AIN6            |
323+-------+--------------+-------------------------+
324| 6     | A5           | P0.31 / AIN7            |
325+-------+--------------+-------------------------+
326
327Digital I/O (J7)
328
329+-------+--------------+-------------------------+
330| PIN # | Signal Name  | BMD-34x Functions       |
331+=======+==============+=========================+
332| 1     | D7           | P1.08                   |
333+-------+--------------+-------------------------+
334| 2     | D6           | P1.07                   |
335+-------+--------------+-------------------------+
336| 3     | D5           | P1.06                   |
337+-------+--------------+-------------------------+
338| 4     | D4           | P1.05                   |
339+-------+--------------+-------------------------+
340| 5     | D3           | P1.04                   |
341+-------+--------------+-------------------------+
342| 6     | D2           | P1.03                   |
343+-------+--------------+-------------------------+
344| 7     | D1 (TX)      | P1.02                   |
345+-------+--------------+-------------------------+
346| 8     | D0 (RX)      | P1.01                   |
347+-------+--------------+-------------------------+
348
349Digital I/O (J6)
350
351+-------+--------------+-------------------------+
352| PIN # | Signal Name  | BMD-34x Functions       |
353+=======+==============+=========================+
354| 1     | SCL          | P0.27                   |
355+-------+--------------+-------------------------+
356| 2     | SDA          | P0.26                   |
357+-------+--------------+-------------------------+
358| 3     | AREF         | P0.02 / AIN0            |
359+-------+--------------+-------------------------+
360| 4     | GND          | N/A                     |
361+-------+--------------+-------------------------+
362| 5     | D13 (SCK)    | P1.15                   |
363+-------+--------------+-------------------------+
364| 6     | D12 (MISO)   | P1.14                   |
365+-------+--------------+-------------------------+
366| 7     | D11 (MOSI)   | P1.13                   |
367+-------+--------------+-------------------------+
368| 8     | D10 (SS)     | P1.12                   |
369+-------+--------------+-------------------------+
370| 9     | D9           | P1.11                   |
371+-------+--------------+-------------------------+
372| 10    | D8           | P1.10                   |
373+-------+--------------+-------------------------+
374
375J11
376
377+-------+--------------+-------------------------+
378| PIN # | Signal Name  | BMD-34x Functions       |
379+=======+==============+=========================+
380| 1     | D12 (MISO)   | P0.14                   |
381+-------+--------------+-------------------------+
382| 2     | V5V          | N/A                     |
383+-------+--------------+-------------------------+
384| 3     | D13 (SCK)    | P0.15                   |
385+-------+--------------+-------------------------+
386| 4     | D11 (MOSI)   | P0.13                   |
387+-------+--------------+-------------------------+
388| 5     | RESET        | N/A                     |
389+-------+--------------+-------------------------+
390| 6     | N/A          | N/A                     |
391+-------+--------------+-------------------------+
392
393Programming and Debugging
394*************************
395
396Applications for the BMD-340-EVAL and BMD-341-EVAL board
397configurations can be built and flashed in the usual way
398(see :ref:`build_an_application` and :ref:`application_run`
399for more details); however, the standard debugging targets
400are not currently available.
401
402Flashing
403========
404
405Follow the instructions in the :ref:`nordic_segger` page to install
406and configure all the necessary software. Further information can be
407found in :ref:`nordic_segger_flashing`. Then build and flash
408applications as usual (see :ref:`build_an_application` and
409:ref:`application_run` for more details).
410
411Here is an example for the :zephyr:code-sample:`hello_world` application.
412
413First, run your favorite terminal program to listen for output.
414
415.. code-block:: console
416
417   $ minicom -D <tty_device> -b 115200
418
419Replace :code:`<tty_device>` with the port where the BMD-340-EVAL
420or BMD-341-EVAL can be found. For example, under Linux,
421:code:`/dev/ttyACM0`.
422
423Then build and flash the application in the usual way.
424
425.. zephyr-app-commands::
426   :zephyr-app: samples/hello_world
427   :board: ubx_bmd340eval/nrf52840
428   :goals: build flash
429
430Debugging
431=========
432
433Refer to the :ref:`nordic_segger` page to learn about debugging
434u-blox boards with a Segger J-LINK-OB IC.
435
436
437Testing the LEDs and buttons in the BMD-340-EVAL and BMD-341-EVAL
438*****************************************************************
439
440There are 2 samples that allow you to test that the buttons
441(switches) and LEDs on the board are working properly with Zephyr:
442
443.. code-block:: console
444
445   samples/basic/blinky
446   samples/basic/button
447
448You can build and flash the examples to make sure Zephyr is running
449correctly on your board. The button and LED definitions can be found
450in
451:zephyr_file:`boards/u-blox/ubx_bmd340eval/ubx_bmd340eval_nrf52840.dts`.
452
453Using UART1
454***********
455
456The following approach can be used when an application needs to use
457more than one UART for connecting peripheral devices:
458
4591. Add device tree overlay file to the main directory of your
460   application:
461
462   .. code-block:: devicetree
463
464      &pinctrl {
465         uart1_default: uart1_default {
466            group1 {
467               psels = <NRF_PSEL(UART_TX, 0, 14)>,
468                       <NRF_PSEL(UART_RX, 0, 16)>;
469            };
470         };
471         /* required if CONFIG_PM_DEVICE=y */
472         uart1_sleep: uart1_sleep {
473            group1 {
474               psels = <NRF_PSEL(UART_TX, 0, 14)>,
475                       <NRF_PSEL(UART_RX, 0, 16)>;
476               low-power-enable;
477            };
478         };
479      };
480
481      &uart1 {
482        compatible = "nordic,nrf-uarte";
483        current-speed = <115200>;
484        status = "okay";
485        pinctrl-0 = <&uart1_default>;
486        pinctrl-1 = <&uart1_sleep>;
487        pinctrl-names = "default", "sleep";
488      };
489
490   In the overlay file above, pin P0.16 is used for RX and P0.14 is
491   used for TX
492
4932. Use the UART1 as ``DEVICE_DT_GET(DT_NODELABEL(uart1))``
494
495Overlay file naming
496===================
497
498The file has to be named ``<board>.overlay`` and placed in the app
499main directory to be picked up automatically by the device tree
500compiler.
501
502Selecting the pins
503==================
504
505Pins can be configured in the board pinctrl file. To see the available mappings,
506open the data sheet for the BMD-340 at the `u-blox website`_, Section 2
507'Pin definition'. In the table 3 select the pins marked 'GPIO'.
508Note that pins marked as 'Standard drive, low frequency I/O only
509(<10 kH' can only be used in under-10KHz applications.
510They are not suitable for 115200 speed of UART.
511
512.. note:
513  Pins are defined according to the "nRF52" pin number, not the module
514  pad number.
515
516References
517**********
518
519.. target-notes::
520
521.. _u-blox website: https://www.u-blox.com/docs/UBX-19033353
522