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