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