Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs

NRF52832 ble detection issue

I've been struggling with a board issue for a week now. I'm using the nRF52835 with an external antenna. I'm trying to run an example after installing the nRF Connect SDK. I've loaded various Bluetooth examples from both the nRF SDK (via Segger IDE) and the nRF Connect SDK, but the device is not being discovered. In my understanding, both examples should work out of the box, but unfortunately, they don't. I've uploaded the projects to the cloud. Link to the files https://drive.google.com/file/d/15gjsuDHun9xgwL13yR_y65k9e1L3tR-k/view?usp=sharing (Versions: NRF SDK 1.7.0, nrf-connect sdk 2.5.0)

When using nRF Connect, I've set the build configuration to the nRF52DK board and tried creating a custom one, but neither option worked. LED examples are working fine. I'm trying to find a BLE device with my phone.

Parents Reply Children
  • Thanks for the help. I added CONFIG_CLOCK_CONTROL_NRF_K32SRC_RC=y in proj.conf and now debug mode is working properly, and there are no errors occurring during code execution. However, the phone still cannot detect the device. Here is the code I am using: 

    /* main.c - Application main entry point */

    /*
     * Copyright (c) 2015-2016 Intel Corporation
     *
     * SPDX-License-Identifier: Apache-2.0
     */

    #include <zephyr/types.h>
    #include <stddef.h>
    #include <zephyr/sys/printk.h>
    #include <zephyr/sys/util.h>

    #include <zephyr/bluetooth/bluetooth.h>
    #include <zephyr/bluetooth/hci.h>

    static uint8_t mfg_data[] = { 0xff, 0xff, 0x00 };

    static const struct bt_data ad[] = {
        BT_DATA(BT_DATA_MANUFACTURER_DATA, mfg_data, 3),
    };

    static void scan_cb(const bt_addr_le_t *addr, int8_t rssi, uint8_t adv_type,
                struct net_buf_simple *buf)
    {
        mfg_data[2]++;
    }

    int main(void)
    {
        struct bt_le_scan_param scan_param = {
            .type       = BT_HCI_LE_SCAN_PASSIVE,
            .options    = BT_LE_SCAN_OPT_NONE,
            .interval   = 0x0010,
            .window     = 0x0010,
        };
        int err;

        printk("Starting Scanner/Advertiser Demo\n");

        /* Initialize the Bluetooth Subsystem */
        err = bt_enable(NULL);
        if (err) {
            printk("Bluetooth init failed (err %d)\n", err);
            return 0;
        }

        printk("Bluetooth initialized\n");

        err = bt_le_scan_start(&scan_param, scan_cb);
        if (err) {
            printk("Starting scanning failed (err %d)\n", err);
            return 0;
        }

        do {
            k_sleep(K_MSEC(400));

            /* Start advertising */
            err = bt_le_adv_start(BT_LE_ADV_NCONN, ad, ARRAY_SIZE(ad),
                          NULL, 0);
            if (err) {
                printk("Advertising failed to start (err %d)\n", err);
                return 0;
            }

            k_sleep(K_MSEC(400));

            err = bt_le_adv_stop();
            if (err) {
                printk("Advertising failed to stop (err %d)\n", err);
                return 0;
            }
        } while (1);
        return 0;
    }

  • Hi,

    Can you start with something easier such as the unmodified beacon sample in the sdk?

    Can you verify that you're able to flash and run the sample without it asserting?

    regards
    Jared 

  • Hello!

    I flashed and ran the beacon example. No errors occurred, and the device consumes 13-15 milliamperes. However, the phone does not detect it. In the debugger, the code executes from start to finish without errors. Also used CONFIG_CLOCK_CONTROL_NRF_K32SRC_RC=y.

    Code:

    /* main.c - Application main entry point */
    
    /*
     * Copyright (c) 2015-2016 Intel Corporation
     *
     * SPDX-License-Identifier: Apache-2.0
     */
    
    #include <zephyr/types.h>
    #include <stddef.h>
    #include <zephyr/sys/printk.h>
    #include <zephyr/sys/util.h>
    
    #include <zephyr/bluetooth/bluetooth.h>
    #include <zephyr/bluetooth/hci.h>
    
    #define DEVICE_NAME CONFIG_BT_DEVICE_NAME
    #define DEVICE_NAME_LEN (sizeof(DEVICE_NAME) - 1)
    
    /*
     * Set Advertisement data. Based on the Eddystone specification:
     * https://github.com/google/eddystone/blob/master/protocol-specification.md
     * https://github.com/google/eddystone/tree/master/eddystone-url
     */
    static const struct bt_data ad[] = {
        BT_DATA_BYTES(BT_DATA_FLAGS, BT_LE_AD_NO_BREDR),
        BT_DATA_BYTES(BT_DATA_UUID16_ALL, 0xaa, 0xfe),
        BT_DATA_BYTES(BT_DATA_SVC_DATA16,
                  0xaa, 0xfe, /* Eddystone UUID */
                  0x10, /* Eddystone-URL frame type */
                  0x00, /* Calibrated Tx power at 0m */
                  0x00, /* URL Scheme Prefix http://www. */
                  'z', 'e', 'p', 'h', 'y', 'r',
                  'p', 'r', 'o', 'j', 'e', 'c', 't',
                  0x08) /* .org */
    };
    
    /* Set Scan Response data */
    static const struct bt_data sd[] = {
        BT_DATA(BT_DATA_NAME_COMPLETE, DEVICE_NAME, DEVICE_NAME_LEN),
    };
    
    static void bt_ready(int err)
    {
        char addr_s[BT_ADDR_LE_STR_LEN];
        bt_addr_le_t addr = {0};
        size_t count = 1;
    
        if (err) {
            printk("Bluetooth init failed (err %d)\n", err);
            return;
        }
    
        printk("Bluetooth initialized\n");
    
        /* Start advertising */
        err = bt_le_adv_start(BT_LE_ADV_NCONN_IDENTITY, ad, ARRAY_SIZE(ad),
                      sd, ARRAY_SIZE(sd));
        if (err) {
            printk("Advertising failed to start (err %d)\n", err);
            return;
        }
    
    
        /* For connectable advertising you would use
         * bt_le_oob_get_local().  For non-connectable non-identity
         * advertising an non-resolvable private address is used;
         * there is no API to retrieve that.
         */
    
        bt_id_get(&addr, &count);
        bt_addr_le_to_str(&addr, addr_s, sizeof(addr_s));
    
        printk("Beacon started, advertising as %s\n", addr_s);
    }
    
    int main(void)
    {
        int err;
    
        printk("Starting Beacon Demo\n");
    
        /* Initialize the Bluetooth Subsystem */
        err = bt_enable(bt_ready);
        if (err) {
            printk("Bluetooth init failed (err %d)\n", err);
        }
        return 0;
    }
  • And how can i set up clocking using an external high-frequency crystal correctly?

  • Hi,

    The clock will automatically be chosen by one of the Kconfigs that you provide, looking at your schematic there is multiple points that should be addressed:

    1. The high frequency crystal needs parallel load capacitors
    2. You need to replicate the same size for the matching components as in the reference design that means 0.8 pF and 3.9 nH,
    3. You do not have decoupling on VDD
    4. You're missing an inductor for the DC/DC

    reference design:

    Try setting CONFIG_BOARD_ENABLE_DCDC=n in the project config and see if it works,

    regards

    Jared 

Related