Skip to content

Getting Started🔗

Introduction🔗

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

Overview🔗

The development environment from Nordic Semiconductor for the PAN1782 is based on the nRF 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, including the installation of the nRF Connect for Visual Studio Code extension pack.

  2. Installation of a recent version of the nRF Connect SDK toolchain and the nRF Connect SDK code.

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 edit box, you have to choose Copy a sample first.

  3. In the newly opened edit box, you can search for sample applications 1. Enter peripheral_uart here. From the list of applications choose BLE UART service .

  4. In the newly opened edit box, you have to configure and confirm the path 1 where the new application is stored.

  5. You have to finish the project setup by clicking Open

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 Add build configuration .

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

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

Note

For the PAN1782 evaluation board choose pan1782_evb.

  1. Sometimes you can choose different project configurations using the Configuration 1 drop-down list. The same is true for Kconfig fragments 2 and Devicetree overlays 3 .

    You may have to check out the individual sample descriptions in the nRF Connect SDK for necessary settings.

    Finally click Build Configuration 4 to finish.

  2. 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 View → Terminal from the main Visual Studio Code window.

Customization🔗

Bluetooth Device Address🔗

All applications from the nRF Connect SDK automatically use the built-in random Bluetooth Device Address.

But if you want to use the built-in public Bluetooth Device Address from Panasonic instead, you can use the following approach on most applications.

  1. Open the file main.c and locate the call to the function bt_enable() in the main() function.

    main.c
      err = bt_enable(NULL);
      if (err) {
        error();
      }
    
  2. Insert the following code snippet right before the call to bt_enable().

    main.c
      {
         uint8_t bt_dev_addr[6];
         bt_dev_addr[0] = NRF_UICR->CUSTOMER[0];
         bt_dev_addr[1] = NRF_UICR->CUSTOMER[0] >> 8;
         bt_dev_addr[2] = NRF_UICR->CUSTOMER[0] >> 16;
         bt_dev_addr[3] = NRF_UICR->CUSTOMER[0] >> 24;
         bt_dev_addr[4] = NRF_UICR->CUSTOMER[1];
         bt_dev_addr[5] = NRF_UICR->CUSTOMER[1] >> 8;
         bt_ctlr_set_public_addr(&bt_dev_addr[0]);
      }
    

    The application now uses the built-in public Bluetooth Device Address from Panasonic.

Build🔗

After you created the build configuration the application is usually build automatically. In this case you can skip this step.

But if you ever need to build or rebuild the application you can follow the following steps.

  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 PAN1782 evaluation board.

  1. Connect your PAN1782 evaluation board to your development system using the USB connector X1 1.

  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🔗

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

RTT Output🔗

  1. In the Connected Devices section you can click the plug icon to connect the RTT communication to the terminal window.

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

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

    SEGGER J-Link V7.88e - Real time terminal output
    J-Link OB-SAM3U128 V3 compiled Sep 22 2022 13:22:46 V3.0, SN=483150802
    Process: JLinkExe
    [00:00:00.013,397] <inf> fs_nvs: 2 Sectors of 4096 bytes
    [00:00:00.013,427] <inf> fs_nvs: alloc wra: 0, fe8
    [00:00:00.013,427] <inf> fs_nvs: data wra: 0, 0
    [00:00:00.035,949] <inf> bt_hci_core: HW Platform: Nordic Semiconductor (0x0002)
    [00:00:00.036,041] <inf> bt_hci_core: HW Variant: nRF53x (0x0003)
    [00:00:00.036,041] <inf> bt_hci_core: Firmware: Standard Bluetooth controller (0x00) Version 224.11902 Build 2231721665
    [00:00:00.037,231] <inf> bt_hci_core: No ID address. App must call settings_load()
    [00:00:00.037,261] <inf> peripheral_uart: Bluetooth initialized
    [00:00:00.038,696] <inf> bt_hci_core: Identity: DB:FB:11:25:55:78 (random)
    [00:00:00.038,757] <inf> bt_hci_core: HCI: version 5.4 (0x0d) revision 0x2077, manufacturer 0x0059
    [00:00:00.038,787] <inf> bt_hci_core: LMP: version 5.4 (0x0d) subver 0x2077
    

  4. You can click on the trash can icon right to the terminal window to close the RTT connection again.

Serial Output🔗

Serial Port Handling in Linux vs. Windows

The following instructions were assembled under Linux, so the serial port notation looks like /dev/ttyUSB0 or /dev/ttyACM0. 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.

The terminal is also capable of attaching to the serial output of the evaluation board.

  1. In the terminal, you can click on the Launch profile drop-down list 1 and select nRF Serial Terminal 2 to establish a new connection.

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

  3. You may have to choose a configuration. If so, choose 115200 8n1 rtscts:off .

  4. Now you have to press the reset button 3 to restart the application. You should see the following output in the terminal window.

    *** Booting nRF Connect SDK d96769faceca ***
    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 PAN1782 based on the nRF 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."