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.

Simple BLE Peripheral (BLE Stack 2.1) CC2650 4x4s - Central Connection Refused

Other Parts Discussed in Thread: CC2540, CC2640, TIDA-00374, CC2650

I'm attempting to simply connect to the Simple BLE peripheral from the Gatttool provided by Bluez with no success. The device is in fact transmitting connectable packets, but won't accept the connection from the central. It's not a compile issue, and I have changed the project to compile with the proper board file for the 4x4 instead of the 7x7. I've also attempted to connect to the peripheral with a node.js script with no success.

So far, I've attempted to modify the project by turning the GAP bonding & Mitm protection for the GAP bond manager off as well as mess with the advertisement intervals with no success. As a precaution, i've also removed the LCD write statements since my 4x4 has no LCD's. I'm currently using the SmartRF06 board with the XDS bypass in place to flash directly to the EM. (It's our build, but based on the reference design.)

I'm also using the IAR compiler, with IAR workbench.  (Not sure if this helps)

The gatttool command I'm using is:

sudo gatttool -b MACADDRESS -I

then the connect command once in interactive mode.

I guess any pointers on how I could debug the connection request --- if it's coming across --- or some build option that maybe I'm not thinking of because it's the 4x4 and not the 7x7 which the demo was based upon.

HCI Dump from central:

debian@beaglebone:~$ sudo hcidump -t -x
HCI sniffer - Bluetooth packet analyzer ver 5.35
device: hci0 snap_len: 1500 filter: 0xffffffff
2015-11-03 15:45:43.943201 > HCI Event: LE Meta Event (0x3e) plen 19
    LE Advertising Report
      ADV_IND - Connectable undirected advertising (0)
      bdaddr B0:B4:48:E4:17:80 (Public)
      Flags: 0x06
      Shortened service classes: 0xfff0
      RSSI: -68
2015-11-03 15:45:43.946206 > HCI Event: LE Meta Event (0x3e) plen 42
    LE Advertising Report
      SCAN_RSP - Scan Response (4)
      bdaddr B0:B4:48:E4:17:80 (Public)
      Complete local name: 'SimpleBLEPeripheral'
      Unknown type 0x12 with 4 bytes data
      TX power level: 0
      RSSI: -67
2015-11-03 15:45:44.049196 > HCI Event: LE Meta Event (0x3e) plen 19
    LE Advertising Report
      ADV_IND - Connectable undirected advertising (0)
      bdaddr B0:B4:48:E4:17:80 (Public)
      Flags: 0x06
      Shortened service classes: 0xfff0
      RSSI: -65
2015-11-03 15:45:44.052212 > HCI Event: LE Meta Event (0x3e) plen 42
    LE Advertising Report
      SCAN_RSP - Scan Response (4)
      bdaddr B0:B4:48:E4:17:80 (Public)
      Complete local name: 'SimpleBLEPeripheral'
      Unknown type 0x12 with 4 bytes data
      TX power level: 0
      RSSI: -59
2015-11-03 15:45:44.159193 > HCI Event: LE Meta Event (0x3e) plen 19
    LE Advertising Report
      ADV_IND - Connectable undirected advertising (0)
      bdaddr B0:B4:48:E4:17:80 (Public)
      Flags: 0x06
      Shortened service classes: 0xfff0
      RSSI: -72
2015-11-03 15:45:44.162242 > HCI Event: LE Meta Event (0x3e) plen 42
    LE Advertising Report
      SCAN_RSP - Scan Response (4)
      bdaddr B0:B4:48:E4:17:80 (Public)
      Complete local name: 'SimpleBLEPeripheral'
      Unknown type 0x12 with 4 bytes data
      TX power level: 0
      RSSI: -72
2015-11-03 15:45:44.267201 > HCI Event: LE Meta Event (0x3e) plen 19
    LE Advertising Report
      ADV_IND - Connectable undirected advertising (0)
      bdaddr B0:B4:48:E4:17:80 (Public)
      Flags: 0x06
      Shortened service classes: 0xfff0
      RSSI: -68
2015-11-03 15:45:44.374192 > HCI Event: LE Meta Event (0x3e) plen 19
    LE Advertising Report
      ADV_IND - Connectable undirected advertising (0)
      bdaddr B0:B4:48:E4:17:80 (Public)
      Flags: 0x06
      Shortened service classes: 0xfff0
      RSSI: -72
2015-11-03 15:45:44.472218 > HCI Event: LE Meta Event (0x3e) plen 19
    LE Advertising Report
      ADV_IND - Connectable undirected advertising (0)
      bdaddr B0:B4:48:E4:17:80 (Public)
      Flags: 0x06
      Shortened service classes: 0xfff0
      RSSI: -65
2015-11-03 15:45:44.475213 > HCI Event: LE Meta Event (0x3e) plen 42
    LE Advertising Report
      SCAN_RSP - Scan Response (4)
      bdaddr B0:B4:48:E4:17:80 (Public)
      Complete local name: 'SimpleBLEPeripheral'
      Unknown type 0x12 with 4 bytes data
      TX power level: 0
      RSSI: -59

Connection attempt from same central:

debian@beaglebone:~$ sudo gatttool -b B0:B4:48:E4:17:80 -I
[   ][B0:B4:48:E4:17:80][LE]> connect
Connecting... connect error: Connection refused (111)
[   ][B0:B4:48:E4:17:80][LE]>

  • Hello Edward,

    Since you are using a custom board, are you using the same board file as the CC2650EM_4XS? This 4x4 EM uses the Single Ended / External Bias antenna & RF FE layout. If yours is different, then you will have RX issues.

    Beyond that, having a BLE air sniffer trace will be a good first step to diagnosing the problem.

    Best wishes
  • I can verify that it's the correct board file. We are using the same board on a different project, which is based off the example seen here www.ti.com/.../tidc949. This one broadcasts successfully, as well as the simple ble peripheral.

    Would it be possible that the hardware can send but not receive? I took RF in college, but must admit I'm a little more than rusty :)

    I can see about getting an air sniffer, but is there any way to debug incoming communications on the BLE stack? Maybe set a breakpoint whenever there is some incoming event. I have been searching through the code with no success.

    Edward
  • Hi Edward,

    TI does provide a free packet sniffer that you can use if you have a CC254x dongle by any chance. As JXS suggests, this is the best way to debug. In addition, you can trace GAP messages through the peripheral role implementation in peripheral.c. Could you attempt to use BTool and one of our reference platforms as your central device to rule out any configuration issues on the central end as well?
  • Hi Sean,

    I've acquired a cc2540 and plan to hook up the sniffer today to see if I can get a good capture of what's happening. Hopefully this will provide some insight into what's happening and rule out some possible problems. 

    Bryce

  • I'm running into the same problems using the BTool. It seems that it goes to connect and fails to establish

    BTool Logs:

    [33] : <Tx> - 09:26:47.202
    -Type           : 0x01 (Command)
    -OpCode         : 0xFE09 (GAP_EstablishLinkRequest)
    -Data Length    : 0x09 (9) byte(s)
     HighDutyCycle  : 0x00 (0) (Disable)
     WhiteList      : 0x00 (0) (Disable)
     AddrTypePeer   : 0x00 (0) (Public)
     PeerAddr       : B0:B4:48:E4:1D:06
    Dump(Tx):
    0000:01 09 FE 09 00 00 00 06 1D E4 48 B4 B0          ..........H..
    --------------------------------------------------------------------
    [34] : <Rx> - 09:26:47.244
    -Type           : 0x04 (Event)
    -EventCode      : 0x00FF (Event)
    -Data Length    : 0x06 (6) bytes(s)
     Event          : 0x067F (1663) (GAP_HCI_ExtentionCommandStatus)
     Status         : 0x00 (0) (Success)
     OpCode         : 0xFE09 (GAP_EstablishLinkRequest)
     DataLength     : 0x00 (0)
    Dump(Rx):
    0000:04 FF 06 7F 06 00 09 FE 00                      .........
    --------------------------------------------------------------------
    [35] : <Info> - 09:26:47.379
    Device Connected
    Handle = 0x0000
    Addr Type = 0x00 (Public)
    BDAddr = B0:B4:48:E4:1D:06
    --------------------------------------------------------------------
    [36] : <Rx> - 09:26:47.378
    -Type           : 0x04 (Event)
    -EventCode      : 0x00FF (Event)
    -Data Length    : 0x14 (20) bytes(s)
     Event          : 0x0605 (1541) (GAP_EstablishLink)
     Status         : 0x00 (0) (Success)
     DevAddrType    : 0x00 (0) (Public)
     DevAddr        : B0:B4:48:E4:1D:06
     ConnHandle     : 0x0000 (0)
     ConnRole       : 0x08 (8) (Central)
     ConnInterval   : 0x0050 (80)
     ConnLatency    : 0x0000 (0)
     ConnTimeout    : 0x07D0 (2000)
     ClockAccuracy  : 0x00 (0)
    Dump(Rx):
    0000:04 FF 14 05 06 00 00 06 1D E4 48 B4 B0 00 00 08 ..........H.....
    0010:50 00 00 00 D0 07 00                            P......
    --------------------------------------------------------------------
    [37] : <Info> - 09:26:47.972
    Device Disconnected
    Handle = 0x0000
    Addr Type = 0x00 (Public)
    BDAddr = B0:B4:48:E4:1D:06
    --------------------------------------------------------------------
    [38] : <Rx> - 09:26:47.972
    -Type           : 0x04 (Event)
    -EventCode      : 0x00FF (Event)
    -Data Length    : 0x06 (6) bytes(s)
     Event          : 0x0606 (1542) (GAP_TerminateLink)
     Status         : 0x00 (0) (Success)
     ConnHandle     : 0x0000 (0)
     Reason         : 0x3E (62) (Failed To Establish)
    Dump(Rx):
    0000:04 FF 06 06 06 00 00 00 3E                      ........>
    --------------------------------------------------------------------
    

    The antenna is based on the reference design for the 4xs. Should I try configuring the antenna differently than what the the default board.h does for the 4xs?

    Any help is much appreciated.

  • Hi Edward,

    Can you post your CC2640 schematic & layout? We are mainly interested in the power, clock & antenna layout. You can redact external MCUs and sensors, etc.

    Best wishes
  • Hi Edward,

    The "CC2650 Temp_Humidity TIDA-00374.pdf" is not the same as the CC2650EM_4XS layout. Can you provide the exact RF_FE_MODE_AND_BIAS setting you are using in your project?

    Best wishes
  • Since the CC2650EM_4XS macro is defined, the RF_FE_MODE_AND_BIAS is:

      #define RF_FE_MODE_AND_BIAS           ( RF_FE_SINGLE_ENDED_RFP |             \
                                              RF_FE_EXT_BIAS )

  • JXS,

    It seems that our hardware was using a Differential internal bias operation, instead of the one that is generically defined by simple ble peripheral CC2560EM_4XS.

    Once I changed the RF_FE_MODE_AND_BIAS to

        #define RF_FE_MODE_AND_BIAS           ( RF_FE_DIFFERENTIAL |                 \
                                              RF_FE_INT_BIAS )

    Everything seems to be working.

    I appreciate your help! This has been quite the primer to BLE programming :)

  • Hi Edward,

    I was just going to suggest the same. Glad you have it working!

    Best wishes