Skip to content

Getting Started🔗

Introduction🔗

First, this guide shows you how to set up a development environment for the PAN1781 and then how to build and run a simple application on the PAN1781 evaluation board.

Overview🔗

The development environment from Nordic Semiconductor for the PAN1781 is based on the Nordic Connect SDK and Visual Studio Code.

Installation🔗

You can find step-by-step instructions for installing the development environment at Getting started.

The instructions explain the following points:

  1. Installation of all necessary prerequisites.

  2. Installation of nRF Connect for Desktop to gain access to the Toolchain Manager.

  3. Usage of the Toolchain Manager to install the latest version of the nRF Connect SDK.

  4. Usage of the Toolchain Manager to install the latest version of the nRF Connect for Visual Studio Code extension.

Afterward you are ready to build and run your first application.

Step-by-Step🔗

The following requirements must be met:

  • You must have setup the development environment as explained in Installation.

The following sections provide a step-by-step introduction on how to build and run your first application.

Project Setup🔗

You have to do the project setup from within the nRF Connect for Visual Studio Code extension.

  1. In the nRF Connect section you have to click Create a new application .

  2. In the newly opened window, you have to choose Freestanding1 first.

  3. From the list of available application templates you should choose peripheral_uart2 because this application supports Bluetooth Low Energy, serial port and debug messages through the RTT interface.

  4. You have to finish the project setup by clicking Create Application3

You can check out Bluetooth: Peripheral UART for more details about the Peripheral UART sample application.

Configuration🔗

After you have set up the project you have to create a build configuration.

  1. In the Applications section you have to click on Click to create one

  2. In the newly opened window, you have to choose All boards1 first. Then start typing pan2 in the board edit box.

  3. Continue typing or choose the evaluation board you want to use from the drop-down list.

  4. Sometimes you can choose different project configurations using the Configuration1 drop-down list.
    If you want to be able to debug the application later on you have to tick the Enable debug options2 checkbox.
    Finally click Build Configuration3 to finish.

  5. The application build is automatically started. You can observe the progress of the build in the terminal window.
    If the terminal window is not yet visible, please choose ViewTerminal from the main Visual Studio Code window.

Build🔗

After you have created a build configuration you are ready to build the application.

  1. From the Actions section you can build the application by clicking Build

Program🔗

After you have built the application you are ready to program the application to your PAN1781 evaluation board.

  1. Connect your PAN1781 evaluation board to your development system using the USB connector X11.

  2. You can check if your evaluation board is recognized correctly if it is shown in the Connected Devices section 1. If it is not, you can click on the refresh icon 2.

  3. In the Actions section you can click on Flash to start programming. You can observe the progress in the Terminal window again.

Usage🔗

Serial Port Handling in Linux vs. Windows

The following instructions were assembled under Linux, so the serial port notation looks like /dev/ttyUSB0. If you are using Windows instead, the notation is different and looks like COM10.

Also you might see multiple serial ports and you might need to find out the serial port that you actually need to use.

After you have programmed the application you can observe what the application is doing in multiple ways.

  1. In the Connected Devices section you can click the plug icon to connect the RTT communication to the nRF Terminal output.

  2. In the newly opened edit box you have to select Automatic search .

  3. You should see the following output (or similar) in the nRF Terminal output.

    SEGGER J-Link V7.86a - Real time terminal output
    J-Link OB-SAM3U128 V3 compiled Sep 22 2022 13:22:46 V3.0, SN=483115384
    Process: JLinkExe
    [00:00:00.017,211] <inf> fs_nvs: 8 Sectors of 4096 bytes
    [00:00:00.017,211] <inf> fs_nvs: alloc wra: 0, fd0
    [00:00:00.017,272] <inf> fs_nvs: data wra: 0, 1c
    [00:00:00.017,578] <inf> bt_sdc_hci_driver: SoftDevice Controller build revision: 
                                                d8 0c 2d 2f 36 ae e2 5c  80 26 80 4c 3f 4d 16 53 |..-/6..\ .&.L?M.S
                                                50 96 c7 73                                      |P..s             
    [00:00:00.025,238] <inf> bt_hci_core: No ID address. App must call settings_load()
    [00:00:00.025,329] <inf> peripheral_uart: Bluetooth initialized
    

  4. You can click on the unplug icon in the terminal window to close the RTT connection again.

  5. The nRF Terminal is also capable of attaching to the UART output of the evaluation board. You can click on the plug icon to establish a new connection.

  6. In the newly opened edit box you have to select the connection type Serial Port .

  7. In the newly opened edit box you have to select the appropriate serial port from the list of choices, for example /dev/ttyUSB0 .

  8. In the newly opened edit box you have to choose the configuration 115200 8n1 rtscts:off .

  9. Now you have to press the Reset button3 to restart the application. You should see the following output in the nRF Terminal output.

    Connected via Serial Port with settings /dev/ttyUSB0 115200 8n1 rtscts:off
    
    *** Booting Zephyr OS build v3.2.99-ncs2 ***
    Starting Nordic UART service example
    

Debugging🔗

You can also debug your application instead of just programming and running it.

  1. In the Actions section you can click on Debug to start debugging.

You can check out How to debug an application for more detailed information on how you can control the debugging process.

Summary🔗

Through this guide you have learned how to set up a development environment for the PAN1781 based on the Nordic Connect SDK and Visual Studio Code.

You have set up, configured and built the Bluetooth: Peripheral UART sample application and learned how to observe the messages and debug output on the serial port terminal and the RTT terminal.

For more information how to interact with the Bluetooth: Peripheral UART sample application you can also check out the nRF Toolbox application for your mobile device.

Further Readings🔗

Nordic Semiconductor provides extensive documentation and information for Bluetooth Low Energy.

For example, you can check out the Nordic Developer Academy which is an "[...] interactive online learning platform [...] to equip developers with the technical information and know-how to build wireless products using Nordic Semiconductor solutions."