This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Make communication between ble central and ble peripheral

I am using Nordic NRF528321 with SDK 11.0 and soft device S132 as ble central.At peripheral side it is Nordic NRF51422 with SDK12.2 and soft device S130.I am trying to pair these two devices using the example codes. Ble peripheral starts advertising and Ble central starts scanning but the problem is ble central not able detect the uuid of the peripheral,simply it displays the 'scanning times out' message.I am newbie to the nordic.

I don't have any idea on where to update the Peripheral uuid at central side.Is there any updation in the program is required to make pairing in the example code or else just example code enough.I need to send some 25 bytes of data from the uart to peripheral and has to receive some 25 bytes of response from the peripheral.I was struggling to understand the events occurred between these two from the past two days.Please explain me the happenings in a simple way.

Kindly give me some suggestions where I need to add the update and what has to be included.

Awaiting for your responses.Thanks in advance.

  • Dear Lakshmi, you list HW, SDK and stack versions but they do nothing on their own, it's the APP FW which makes all the things (= through stack and SDK libs and HW of course;). So please tell us what is exactly running on your boards and then we might be able to help you... Also my feeling is that you will be disappointed: most of the things happening in deeply embedded systems like nRF5x are not really simple, they have certain level of complexity which cannot by magically taken away. So understanding some basic principles will be necessary to move forward (like have you read some good tutorial or training about all BLE stack layers and their function, have you read resources here and on Nordic Infocenter, have you done few basic examples from nRF5 SDK from the beginning till the end etc.)

  • Thank you so much for your response,Just started to going through the basic tutorials like making communication between android device as central and nordic peripheral.My requirement is,based on the request from the BLE central, I need to fetch some sensor data at regular intervals from the nordic peripheral and send back to the central device via nus and store it in database through uart serial communication.Really I am not having any idea,how to give the connection interval,at central side where I need to enter the UUID of the device which is advertising,to detect the device while scanning happens.Please tell me from where I need to start and share some sample code for ble central and peripheral communication.I can able to understand the concept,but it is very confusing while implementing it with the events.

  • Hi,

    As a starting point, I would recommend taking a look at the Nordic UART over BLE examples that implement the Nordic UART Service (NUS).

    For the Central use the following project:

    <SDK_InstallFolder>\examples\ble_central\ble_app_uart_c
    

    For the Peripheral use the following project:

    <SDK_InstallFolder>\examples\ble_peripheral\ble_app_uart
    
  • Thank you for your response,

    I referred the ble_app_uart_c for central.In that,NUS_BASE_UUID having 128-bit UUID value.Is that the peripheral UUID?But,in my task,the incoming uart data contains the UUID information about the peripheral device which I need to connect now.So while the uart event occurs,I am extracting the UUID information and then I connect to that particular peripheral.For that how can assign the NUS_BASE_UUID value.It can be changing according to the uart request data(multilink peripheral).And also I need to know how to create the custom UUIDs for each nordic devices or else each device has its own const UUID?

  • NUS_BASE_UUID is the base for the Nordic UART Service(NUS) UUID.

    The peripheral(ble_app_uart) is advertising this BLE service NUS UUID in its advertising packet. When the central(ble_app_uart_c) is scanning, you will get a BLE_GAP_EVT_ADV_REPORT event with the content of any advertising packet it finds. The central application then calls the function is_uuid_present(), where it looks for the NUS UUID. If the UUID is found, it will connect to the peripheral.

    You can use the same UUID on all your peripherals. The most common way to uniquely identify the peripherals is by using the unique Bluetooth address of the peripheral device. You could also give the peripherals different names(DEVICE_NAME), the default name for ble_app_uart example is Nordic_UART.

Related