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