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

How to get 248 byte device name into the nRF51822 chip?

Hello, We are doing a study about the features of nRF51822 and the nRF51 Development Kit and are wondering about the maximum visible "friendly name" (DEVICE_NAME?) which the chip can advertise.

Based on some earlier discussions found here and other forums we understood that there is some limitation of 31bytes -especially if iBeacon or Eddystone stds are followed. On the other hand we know that Bluetooth specs supports 248 byte name length.

We have been able to use that long names in (Android based) mobile phones/Bluetooths - set the name - advertise and read with other mobile phone - no problems. Now we would like to get the same functionality done with the Beacons.

Our question is:

  1. Is it possible to use max 248 long names in nRF51822 which the chip advertises automatically - are visible to other devices continuously and which can be detected by standard mobile phones without pairing or any other special action?
  1. Which sample code would be the best to make the most simple test - no temperature, acceleration etc needed?

  2. What changes would be needed to be done to the sample code?

  3. If sample codes do not allow this long names what would be the approach to get the full 248 name length?

Thank you for your response.

Best regards,

Risto

  • Risto,

    Just to clarify, are you referring to the name actually contained in advertising packet? It so, I believe you can only send full names that are ~29 bytes or the initial ~29 bytes of longer names. The specs for the GAP device name don't appear to have a length limit (other than the max characteristic size on BLE, which I think is 512 bytes), but it requires a connection to retrieve. Nordic's SDK appears to limit the string passed to sd_ble_gap_device_name_set() to 31 bytes. (infocenter.nordicsemi.com/index.jsp and the definition of BLE_GAP_DEVNAME_MAX_LEN).

    For those interested, here are some possible workarounds that may work in some use-cases: Advertising a custom UUID can be used to identify products from a particular vendor. Custom advertising messages might be used to transfer a longer un-official name. And if a connection is required to retrieve the name anyway, the Device Information Service data (possible with custom data) may be a better choice for model/device data.

  • Yes, I mean the name actually contained in advertising packet. As I understand the chips as such do not limit the device name to 31 but support the Bluetooth standard 248. Maybe there are different SDKs?

  • 248 is the maximum length for the Local Name when using traditional bluetooth (BR/EDR), not bluetooth low energy (BLE). The nRF51/52 series are bluetooth low energy.

    The Bluetooth Low Energy Specifications (BLUETOOTH SPECIFICATION Version 4.0 [Vol 6], Section 2.1 & Figure 2.1) show the packet format for Bluetooth Low Energy. A Link Layer packet only has 39 bytes for payload. (GAP & GATT messages will be a little less). More data can be sent by using more packets, but this doesn't allow one to advertise longer names.

  • Hi Risto, Bill is correct. There are two places you can put "Device Name" in BLE "stack" (assuming you are talking about GAP Peripheral device implementing GATT Server stack):

    • GAP AD element within Advertising or Scan Response Data (there are two options: "Short Local Name" tag 0x08 or "Complete Local Name" tag 0x09).
    • Value of Device Name characteristic (standard BLE 16-bit UUID = 0x2A00) under Generic Access Profile Primary Service (standard BLE 16-bit UUID = 0x1800).

    First place is limited by maximum length of Advertising or Scan Response packet (that's 31B by specification so when counting Tag and Length bytes of AD element encapsulation it's 29B for name itself). Second place is limited by GATT Value maximum defined as 512B but Nordic's GATT Server implementation inside Soft Device S110/S120/S130/S132 has limitation of 31B there anyway. Of course it's easy to define your own Primary Service and Characteristic where you can use full length of value field for your proprietary identification.

    CHeers Jan

  • Just a minor clarification on Jan's comment: Attributes and Characteristics, like Device Name, can be longer than 31 bytes. In recent SDKs this can be done via Nordic's Long Write mechanism. Search the forum for Long Write for details.

Related