This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

cannot connect peripheral (peripheral = ble_app_uart)

Hi,

I have two custom boards, one is central with nRF52933 and other is peripheral with nRF52832.

In the previous test, the connection between the 52833 central board and other beacon device was successful. So, in order to connect with 52832 custom board as it is, I modified the scan setting of the central device. I modified only the UUID and UUID type, but the central does not find the device. (Also change ble_lbs_c_init.) I can't find what settings I missed.

#define LBS_UUID_BASE       {{0x9E, 0xCA, 0xDC, 0x24, 0x0E, 0xE5, 0xA9, 0xE0, 0x93, 0xF3, 0xA3, 0xB5, 0x00, 0x00, 0x40, 0x6E}} /**< Used vendor specific UUID. */

#define LBS_UUID_SERVICE     0x0001
#define LBS_UUID_BUTTON_CHAR 0x0002
#define LBS_UUID_LED_CHAR    0x0003

//...

#define BLE_UUID_TEST_SERVICE   LBS_UUID_SERVICE            //0x0001
#define TEST_SERVICE_UUID_TYPE  BLE_UUID_TYPE_VENDOR_BEGIN  

static ble_uuid_t const m_nus_uuid =
{
    .uuid = BLE_UUID_TEST_SERVICE,     
    .type = TEST_SERVICE_UUID_TYPE
};


static void scan_init(void)
{
    ret_code_t          err_code;
    nrf_ble_scan_init_t init_scan;

    memset(&init_scan, 0, sizeof(init_scan));

    init_scan.connect_if_match = true;
    init_scan.conn_cfg_tag     = APP_BLE_CONN_CFG_TAG;

    err_code = nrf_ble_scan_init(&m_scan, &init_scan, scan_evt_handler);
    APP_ERROR_CHECK(err_code);

    err_code = nrf_ble_scan_filter_set(&m_scan, SCAN_UUID_FILTER, &m_nus_uuid);
    APP_ERROR_CHECK(err_code);

    err_code = nrf_ble_scan_filters_enable(&m_scan, NRF_BLE_SCAN_UUID_FILTER, false);
    APP_ERROR_CHECK(err_code);
}


The 52832 custom board is the same as the example of the ble_app_uart, so if it set the ble_app_uart_c on the 52833 central board, the two devices connect well.

Then, there is no problem with the peripheral board, and the central board is paired with other devices, so it's the same that there's no problem, but I think there's something missing in the scan setting that I can't find my custom peripheral board.

Except for the uuid and uuid types, where else should I check?

 

BR,

lyrics

  • Hi,

    There may be something lost in translation here, so I am not sure if I understand the question correctly. Is the following correct?

    • You have two boards (one central and one peripheral)
    • They can establish a connection when using the lbs examples (central and peripheral) from the SDK
    • They cannot establish a connection when using some other example (which one?) for the peripheral, and changing the scan (UUID & type) in the lbs central

    There might be some difference between the applications that you try to pair, if the central is expecting different services/characteristics from what the peripheral actually has. Do you get any errors on either central, peripheral, or both? Have you run debug sessions to see if anything is wrong? Have you made and looked at sniffer traces?

    Regards,
    Terje

  • My custom central board with 52833 device is project based on 'ble_app_uart', and I merged 'ble_app_uart_c' and modified it to lbs service... 

    So,

    You have two boards (one central and one peripheral)

    : Two custom board (central 52833, peripheral 52832), one Beacon Device.. (and nRF52832 board for writing program)

    They can establish a connection when using the lbs examples (central and peripheral) from the SDK

     : custom central board with 52833 AND Beacon Device establish a connection...

    They cannot establish a connection when using some other example (which one?) for the peripheral, and changing the scan (UUID & type) in the lbs central

    : custom central board with 52833 AND custom peripheral board with 52832 (ble_app_uart) cannot establish a connection.

    So I tried modify the UUID define value and UUID type on the central board, but it is still not paired with my ble_app_uart example..

    Is there anything else that I have to change except for UUID configurtaion?

    Do you get any errors on either central, peripheral, or both?

    No, they both works well!

     

    Regards,

    lyrics

  • Hi,

    I am still slightly confused regarding what you run on each of the four boards in what situations and what works and does not, but:

    The ble_app_uart_c example scans for UUIDs based on what is put in the m_nus_uuid constant in main.c, which means (16 bit part) BLE_UUID_NUS_SERVICE (defined in ble_nus_c.h) and type NUS_SERVICE_UUID_TYPE (defined in main.c).

    For this scan to work, it requires the peripheral to advertise the NUS service, using that UUID, either in the advertisements or in a scan response. Advertising services is optional in BLE, and it may be that the device that you want to connect to does not advertise services. If the peripheral is the ble_app_blinky (with the light button service) then it should advertise, however, with the LBS_UUID_SERVICE / m_lbs.uuid_type from that example. Using those in the central, the central should then find the peripheral based on the UUID advertised. I see in the lbs example that this is part of the scan response data.

    As long as the central filters on the correct UUID, and the peripheral advertises using the same UUID, you should get a connection. My best advice would be to double check that you use the same UUID in both ends, and confirm that you can find and connect to the peripheral using e.g. the nRF Connect app.

    Regards,
    Terje

  • okay. I'll explain my problem situation briefly, lastly. :) (it is hard to explain)

    1. My peripheral board is 'ble_app_uart'. (which UUID is already defined..)

    2. My central board is my own project, and I set scan config same as 'ble_app_uart_c'.

      (I used same UUID and UUID type as ble_app_uart!)

    3. But both board cannot establish connection.

    (peripheral works well, then is it problem with central..? but what kind of problem..?)

    So, what am I missing?

    Thank you for your reply.. And I understand what you explained above. 

    Begards,

    lyrics

  • Hi,

    Can you provide a sniffer log, for instance using the nRF Sniffer, from when you attempt for the devices to connect?

    Regards,
    Terje

Related