This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

BLE flags ad structure causing issue

Other Parts Discussed in Thread: CC2650, CC2540

i want to have a custom advertisement packet, i am using CC2650 simple BLE  peripheral example.

The problem is that when i remove flag ad structure and introduce my on ad structure (short name type 0x08) in the packet and compile and run the code, the peripheral device don't connect to android mobile app based central. Altough the peripheral is connectable and its connecting to usb dongle using btool.

Actually i want to create a connectable beacon with custom advertisement packet i dont want to have flag ad structure in the advertisement packet

  • Hi Mohammad,

    There is probably something wrong with the advertisement data, in that case. You do need to have the flags if you are connectable. You also need the correct length (including 1 byte for GAP_ADTYPE_LOCAL_NAME_SHORT).

    BR,
    Aslak

  • this is the packet

    static uint8 advertData[] =
    {

    0x03, // length of this data
    0x08, //type
    0xd7,
    0x42,

    0x1A, // length of this data (26 Bytes )
    0xFF, //type
    /*Apple Pre-Amble*/
    0x4c,
    0x00,
    0x02,
    0x15,
    /*Device UUID (16 Bytes)*/
    0x4F, 0x03, 0x58, 0xE0, 0x2E, 0xE7, 0x11, 0xE4, 0x8C, 0x21, 0x08, 0x00, 0x20, 0x0C, 0x9A, 0x66,
    /*Major Value (2 Bytes)*/
    0x00, 0x01,

    /*Minor Value (2 Bytes)*/
    0x00,0x02,

    /*Measured Power*/
    0xC6,
    };
  • Hello,

    If you want to customize the AD data to remove the flags, then you'll need a custom Central. It appears you are using a mobile phone, so that may be the issue.

    I suggest you look at the Eddystone example which is on the BLE wiki.

    Best wishes
  • i already have a custom central and yes its an android app,the point is that that same app is connecting to another peripheral device with the same above packet that peripheral is Nordic nrf based ble chip. the same packet that nrf chip advertise and it gets connected but when my cc2650 based peripheral advertise the same packet it is no more connectable with the same app

  • Have you tried to sniff the data going over the air and compared the packet contents? That might give you some clues on what is going on.

    .:svend
  • i used Btool to see the packets and they were all the same !! but as i have tolt that it gets connected to btool but cant connect to mobile app so how to sniff the communication between mobile central and cc2650 peripheral using btool and usb dongle !!
  • Do you have a CC2540 USB dongle + CC debugger when you use BTool? 

    If so then you can use the SmartRF Protocol Packet Sniffer after flashing the USB dongle with the sniffer_fw_cc2540.hex firmware that is included with the packet sniffer SW: 

    Regards,

    Svend

  • yeah i have it and ill try that too but here still is this a peripheral firmware problem or central app problem !! i guess its peripheral problem what do u say?
  • You  have removed the Flags Advertising data in the array above. These must be here according to the BT Core Spec v 4.0 (Vol 3C, chapter 11.1.3):

    "The Flags AD type shall be included in the advertising data if any of the bits are non-zero." To be able to have a connectable device I think these data need to be there.

    Can you try adding the following to the start of your array to see if it helps?

    static uint8_t advertData[] =
    {
      // Flags; this sets the device to use limited discoverable
      // mode (advertises for 30 seconds at a time) instead of general
      // discoverable mode (advertises indefinitely)
      0x02,   // length of this data
      GAP_ADTYPE_FLAGS,
      DEFAULT_DISCOVERABLE_MODE | GAP_ADTYPE_FLAGS_BREDR_NOT_SUPPORTED,
    ...

  • as i told i dont want to include flags instead i wana use short name ad structure . its working fine not to include flags on Nordic nrf chip but why not its working for cc2650 ble peripheral is there any definition in the ble stack so that i can alter it and get rid of flag at structure
  • It might be that the nordic device adds this for you automatically. The only way to find out is to sniff the data going over the air.

    Regards,
    Svend
  • ok ill sniff and then will update here