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