Getting started with Thingy:53 and Zephyr

denladeside

Lars Knudsen 🇩🇰

Posted on May 8, 2023

Getting started with Thingy:53 and Zephyr

UPDATE: hci_rpmsg was renamed to hci_ipc and the links and commands have been updated in this post.

Thingy:53 is the latest in the 'Thingy' line of devices made by Nordic Semiconductor. At first sight, it looks very much like the Thingy:52, including buzzer, microphone, RGB LED, color & light sensor, accelerometer and more. While the Thingy:52 is a VERY good device to use for experimentation with a bunch of sensors and actuators, the Thingy:53 is a much more capable device, mainly because of the much more powerful dual-core nRF5340 (Thingy:52 is powered by nRF52832).

The nRF5340 makes it possible to do advanced calculations on e.g. sensor data in the application core while the network core keeps connectivity. It also provides USB connectivity, which is hooked up to the USB port of the Thingy:53, allowing for applications to provide any kind of USB device the firmware stack supports. By the way, the nRF5340 can also run Doom!

Hardware Requirements

The easiest way to flash custom Zephyr builds to the Thingy:53 is to attach it to an nRF Development Kit (DK) via a small SWD cable attached to the debug out port of the DK.

Connect the nRF Development Kit to the host computer using a USB cable with a USB micro connector and connect the Thingy:53 to the Devlopment Kit board with the SWD connector cable:

Connecting Thingy:53 and nRF DK

Switch on the Thingy:53 by sliding the power switch to the right:

Thingy:53 power switch

Software Requirements

Install and set up a Zephyr environment by following the guide here

In addition, install the nRF Command Line Tools and the latest SEGGER J-Link software.

Note: There is a guide here going into more detail on the installation of these tools for different platforms.

To inspect Bluetooth GATT services and characteristics, I'd recommend installing the nRF Connect application on your mobile phone.

Hello World

For me, the 'Hello World' of Zephyr Bluetooth samples is the Heart Rate sensor sample. Here is how you make it run on the Thingy:53:

First make sure you have a working Zephyr environment (see above).

NOTE: All commands below are to be executed in the root zephyr folder.

For the net core (controller), you need to compile and flash the hci_ipc sample:



west build -b thingy53_nrf5340_cpunet -s samples/bluetooth/hci_ipc -d build_netcore
west flash -d build_netcore


Enter fullscreen mode Exit fullscreen mode

UPDATE NOTE: hci_rpmsg was renamed to hci_ipc here

Then build the Heart Rate sample application and flash it:



west build -b thingy53_nrf5340_cpuapp -s samples/bluetooth/peripheral_hr -d build_app_hr
west flash -d build_app_hr


Enter fullscreen mode Exit fullscreen mode

After flashing the sample, use the nRF Connect app (on the mobile) to scan for the Zephyr Heartrate Sensor:

Zephyr Heart Rate sensor scan

Click CONNECT to connect to the device, find the Heart Rate service and subscribe to heart rate measurements:

Subscribing to Heart Rate measurements

You can also try to disconnect the SWD cable and switch off the nRF Development Kit board to verify that the heart rate application is indeed running on the Thingy:53 and not the Development Kit:

Disconnecting the cables

Final notes

This is just a short introduction to get started developing for the Thingy:53 with Zephyr. Try to play with some of the other samples too. I'd recommend trying the Blinky sample and then move to more advanced things like hooking up data from the sensors to a custom GATT Service.

Enjoy! :)

💖 💪 🙅 🚩
denladeside
Lars Knudsen 🇩🇰

Posted on May 8, 2023

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related