Template: Sample

Note

  • Give the sample a concise name that corresponds to the folder name. If the sample targets a specific protocol or device, add it in the title before the sample name (for example, “NFC:” or “nRF9160:”). Do not include the word “sample” in the title.

  • Put the documentation inside the sample folder and use the file name README.rst.

  • Use the provided stock phrases and includes when possible.

  • Sections with * are optional and can be left out. All other sections are required for all samples. Do not add new sections (unless in the sections that allow for further subsections) without discussion with the tech writer team.

The Sample sample demonstrates how to blink LEDs in the rhythm of the music that is played.

Tip

Explain what this sample demonstrates in one, max two sentences (full sentences, not sentence fragments). This introduction should give users a clear idea of what the sample can be used for.

Think about use cases: “The XYZ sample shows how to use the XYZ library” is not a good introduction, because customers do not want to use the XYZ library, but they want to get a task done. Instead, write something like “The XYZ sample shows how to do this awesome task. It uses the XYZ library”.

Requirements

Note

  • Supported kits are listed in a table, which is composed of rows from the doc/nrf/includes/sample_board_rows.txt file. Select the required rows in the :rows: configuration, or specify :sample-yaml-rows: to include all boards specified in the sample.yaml file.

  • If only one kit is supported, replace the introduction text with “The sample supports the following development kit:”.

  • If several kits are required to test the sample, state it after the table (for example, “You can use one or more of the development kits listed above and mix different development kits.”).

  • Mention additional requirements after the table.

  • If SPM is included in the sample, add .. include:: /includes/spm.txt to include the standard text that states this.

The sample supports the following development kits:

Hardware platforms

PCA

Board name

Build target

nRF52 DK

PCA10040

nrf52dk_nrf52832

nrf52dk_nrf52832

nRF52840 DK

PCA10056

nrf52840dk_nrf52840

nrf52840dk_nrf52840

The sample also requires …

The sample is configured to compile and run as a non-secure application on nRF91’s Cortex-M33. Therefore, it automatically includes the Secure Partition Manager that prepares the required peripherals to be available for the application.

Overview

You can use this sample as a starting point to implement a disco light.

The sample uses the :ref:RST link library to control the LEDs. In addition, it uses the :ref:RST link sound sensor and hooks up to some Internet service to download cool blinking sequences.

Tip

Continue the explanation on what this sample is about. What does it show, and why should users try it out? What is the practical use? How can users extend this sample? What libraries are used (link to them)?

Some title*

Note

Add subsections for technical details. Give them a suitable title (sentence style capitalization, thus only the first word capitalized). If there is nothing important to point out, do not include any subsections.

The sample repeatedly calls function ABC, which …

Tip

Do not just list the functions that are called, but clarify general concepts or explain parts of the implementation that might be unintuitive for some reason.

Wiring*

Connect PIN1 to PIN2, then cut the connection again.

User interface*

Note

Add button and LED assignments here, plus other information related to the user interface (for example, supported commands).

Button 1:

Does something.

Button 2:

Toggles something.

LED 1:

On when connected.

LED 2:

Indicates something.

Configuration*

Note

Always include this section if your sample can be configured by the user. Start with the stock phrase that is included with |config|.

See Configuring your application for information about how to permanently or temporarily change the configuration.

Setup*

Note

Add information about the initial setup here, for example, that the user must install or enable some library before they can compile this sample, or set up and select a specific backend. Most samples do not need this section.

Configuration options*

Note

  • You do not need to list all configuration options of the sample, but only the ones that are important for the sample and make sense for the user to know about.

  • The syntax below allows sample configuration options to link to the option descriptions in the same way as the library configuration options link to the corresponding Kconfig descriptions (:option:`SAMPLE_CONFIG`, which results in SAMPLE_CONFIG).

  • For each configuration option, list the symbol name and the string describing it.

Check and configure the following configuration options for the sample:

SAMPLE_CONFIG - Sample configuration

The sample configuration defines …

ANOTHER_CONFIG - Another configuration

This configuration option specifies …

Additional configuration*

Note

  • Add this section to describe and link to any library configuration options that might be important to run this sample. You can link to options with :option:`CONFIG_XXX`.

  • You do not need to list all possible configuration options, but only the ones that are relevant.

Check and configure the following library options that are used by the sample:

Configuration files*

Note

Add this section if the sample provides predefined configuration files.

The sample provides predefined configuration files for typical use cases. You can find the configuration files in the XXX directory.

The following files are available:

  • filename.conf - Specific scenario. This configuration file …

Building and running

Note

  • Include the standard text for building - either .. include:: /includes/build_and_run.txt or .. include:: /includes/build_and_run_nrf9160.txt.

  • Remember that the main IDE for nRF Connect SDK is SEGGER Embedded Studio. Therefore, build instructions for SES are required. Build instructions for the command line are optional.

  • If the sample uses a non-standard setup, point it out and link to more information, if possible.

This sample can be found under samples/XXX in the nRF Connect SDK folder structure.

See Building and programming a sample application for information about how to build and program the application.

Note that this sample enables the XXX stack. See REF for more information.

Some title*

Note

If required, add subsections for additional build instructions. Use these subsections sparingly and only if the content does not fit into other sections (mainly Configuration). If the additional build instructions are valid for other samples as well, consider adding them to the Getting started section instead and linking to them.

Testing

After programming the sample to your development kit, test it by performing the following steps:

  1. Connect the kit to the computer using a USB cable. The kit is assigned a COM port (Windows) or ttyACM device (Linux), which is visible in the Device Manager.

  2. Connect to the kit with a terminal emulator (for example, PuTTY). See How to connect with PuTTY for the required settings.

  3. Press a button on the development kit.

  4. Look at the flashing lights.

  5. And so on …

Note

  • Use the shortcuts provided in doc/nrf/shortcuts.txt to keep the wording consistent.

  • If there are different ways of testing, introduce them in this section (for example, “After programming the sample to your development kit, you can test it either by …”) and add subsections for the different scenarios.

Sample output*

Note

Add the full output of the sample in this section, or include parts of the output in the testing steps in the previous section.

The following output is logged on RTT:

whatever

Troubleshooting*

If the LEDs do not start blinking, check if the music is loud enough.

Known issues and limitations*

The sample only works with good music.

References*

  • Music chapter in the Bluetooth Spec (-> always link)

  • Disco ball datasheet

Tip

  • Do not duplicate links that have been mentioned in other sections before.

  • Do not include links to documents that are common to all or many of our samples. For example, the Bluetooth Spec or the DK user guides are always important, but shouldn’t be listed.

  • Include specific links, like a chapter in the Bluetooth Spec if the sample demonstrates the respective feature, or a link to the hardware pictures in the DK user guide if there is a lot of wiring required, or specific information about the feature that is presented in the sample.

Dependencies*

Note

  • List all relevant libraries. Standard libraries (for example, types.h, errno.h, or printk.h) do not need to be listed.

  • Delete the parts that are not relevant.

  • Drivers can be listed under libraries, no need for a separate part.

  • If possible, link to the respective library. If there is no documentation for the library, include the path.

This sample uses the following nRF Connect SDK libraries:

It uses the following sdk-nrfxlib libraries:

It uses the following Zephyr libraries:

In addition, it uses the following samples:

The sample also uses drivers from nrfx.

Internal modules*

Note

Include this section only for applications (not samples), and only if there are internal modules that must be documented.