Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Setting up Bluetooth exchanges message "0x0100" - why?

I am a beginner to Nordic devices and to Bluetooth technology in general.

I have set up a Bluetooth connection using the nRF51 Development Kit and an nRF51-Dongle.
The dongle works as the master, the DK as the slave.
I access the dongle using the software nRF Connect running on a Windows 64bit OS.

The DK runs with:
- softdevice version s130
- an application firmware based on the example project "[software development kit]\examples\ble_peripheral\ble_app_uart" as documented here: infocenter.nordicsemi.com/index.jsp
The example project transmits data sent from Bluetooth to the UART interface and vice versa. This is not my use case, but the connection setup is still the same.

Setting up the connection works fine. The problem is that I do not understand what happens on a more technical level.
What I see is:
- The master starts the connection.
- The master reads (or sets) the connection parameters.
- The master makes the slave open the UART TX queue
-> manually, so I know this is caused by the master side
-> but I do not see any data sent from master to slave.
- The slave sends a 2-byte-message 0x100 and
- the master answers with a 2-byte-message 0x100
-> both of these messages come with a handle 0x0C
-> that is never used again. Later, the slave sends messages with 0x0B, and the master uses 0x0E.

I do not see this reflected in the code.
I looked into the init functions. gap_params_init() calls sd_ble_gap_ppcp_set() and sd_ble_gap_device_name_set() (which set the parameters and the name), and services_init() calls ble_nus_init() (that sets the UUID and the RX and TX parameters).
Neither handles an event like "now a connection is set, sent 0x0100". Neither uses any handle with the value 0x0C.
I also tried to search the documentation on the project, but I do not really know what string to search for.

Now, my questions are:
- Why is there an exchange of "0x0100"? Is this a general Bluetooth convention or is this a decision made in this project?
- Is this something I can change in the code? Is it part of the application firmware or the softdevice?
- Which part of the code handles all these things (exchanged messages, connection handles etc.)? Where/how do I find it?
- Is there any documentation that provides more basic information on the connection process?

Parents
  • : The ble_app_uart examples uses two characteristics TX and RX to exchange information, data from the central to the peripheral is written to the peripherals RX characteristic. Data from the peripheral is notified from the TX characteristic to the central 

    The handle 0x0E corresponds to the UART RX characteristic, the handle 0x0B corresponds to the UART TX characteristic and  0x0C corresponds to the CCCD of the TX characteristic

    Q1: The handle 0x0C corresponds to the CCCD of the UART TX characteristic, i.e. notification is being enabled. 

    Q2: Yes, from the central side you could not enable notifications, but then the peripheral would not be able to send the data to the central. THe central would then have to "poll" the peripherals TX  characteristic by reading it regurarly to see if there is any new data.  

    Q3: All BLE events passed on from the SoftDevice will go through on_ble_evt(ble_evt_t * p_ble_evt) in main.c 

    Q4: Take a look at the Message Sequence Charts for the S130 v2.0.1 SoftDevice, here is the link to the Infocenter page.

Reply
  • : The ble_app_uart examples uses two characteristics TX and RX to exchange information, data from the central to the peripheral is written to the peripherals RX characteristic. Data from the peripheral is notified from the TX characteristic to the central 

    The handle 0x0E corresponds to the UART RX characteristic, the handle 0x0B corresponds to the UART TX characteristic and  0x0C corresponds to the CCCD of the TX characteristic

    Q1: The handle 0x0C corresponds to the CCCD of the UART TX characteristic, i.e. notification is being enabled. 

    Q2: Yes, from the central side you could not enable notifications, but then the peripheral would not be able to send the data to the central. THe central would then have to "poll" the peripherals TX  characteristic by reading it regurarly to see if there is any new data.  

    Q3: All BLE events passed on from the SoftDevice will go through on_ble_evt(ble_evt_t * p_ble_evt) in main.c 

    Q4: Take a look at the Message Sequence Charts for the S130 v2.0.1 SoftDevice, here is the link to the Infocenter page.

Children
No Data
Related