1.. _bl5340_dvk:
2
3Laird Connectivity BL5340 DVK
4#############################
5
6Overview
7********
8The BL5340 Development Kit provides support for the Laird Connectivity
9BL5340 module which is powered by a dual-core Nordic Semiconductor
10nRF5340 ARM Cortex-M33F CPU. The nRF5340 inside the BL5340 module is a
11dual-core SoC based on the Arm® Cortex®-M33 architecture, with:
12
13* a full-featured Arm Cortex-M33F core with DSP instructions, FPU, and
14  Armv8-M Security Extension, running at up to 128 MHz, referred to as
15  the **application core**
16* a secondary Arm Cortex-M33 core, with a reduced feature set, running
17  at a fixed 64 MHz, referred to as the **network core**.
18
19The bl5340_dvk_cpuapp build target provides support for the application
20core on the BL5340 module. The bl5340_dvk_cpunet build target provides
21support for the network core on the BL5340 module. If ARM TrustZone is
22used then the bl5340_dvk_cpuapp build target provides support for the
23non-secure partition of the application core on the BL5340 module.
24
25This development kit has the following features:
26
27* :abbr:`ADC (Analog to Digital Converter)`
28* CLOCK
29* FLASH
30* :abbr:`GPIO (General Purpose Input Output)`
31* :abbr:`IDAU (Implementation Defined Attribution Unit)`
32* :abbr:`I2C (Inter-Integrated Circuit)`
33* :abbr:`I2S (Inter-Integrated Sound)`
34* :abbr:`MPU (Memory Protection Unit)`
35* :abbr:`NVIC (Nested Vectored Interrupt Controller)`
36* :abbr:`PWM (Pulse Width Modulation)`
37* :abbr:`QSPI (Quad Serial Peripheral Interface)`
38* RADIO (Bluetooth Low Energy and 802.15.4)
39* :abbr:`RTC (nRF RTC System Clock)`
40* Segger RTT (RTT Console)
41* :abbr:`SPI (Serial Peripheral Interface)`
42* :abbr:`UARTE (Universal asynchronous receiver-transmitter)`
43* :abbr:`USB (Universal Serial Bus)`
44* :abbr:`WDT (Watchdog Timer)`
45
46.. figure:: img/bl5340_dvk_top.jpg
47     :align: center
48     :alt: BL5340 DVK
49
50     BL5340 DVK (Credit: Laird Connectivity)
51
52More information about the module can be found on the
53`BL5340 homepage`_.
54
55The `Nordic Semiconductor Infocenter`_
56contains the processor's information and the datasheet.
57
58Hardware
59********
60
61The BL5340 DVK has two external oscillators. The frequency of
62the slow clock is 32.768KHz. The frequency of the main clock
63is 32MHz.
64
65Supported Features
66==================
67
68The bl5340_dvk_cpuapp board configuration supports the following
69hardware features:
70
71+-----------+------------+----------------------+
72| Interface | Controller | Driver/Component     |
73+===========+============+======================+
74| ADC       | on-chip    | adc                  |
75+-----------+------------+----------------------+
76| CLOCK     | on-chip    | clock_control        |
77+-----------+------------+----------------------+
78| FLASH     | on-chip    | flash                |
79+-----------+------------+----------------------+
80| GPIO      | on-chip    | gpio                 |
81+-----------+------------+----------------------+
82| I2C(M)    | on-chip    | i2c                  |
83+-----------+------------+----------------------+
84| MPU       | on-chip    | arch/arm             |
85+-----------+------------+----------------------+
86| NVIC      | on-chip    | arch/arm             |
87+-----------+------------+----------------------+
88| QSPI(M)   | on-chip    | nor                  |
89+-----------+------------+----------------------+
90| PWM       | on-chip    | pwm                  |
91+-----------+------------+----------------------+
92| RTC       | on-chip    | system clock         |
93+-----------+------------+----------------------+
94| RTT       | Segger     | console              |
95+-----------+------------+----------------------+
96| SPI(M/S)  | on-chip    | spi                  |
97+-----------+------------+----------------------+
98| SPU       | on-chip    | system protection    |
99+-----------+------------+----------------------+
100| UARTE     | on-chip    | serial               |
101+-----------+------------+----------------------+
102| USB       | on-chip    | usb                  |
103+-----------+------------+----------------------+
104| WDT       | on-chip    | watchdog             |
105+-----------+------------+----------------------+
106
107The bl5340_dvk_cpunet board configuration supports the following
108hardware features:
109
110+-----------+------------+----------------------+
111| Interface | Controller | Driver/Component     |
112+===========+============+======================+
113| CLOCK     | on-chip    | clock_control        |
114+-----------+------------+----------------------+
115| FLASH     | on-chip    | flash                |
116+-----------+------------+----------------------+
117| GPIO      | on-chip    | gpio                 |
118+-----------+------------+----------------------+
119| I2C(M)    | on-chip    | i2c                  |
120+-----------+------------+----------------------+
121| MPU       | on-chip    | arch/arm             |
122+-----------+------------+----------------------+
123| NVIC      | on-chip    | arch/arm             |
124+-----------+------------+----------------------+
125| RADIO     | on-chip    | Bluetooth,           |
126|           |            | ieee802154           |
127+-----------+------------+----------------------+
128| RTC       | on-chip    | system clock         |
129+-----------+------------+----------------------+
130| RTT       | Segger     | console              |
131+-----------+------------+----------------------+
132| SPI(M/S)  | on-chip    | spi                  |
133+-----------+------------+----------------------+
134| UARTE     | on-chip    | serial               |
135+-----------+------------+----------------------+
136| WDT       | on-chip    | watchdog             |
137+-----------+------------+----------------------+
138
139Other hardware features have not been enabled yet for this board.
140See `Nordic Semiconductor Infocenter`_
141for a complete list of hardware features.
142
143Connections and IOs
144===================
145
146An eight-pin GPIO port expander is used to provide additional inputs
147and outputs to the BL5340 module.
148
149Refer to the `TI TCA9538 datasheet`_ for further details.
150
151LEDs
152----
153
154* LED1 (blue) = via TCA9538 port expander channel P4 (active low)
155* LED2 (blue) = via TCA9538 port expander channel P5 (active low)
156* LED3 (blue) = via TCA9538 port expander channel P6 (active low)
157* LED4 (blue) = via TCA9538 port expander channel P7 (active low)
158
159Push buttons
160------------
161
162* BUTTON1 = SW1 = via TCA9538 port expander channel P0 (active low)
163* BUTTON2 = SW2 = via TCA9538 port expander channel P1 (active low)
164* BUTTON3 = SW3 = via TCA9538 port expander channel P2 (active low)
165* BUTTON4 = SW4 = via TCA9538 port expander channel P3 (active low)
166* BOOT = boot (active low)
167
168External Memory
169===============
170
171Several external memory sources are available for the BL5340 DVK. These
172are described as follows.
173
174Flash Memory
175------------
176
177A Macronix MX25R6435FZNIL0 8MB external QSPI Flash memory part is
178incorporated for application image storage and large datasets.
179
180Refer to the `Macronix MX25R6435FZNIL0 datasheet`_ for further details.
181
182EEPROM Memory
183-------------
184
185A 32KB Giantec GT24C256C-2GLI-TR EEPROM is available via I2C for
186storage of infrequently updated data and small datasets.
187
188Refer to the `Giantec GT24C256C-2GLI-TR datasheet`_ for further details.
189
190External Memory
191---------------
192
193An on-board micro SD card slot is available for use with micro SD cards.
194
195Sensors
196=======
197
198The BL5340 DVK incorporates two sensors for user application testing.
199These are described as follows.
200
201Temperature, Pressure, Humidity & Air Quality Sensor
202----------------------------------------------------
203
204A Bosch BME680 Temperature, Pressure, Humidity & Air Quality sensor is
205available via I2C for environmental measurement applications.
206
207Refer to the `Bosch BME680 datasheet`_ for further details.
208
2093-Axis Accelerometer
210--------------------
211
212An ST Microelectronics LIS3DH 3-Axis Accelerometer is available via I2C
213for vibration and motion detection applications.
214
215Refer to the `ST Microelectronics LIS3DH datasheet`_ for further details.
216
217Ethernet
218========
219
220Cabled 10/100 Base-T Ethernet Connectivity is available via a Microchip
221ENC424J600 Ethernet controller.
222
223Refer to the `Microchip ENC424J600 datasheet`_ for further details.
224
225TFT Display & Capacitive Touch Screen Controller
226================================================
227
228A 2.8 inch, 240 x 320 pixel TFT display with capacitive touch
229controller is included with the BL5340 DVK for user interface
230application features.
231
232Refer to the `ER_TFTM028_4 datasheet`_ for a high level overview of the
233display.
234
235An ILI9341 TFT controller is incorporated in the TFT module and
236acts as the main controller, controlled via SPI.
237
238Refer to the `ILI9341 datasheet`_ for further details.
239
240An FT6206 Capacitive Touch Controller, controlled via I2C is
241also incorporated in the TFT module.
242
243Refer to the `FT6206 datasheet`_ for further details.
244
245Real-Time Clock
246===============
247
248A real-time clock is available for accurate time data availability.
249
250Refer to the `Microchip MCP7940N datasheet`_ for further details.
251
252DAC
253===
254
255A 10-bit Digital to Analog Converter is incorporated for generation of
256variable voltages.
257
258Refer to the `Microchip MCP4725 datasheet`_ for further details.
259
260Security components
261===================
262
263- Implementation Defined Attribution Unit (`IDAU`_) on the application
264  core. The IDAU is implemented with the System Protection Unit and is
265  used to define secure and non-secure memory maps.  By default, all of
266  the memory space (Flash, SRAM, and peripheral address space) is
267  defined to be secure accessible only.
268- Secure boot.
269
270Programming and Debugging
271*************************
272
273The BL5340's application core supports the Armv8-M Security Extension.
274Applications built for the bl5340_dvk_cpuapp board by default
275boot in the Secure state.
276
277The BL5340's network core does not support the Armv8-M Security
278Extension. The IDAU may configure bus accesses by the network core to
279have Secure attribute set; the latter allows to build and run Secure
280only applications on the BL5340 module.
281
282Building Secure/Non-Secure Zephyr applications with Arm |reg| TrustZone |reg|
283=============================================================================
284
285Applications on the BL5340 module may contain a Secure and a Non-Secure
286firmware image for the application core. The Secure image can be built
287using either Zephyr or `Trusted Firmware M`_ (TF-M). Non-Secure
288firmware images are always built using Zephyr. The two alternatives are
289described below.
290
291.. note::
292
293   By default the the Secure image for BL5340's application core is
294   built using TF-M.
295
296Building the Secure firmware with TF-M
297--------------------------------------
298
299The process to build the Secure firmware image using TF-M and the
300Non-Secure firmware image using Zephyr requires the following steps:
301
3021. Build the Non-Secure Zephyr application
303   for the application core using ``-DBOARD=bl5340_dvk_cpuapp_ns``.
304   To invoke the building of TF-M the Zephyr build system requires the
305   Kconfig option ``BUILD_WITH_TFM`` to be enabled, which is done by
306   default when building Zephyr as a Non-Secure application.
307   The Zephyr build system will perform the following steps automatically:
308
309      * Build the Non-Secure firmware image as a regular Zephyr application
310      * Build a TF-M (secure) firmware image
311      * Merge the output image binaries together
312      * Optionally build a bootloader image (MCUboot)
313
314.. note::
315
316   Depending on the TF-M configuration, an application DTS overlay may
317   be required, to adjust the Non-Secure image Flash and SRAM starting
318   address and sizes.
319
3202. Build the application firmware for the network core using
321   ``-DBOARD=bl5340_dvk_cpunet``.
322
323Building the Secure firmware using Zephyr
324-----------------------------------------
325
326The process to build the Secure and the Non-Secure firmware images
327using Zephyr requires the following steps:
328
3291. Build the Secure Zephyr application for the application core
330   using ``-DBOARD=bl5340_dvk_cpuapp`` and
331   ``CONFIG_TRUSTED_EXECUTION_SECURE=y`` and ``CONFIG_BUILD_WITH_TFM=n``
332   in the application project configuration file.
3332. Build the Non-Secure Zephyr application for the application core
334   using ``-DBOARD=bl5340_dvk_cpuapp_ns``.
3353. Merge the two binaries together.
3364. Build the application firmware for the network core using
337   ``-DBOARD=bl5340_dvk_cpunet``.
338
339When building a Secure/Non-Secure application for the BL5340's
340application core, the Secure application will have to set the IDAU
341(SPU) configuration to allow Non-Secure access to all CPU resources
342utilized by the Non-Secure application firmware. SPU configuration
343shall take place before jumping to the Non-Secure application.
344
345Building a Secure only application
346==================================
347
348Build the Zephyr app in the usual way (see :ref:`build_an_application`
349and :ref:`application_run`), using ``-DBOARD=bl5340_dvk_cpuapp`` for
350the firmware running on the BL5340's application core, and using
351``-DBOARD=bl5340_dvk_cpunet`` for the firmware running
352on the BL5340's network core.
353
354Flashing
355========
356
357Follow the instructions in the :ref:`nordic_segger` page to install
358and configure all the necessary software. Further information can be
359found in :ref:`nordic_segger_flashing`. Then you can build and flash
360applications as usual (:ref:`build_an_application` and
361:ref:`application_run` for more details).
362
363.. warning::
364
365   The BL5340 has a flash read-back protection feature. When flash
366   read-back protection is active, you will need to recover the chip
367   before reflashing. If you are flashing with
368   :ref:`west <west-build-flash-debug>`, run this command for more
369   details on the related ``--recover`` option:
370
371   .. code-block:: console
372
373      west flash -H -r nrfjprog --skip-rebuild
374
375.. note::
376
377   Flashing and debugging applications on the BL5340 DVK requires
378   upgrading the nRF Command Line Tools to version 10.12.0 or newer.
379   Further information on how to install the nRF Command Line Tools can
380   be found in :ref:`nordic_segger_flashing`.
381
382Here is an example for the :ref:`hello_world` application running on the
383BL5340's application core.
384
385First, run your favorite terminal program to listen for output.
386
387.. code-block:: console
388
389   $ minicom -D <tty_device> -b 115200
390
391Replace :code:`<tty_device>` with the port where the BL5340 DVK board
392can be found. For example, under Linux, :code:`/dev/ttyACM0`.
393
394Then build and flash the application in the usual way.
395
396.. zephyr-app-commands::
397   :zephyr-app: samples/hello_world
398   :board: bl5340_dvk_cpuapp
399   :goals: build flash
400
401Debugging
402=========
403
404Refer to the :ref:`nordic_segger` page to learn about debugging
405boards with a Segger IC.
406
407Testing Bluetooth on the BL5340 DVK
408***********************************
409Many of the Bluetooth examples will work on the BL5340 DVK.
410Try them out:
411
412* :ref:`ble_peripheral`
413* :ref:`bluetooth-eddystone-sample`
414* :ref:`bluetooth-ibeacon-sample`
415
416References
417**********
418
419.. target-notes::
420
421.. _IDAU:
422   https://developer.arm.com/docs/100690/latest/attribution-units-sau-and-idau
423.. _BL5340 homepage: https://www.lairdconnect.com/wireless-modules/bluetooth-modules/bluetooth-5-modules/bl5340-series-multi-core-bluetooth-52-802154-nfc-modules
424.. _Nordic Semiconductor Infocenter: https://infocenter.nordicsemi.com
425.. _TI TCA9538 datasheet: https://www.ti.com/lit/gpn/TCA9538
426.. _Macronix MX25R6435FZNIL0 datasheet: https://www.macronix.com/Lists/Datasheet/Attachments/8868/MX25R6435F,%20Wide%20Range,%2064Mb,%20v1.6.pdf
427.. _Giantec GT24C256C-2GLI-TR datasheet: https://www.giantec-semi.com/juchen1123/uploads/pdf/GT24C256C_DS_Cu.pdf
428.. _Bosch BME680 datasheet: https://www.bosch-sensortec.com/media/boschsensortec/downloads/datasheets/bst-bme680-ds001.pdf
429.. _ST Microelectronics LIS3DH datasheet: https://www.st.com/resource/en/datasheet/lis3dh.pdf
430.. _Microchip ENC424J600 datasheet: https://ww1.microchip.com/downloads/en/DeviceDoc/39935c.pdf
431.. _ER_TFTM028_4 datasheet: https://www.buydisplay.com/download/manual/ER-TFTM028-4_Datasheet.pdf
432.. _ILI9341 datasheet: https://www.buydisplay.com/download/ic/ILI9341.pdf
433.. _FT6206 datasheet: https://www.buydisplay.com/download/ic/FT6206.pdf
434.. _Microchip MCP7940N datasheet: https://ww1.microchip.com/downloads/en/DeviceDoc/20005010H.pdf
435.. _Microchip MCP4725 datasheet: https://ww1.microchip.com/downloads/en/DeviceDoc/22039d.pdf
436.. _Trusted Firmware M: https://www.trustedfirmware.org/projects/tf-m/
437