This is only a preview of the December 2022 issue of Silicon Chip. You can view 42 of the 112 pages in the full issue, including the advertisments. For full access, purchase the issue for $10.00 or subscribe for access to the latest issues. Items relevant to "Dual-channel Breadboard PSU":
Items relevant to "Breadboard PSU Display Adaptor":
Items relevant to "Active Monitor Speakers, Part 2":
Items relevant to "Digital Boost Regulator":
Purchase a printed copy of this issue for $11.50. |
NORDIC
SEMICONDUCTOR
nRF5340 DK
Review by Tim Blythman
Nordic Semiconductor is known for its wireless communications products and lowpower devices; you can find their parts in many products. This board is based on
the nRF5340 SoC (system on a chip), a dual-core ARM chip that can dedicate one
core to wireless communications, leaving the main core free for other applications.
W
e decided to try out the new
nRF5340 DK development board
from Nordic Semiconductor since it
is a bit different from anything we’ve
reviewed previously. The suggested
applications for the nRF5340 are:
■ Advanced computer peripherals
and I/O devices
■ Health/fitness sensor and monitor devices
■ Wireless payment devices
■ Wireless audio devices, eg, headphones, microphones, true wireless earbuds and speakers with
Bluetooth Low Energy (LE) Audio
■ Smart home sensors and controllers
■ Industrial IoT sensors and controllers
Interactive entertainment devices
Remote controls
Gaming controllers
Professional lighting
Wirelessly connected luminaires
You could be using devices daily
that include Nordic Semiconductor
parts without realising. If you’re using
something that relies on Bluetooth LE
communication, there’s a reasonable
chance it includes a chip from Nordic
Semiconductor.
They also make products that work
with other wireless protocols and
bands and are known for their low
power consumption.
While Nordic Semiconductor has
a history going back around 40 years,
chips like the nRF5340 are based on
■
■
■
■
■
a line of parts dating to 2012: the
nRF51 series is a low-power wireless
SoC incorporating an ARM Cortex
M0 microcontroller and a 2.4GHz RF
transceiver.
The later nRF52 series used an ARM
Cortex M4. These chips are even at the
core of some Arduino boards, like the
Arduino Nano 33 BLE and BLE Sense,
which have the nRF52840. The Arduino Primo uses an nRF52832, providing Bluetooth LE and NFC via PCB
antennas. The BBC micro:bit V2 uses
an nRF52833.
Fig.1 shows a very small subset of
the boards that can be programmed
with the nRF Connect SDK, which we
will discuss later.
There is also the nRF91 series,
The nRF5340 DK is well
equipped. The ‘target’
nRF5340 chip and the
typical complement of
components needed
for a minimal
implementation
is located inside
the small white
rectangle on the
right (near the
logo). Nearby
is a 64MB flash
chip, a detachable
NFC antenna (on flex PCB;
not shown to scale), a PCB trace
antenna and some user LEDs and buttons. There is
another nRF5340 for programming and debugging, plus various
shorting pads and breakouts, including Arduino-compatible headers.
76
Silicon Chip
Australia's electronics magazine
siliconchip.com.au
which implements LTE (a type of 4G
mobile phone technology) and GPS
(global positioning system). Naturally, these chips operate on different frequency bands than the nRF5
series parts.
The nRF53 family is the latest in the
nRF5 series, and the nRF5340 DK is a
development board for the nRF5340
chip. So it also implements 2.4GHz
communication protocols such as
Bluetooth and NFC.
We have previously reviewed a
Nordic product in the September
2002 issue (“One-chip Transceivers”;
siliconchip.au/Article/6738). The
chip described in that article was the
nRF401, a far simpler transceiver than
the nRF5340.
The nRF5340
Unlike the earlier single-core parts,
the nRF5340 is a single chip containing two distinct ARM Cortex M33
cores. The smaller ‘network’ processor runs at 64MHz and is provisioned
with 256kiB of flash memory and
64kiB of RAM.
The network processor handles
wireless communications and, typically, the wireless protocol stack. That
can include Bluetooth LE, Bluetooth
5.3, LE Audio, ZigBee and the Matter standard, which all operate on the
2.4GHz ISM (industrial, scientific and
medical) band.
The nRF5340 does not offer WiFi
(which often uses the 2.4GHz band);
to do this requires a companion IC.
The ‘application’ processor can
run up to 128MHz and has a separate
1MB of flash memory and 512kB of
RAM. Security is provided by ARM
Fig.1: some of the boards supported
by the nRF Connect SDK; several
Arduino boards and the BBC micro:bit
are included. Even if you don’t have
an nRF5340 DK, you might have
another board that it can program.
TrustZone and CryptoCell-312 with
secure storage and bootloader.
This processor can also access external programs stored in off-chip flash
memory via QSPI, expanding the
non-volatile storage. Onboard peripherals include full-speed USB, UART,
SPI, TWI (I2C), I2S (for audio data) and
a 12-bit, 200 kilosample/second ADC.
The application processor also
implements NFC. NFC allows devices
to communicate, pair and authenticate when in close proximity, typically less than 5cm (this technology is
used by “payWave” with credit cards
and smartphones). This can allow, for
example, a Bluetooth connection to be
initiated without requiring a PIN code
to be entered.
The processor cores communicate
via a dedicated IPC (inter-processor
communication) peripheral on each
Power source switch
Debug in
core and a shared memory area.
The two cores are separate enough
that it’s entirely possible to use just
one of them. A sample ‘empty firmware’ for the application core hands
control of the I/O pins to the network
core and places the application core
into a low-power mode, allowing the
network core to do all the work.
This may be suitable for designs that
can make do with just the resources
available on the network core. It’s also
possible to design for just the application core, although that would not
allow wireless communication.
So it’s a capable chip that would
easily outperform many of the other
chips that we have used in our projects
previously, plus it can handle a range
of wireless communication protocols.
The nRF5340 DK board
The nRF5340 DK is the official
development kit from Nordic Semiconductor for the nRF5340. It’s a populated PCB measuring 64mm by 136mm
– see Fig.2.
The reverse side contains only a
2032 coin cell holder and is otherwise covered with information about
the roles of the various shorting pads
on the front of the PCB.
The nRF5340 chip is in the white
rectangle on the right. This area also
contains other essential components
needed for its operation, such as
bypass capacitors and a crystal oscillator.
A 64MB QSPI flash memory chip
sits just outside this area, as does an
SWF connector for making RF measurements and a PCB trace antenna
for 2.4GHz communications. The
nRF USB connector
Debug out
User-programmable LEDs
Current measurement pins
SWF RF port for direct
RF measurements
nRF5340 SoC
SEGGER J-link
USB connector
2.4GHz PCB antenna
External power source
External memory
LiPo battery connector
User-programmable buttons
Power switch
Direct power supply switch
SEGGER J-link
OB programmer/debugger
Reset button
NFC antenna connector
Fig.2: the features and documentation of the nRF5340 DK are pretty good. It contains many more features than most
people would use; many can be disconnected by opening a shorting pad on the PCB.
siliconchip.com.au
Australia's electronics magazine
December 2022 77
antenna should also be considered an
essential component for RF applications. A second micro-B USB socket
connects to the USB pins on the
nRF5340, allowing USB applications
to be tested.
The general purpose I/O (GPIO) pins
are broken out to headers and edge
connectors, including a set of Arduino
R3-compatible headers. This means
you can use that you can use common
shields and modules for prototyping.
There is a connector for an included
NFC antenna for NFC testing. Four tactile switches and four LEDs are also
provided for user interfacing.
The remainder of the kit contains a
second nRF5340 chip programmed as
a SEGGER J-Link Debugger, which provides a virtual mass storage device so
you can program the target nRF5340
via a simple drag-and-drop interface.
The Debugger chip also provides USB
virtual serial ports for communication with the target nRF5340 using its
UART peripherals.
As well as USB power, a switch
allows the nRF5340 to be powered
from the 2032 coin cell or a lithium
battery connected to a dedicated
connector. The Debugger and target
nRF5340 can be independently powered if required.
There are shorting pads that can
be opened to allow the placement of
shunt resistors for current measuring.
The back of the board is quite sparse; apart from the 2032 coin cell holder,
the PCB silkscreen lists the roles of the various sorting pads.
External headers are provided for making measurements across the shunt
resistors.
Numerous other shorting pads can
be used to disconnect features on the
nRF5340 DK, to allow the pins to be
used for other purposes.
A small slide switch is provided
near the buttons that control several
analog switches. This disconnects the
debugger chip so accurate current measurements can be made with just the
target nRF5340 chip powered.
This is especially important at the
low power levels that the nRF5340
DK is capable of. As you can see,
the nRF5340 DK is not just a simple
breakout board, but a fully-fledged
Fig.3: the functional features of
the nRF5340 DK. To the right are
components that could be part of a
standalone design, on the left is the
debugging and testing circuitry.
78
Silicon Chip
nRF5340 implementation accompanied by programming, debugging and
testing features.
Such an arrangement should allow
developers to get their software well
advanced and their hardware prototypes very close to complete before
needing to step beyond the nRF5340
DK.
The full schematic and Altium
Designer PCB files are also available
for download, easing the design of custom hardware and helping developers
see precisely how the development kit
board is configured.
Fig.3 shows a block diagram of functional parts on the nRF5340 DK. The
user guide at siliconchip.au/link/abgy
goes into more detail about the various
board features and important details
like pin allocations.
nRF Connect SDK
Such a development board is not
of much use without an appropriate SDK (software development kit).
The nRF Connect SDK is what Nordic Semiconductor provides for the
nRF52, nRF53 and nRF91 series of
devices. It can run under Windows,
Mac and Linux.
It uses Microsoft’s Visual Studio
Code as its IDE (integrated development environment). The SDK includes
protocol and hardware libraries, samples and demo code. Once a project is
set up, a single mouse click can compile code and program it to the chip
on the nRF5340 DK.
There are a few steps to set the IDE
up, but it is all fairly intuitive. A video
playlist explains the setup process and
then shows how to create a basic application using example code, compile it
and run it on the nRF5340 DK.
Australia's electronics magazine
siliconchip.com.au
Fig.4: inside
Visual Studio
Code, code editing
is done in the
main window on
the right, while
the nRF Connect
SDK provides
actions and
resources at the
left to work with
the nRF5340 DK.
Once everything
is set up, a single
click on the
button under the
mouse pointer
will compile the
code and program
the selected
device.
That YouTube playlist can be found
at siliconchip.au/link/abgz or search
YouTube for “nRF Connect for VS Code
tutorials”. There is also a text version
at siliconchip.au/link/abh0
There were slight differences in the
steps required for the versions shown
in the tutorials and the latest versions of the software, but it was easy
enough to figure out. There are a few
steps using the nRF Connect for Desktop program to install the ‘toolchain’
(compiler and programmer software)
and Visual Studio Code.
A separate Programmer utility can
also be installed, which allowed us
to use some sample HEX files that we
found mentioned in another tutorial.
These and other tools can be installed
from nRF Connect for Desktop.
On our Windows machine, it came
to around 4GB installed, including
~3.5GB for the nRF software and
~0.5GB for the Visual Studio Code
IDE.
After setting up the first sample
project, you’ll see a window much
like Fig.4. The code for main.c is in
the large window on the right, while
the panels give a range of information.
Compiling and programming the project takes only a single click on the button under the mouse pointer.
The sample software for the
siliconchip.com.au
nRF5340 chip is based on the Zephyr
RTOS (real-time operating system),
which has support for different chips,
including many based on the ARM
architecture.
Similar to an operating system on
a PC, Zephyr RTOS provides a wide
range of interfaces and features uniformly on differing hardware. That
makes it easy to get the same software
running on various devices.
Zephyr is optimised for use on
smaller devices such as microcontrollers, and there are many libraries
provided that offer simple interfaces
to the peripherals.
nRF Toolbox app
The nRF Toolbox app is available for
Android and iOS devices. It’s designed
to interface with sample applications
(from the nRF Connect SDK) that use
Bluetooth LE. So it’s pretty easy to
check for Bluetooth functionality.
You can download the Heart Rate
Monitor demo from siliconchip.au/
link/abh1
It includes a pair of HEX files that
can be programmed to the nRF5340
DK using the nRF Connect Programmer tool.
This then communicates with the
nRF Toolbox app to form an emulated
heart rate monitoring device. Fig.5
Australia's electronics magazine
Fig.5: the nRF Toolbox app can
interface with sample smartphone
apps to test features like Bluetooth
communication. The suggested uses
of the nRF5340 include devices for
health monitoring, audio playback/
recording and sensing, all of which
would often communicate with a
mobile device.
December 2022 79
shows the app’s main screen; it’s clear
that health and fitness sensors are one
of the intended uses of the nRF5340.
Testing the sample code
We tried a few of the code samples.
The nRF Connect add-on in Visual
Studio Code makes it easy to clone
the examples so we could tinker with
the code to see what we could change.
There are over 500 examples,
including over 100 for different sensor
ICs, modules and shields. Not all the
examples will work with the nRF5340,
but most of the ones we tried did.
Complex peripherals such as USB
have examples for HID (human interface device, such as mouse and keyboard), CDC (communication device
class, for virtual serial ports) and mass
storage devices.
There are even more diverse examples for Bluetooth and other wireless
protocols such as ZigBee. The code is
all in the C language. We didn’t have
many surprises, and mostly, things
worked as expected.
There are several NFC examples
that work with a separate NFC add-on
module and not with the nRF5340’s
inbuilt NFC peripheral, so it was simply a case of making sure that we used
the correct example.
Fig.6 shows an NFC example that
worked for us. It emulates an NFC
tag that can be read, for example,
by an NFC reader app on a mobile
phone. The information shown here
is displayed in Visual Studio Code,
although it is also available on an
external browser via the link at the
bottom.
There are even audio examples
available, including Bluetooth audio
sources and sinks and USB examples that emulate microphones and
headphones. Emulation is necessary because the nRF5340 DK does
not have external audio interfaces
(although they could be added easily enough).
If you are interested in audio applications, there is an nRF5340 Audio
DK development kit with an onboard
codec chip and a pair of 3.5mm audio
jacks for handling real-life audio.
In general, we found the trickiest
part of creating custom code based
on the examples was finding out how
to access and control the various
peripherals through the Zephyr operating system. One handy aspect of the
examples is that they provide liberal
debugging data that you can access
through one of the virtual serial ports
at 115,200 baud.
Conclusion
The nRF5340-DK has been designed
well and is based on the versatile and
powerful nRF5340 chip. It is well
backed by software that’s easy to set
up and use, with many examples. The
design files are available, so a compatible hardware design can be developed
without hassles.
While it is clearly intended to be
used to develop standalone products
for the nRF5340, it would also be a
worthwhile starting point for those
who want to experiment with Bluetooth, NFC and other wireless communications.
It would be a great way to produce
a one-off project, the type that many
of our hobbyist readers might consider, especially if it requires Bluetooth or other 2.4GHz wireless communications.
The nRF5340-DK can be purchased
from these retailers:
1. Mouser (in stock at time of writing):
au.mouser.com/ProductDetail/
949-NRF5340-DK
2. element14 (stock due November):
au.element14.com/3617670
3. Digi-Key (in stock currently):
www.digikey.com.au/en/products/
detail/NRF5340-DK/13544603 SC
Fig.6: NFC allows data to be communicated over short ranges, often to facilitate Bluetooth pairing. In the sample software
shown here, the nRF5340 DK is programmed to emulate a tag carrying data that can be scanned by a device with an NFC
reader, such as a smartphone.
80
Silicon Chip
Australia's electronics magazine
siliconchip.com.au
|