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.

Devices cannot stablish a connection

Other Parts Discussed in Thread: CC2540

Hello,

I have made 2 custom PCBs for the CC2540 based on the design references of  the TI web site (one for the USB dongle and the other for the Keyfob). I have loaded the stacks for both chips, one with the HostTestRelease - CC2540USB master and the other with the SimpleBlePeripherical - CC2540 slave. My debugger detected both chips and programmed the stacks without a problem. It seemed to be working because I checked supply voltages, resent_n, crystal oscillation and all was OK.

I also wanted to check if my devices are getting discovered and connected between them. So, I opened Btool, My USB dongle was getting a virtual port and being recognized (see bellow).

Port opened at 18.11.2011 19:01:07

[1] : <Tx> - 07:01:07.511
-Type        : 0x01 (Command)
-Opcode        : 0xFE00 (GAP_DeviceInit)
-Data Length    : 0x26 (38) byte(s)
 ProfileRole    : 0x08 (Central)
 MaxScanRsps    : 0x05 (5)
 IRK        : 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00
 CSRK        : 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00
 SignCounter    : 0x00000001 (1)
Dump(Tx):
01 00 FE 26 08 05 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 01 00 00 00

------------------------------------------------------------------------------------------------------------------------
[2] : <Rx> - 07:01:07.621
-Type        : 0x04 (Event)
-EventCode    : 0xFF (HCI_LE_ExtEvent)
-Data Length    : 0x06 (6) bytes(s)
 Event        : 0x067F (GAP_HCI_ExtentionCommandStatus)
 Status        : 0x00 (Success)
 OpCode        : 0xFE00 (GAP_DeviceInit)
 DataLength    : 0x00 (0)
Dump(Rx):
04 FF 06 7F 06 00 00 FE 00

------------------------------------------------------------------------------------------------------------------------
[3] : <Tx> - 07:01:07.793
-Type        : 0x01 (Command)
-Opcode        : 0xFE31 (GAP_GetParam)
-Data Length    : 0x01 (1) byte(s)
 Raw        : 15
Dump(Tx):
01 31 FE 01 15

------------------------------------------------------------------------------------------------------------------------
[4] : <Tx> - 07:01:07.808
-Type        : 0x01 (Command)
-Opcode        : 0xFE31 (GAP_GetParam)
-Data Length    : 0x01 (1) byte(s)
 Raw        : 16
Dump(Tx):
01 31 FE 01 16

------------------------------------------------------------------------------------------------------------------------
[5] : <Tx> - 07:01:07.808
-Type        : 0x01 (Command)
-Opcode        : 0xFE31 (GAP_GetParam)
-Data Length    : 0x01 (1) byte(s)
 Raw        : 1A
Dump(Tx):
01 31 FE 01 1A

------------------------------------------------------------------------------------------------------------------------
[6] : <Tx> - 07:01:07.808
-Type        : 0x01 (Command)
-Opcode        : 0xFE31 (GAP_GetParam)
-Data Length    : 0x01 (1) byte(s)
 Raw        : 19
Dump(Tx):
01 31 FE 01 19

------------------------------------------------------------------------------------------------------------------------
[7] : <Rx> - 07:01:07.808
-Type        : 0x04 (Event)
-EventCode    : 0xFF (HCI_LE_ExtEvent)
-Data Length    : 0x2C (44) bytes(s)
 Event        : 0x0600 (GAP_DeviceInitDone)
 Status        : 0x00 (Success)
 DevAddr        : 3C:2D:B7:84:39:77
 DataPktLen    : 0x001B (27)
 NumDataPkts    : 0x04 (4)
 IRK        : 1A:DD:95:C9:4D:EC:B4:B6:E7:77:66:8B:DE:28:99:DA
 CSRK        : 4B:E7:D4:36:49:1F:54:35:91:3F:4D:EF:34:B6:2F:97
Dump(Rx):
04 FF 2C 00 06 00 77 39 84 B7 2D 3C 1B 00 04 1A
DD 95 C9 4D EC B4 B6 E7 77 66 8B DE 28 99 DA 4B
E7 D4 36 49 1F 54 35 91 3F 4D EF 34 B6 2F 97

------------------------------------------------------------------------------------------------------------------------
[8] : <Rx> - 07:01:07.918
-Type        : 0x04 (Event)
-EventCode    : 0xFF (HCI_LE_ExtEvent)
-Data Length    : 0x08 (8) bytes(s)
 Event        : 0x067F (GAP_HCI_ExtentionCommandStatus)
 Status        : 0x00 (Success)
 OpCode        : 0xFE31 (GAP_GetParam)
 DataLength    : 0x02 (2)
 ParamValue    : 0x0050 (80)
Dump(Rx):
04 FF 08 7F 06 00 31 FE 02 50 00

------------------------------------------------------------------------------------------------------------------------
[9] : <Rx> - 07:01:08.011
-Type        : 0x04 (Event)
-EventCode    : 0xFF (HCI_LE_ExtEvent)
-Data Length    : 0x08 (8) bytes(s)
 Event        : 0x067F (GAP_HCI_ExtentionCommandStatus)
 Status        : 0x00 (Success)
 OpCode        : 0xFE31 (GAP_GetParam)
 DataLength    : 0x02 (2)
 ParamValue    : 0x0050 (80)
Dump(Rx):
04 FF 08 7F 06 00 31 FE 02 50 00

------------------------------------------------------------------------------------------------------------------------
[10] : <Rx> - 07:01:08.105
-Type        : 0x04 (Event)
-EventCode    : 0xFF (HCI_LE_ExtEvent)
-Data Length    : 0x08 (8) bytes(s)
 Event        : 0x067F (GAP_HCI_ExtentionCommandStatus)
 Status        : 0x00 (Success)
 OpCode        : 0xFE31 (GAP_GetParam)
 DataLength    : 0x02 (2)
 ParamValue    : 0x0000 (0)
Dump(Rx):
04 FF 08 7F 06 00 31 FE 02 00 00

------------------------------------------------------------------------------------------------------------------------
[11] : <Rx> - 07:01:08.199
-Type        : 0x04 (Event)
-EventCode    : 0xFF (HCI_LE_ExtEvent)
-Data Length    : 0x08 (8) bytes(s)
 Event        : 0x067F (GAP_HCI_ExtentionCommandStatus)
 Status        : 0x00 (Success)
 OpCode        : 0xFE31 (GAP_GetParam)
 DataLength    : 0x02 (2)
 ParamValue    : 0x07D0 (2000)
Dump(Rx):
04 FF 08 7F 06 00 31 FE 02 D0 07

 

So, the next step was to scan for devices, and I got this:

------------------------------------------------------------------------------------------------------------------------
[12] : <Tx> - 07:03:19.100
-Type        : 0x01 (Command)
-Opcode        : 0xFE04 (GAP_DeviceDiscoveryRequest)
-Data Length    : 0x03 (3) byte(s)
 Mode        : 0x03 (All)
 NameMode    : 0x01 (Enable)
 WhiteList        : 0x00 (Disable)
Dump(Tx):
01 04 FE 03 03 01 00

------------------------------------------------------------------------------------------------------------------------
[13] : <Rx> - 07:03:19.194
-Type        : 0x04 (Event)
-EventCode    : 0xFF (HCI_LE_ExtEvent)
-Data Length    : 0x06 (6) bytes(s)
 Event        : 0x067F (GAP_HCI_ExtentionCommandStatus)
 Status        : 0x00 (Success)
 OpCode        : 0xFE04 (GAP_DeviceDiscoveryRequest)
 DataLength    : 0x00 (0)
Dump(Rx):
04 FF 06 7F 06 00 04 FE 00

------------------------------------------------------------------------------------------------------------------------
[14] : <Rx> - 07:03:21.491
-Type        : 0x04 (Event)
-EventCode    : 0xFF (HCI_LE_ExtEvent)
-Data Length    : 0x14 (20) bytes(s)
 Event        : 0x060D (GAP_DeviceInformation)
 Status        : 0x00 (Success)
 EventType    : 0x00 (Connectable Undirected Advertisement)
 AddrType    : 0x00 (Public)
 Addr        : 3C:2D:B7:85:DE:0A
 Rssi        : 0xD7 (215)
 DataLength    : 0x07 (7)
 Data        : 02:01:06:03:02:F0:FF
Dump(Rx):
04 FF 14 0D 06 00 00 00 0A DE 85 B7 2D 3C D7 07
02 01 06 03 02 F0 FF

------------------------------------------------------------------------------------------------------------------------
[15] : <Rx> - 07:03:29.443
-Type        : 0x04 (Event)
-EventCode    : 0xFF (HCI_LE_ExtEvent)
-Data Length    : 0x0C (12) bytes(s)
 Event        : 0x0601 (GAP_DeviceDiscoveryDone)
 Status        : 0x00 (Success)
 NumDevs    : 0x01 (1)
 Device #0
 EventType    : 0x00 (Connectable Undirected Advertisement)
 AddrType    : 0x00 (Public)
 Addr        : 3C:2D:B7:85:DE:0A
Dump(Rx):
04 FF 0C 01 06 00 01 00 00 0A DE 85 B7 2D 3C

------------------------------------------------------------------------------------------------------------------------

If you see, the highlighted line meant one device had been answered back. So, the connection could in fact be stablished, but it did not, instead this happened:


------------------------------------------------------------------------------------------------------------------------
[16] : <Tx> - 07:11:34.237
-Type        : 0x01 (Command)
-Opcode        : 0xFE09 (GAP_EstablishLinkRequest)
-Data Length    : 0x09 (9) byte(s)
 HighDutyCycle    : 0x00 (Disable)
 WhiteList        : 0x00 (Disable)
 AddrTypePeer    : 0x00 (Public)
 PeerAddr        : 0A:DE:85:B7:2D:3C
Dump(Tx):
01 09 FE 09 00 00 00 0A DE 85 B7 2D 3C

------------------------------------------------------------------------------------------------------------------------
[17] : <Rx> - 07:11:34.331
-Type        : 0x04 (Event)
-EventCode    : 0xFF (HCI_LE_ExtEvent)
-Data Length    : 0x06 (6) bytes(s)
 Event        : 0x067F (GAP_HCI_ExtentionCommandStatus)
 Status        : 0x00 (Success)
 OpCode        : 0xFE09 (GAP_EstablishLinkRequest)
 DataLength    : 0x00 (0)
Dump(Rx):
04 FF 06 7F 06 00 09 FE 00

------------------------------------------------------------------------------------------------------------------------
[18] : <Rx> - 07:11:36.237
-Type        : 0x04 (Event)
-EventCode    : 0xFF (HCI_LE_ExtEvent)
-Data Length    : 0x13 (19) bytes(s)
 Event        : 0x0605 (GAP_EstablishLink)
 Status        : 0x00 (Success)
 DevAddrType    : 0x00 (Public)
 DevAddr        : 3C:2D:B7:85:DE:0A
 ConnHandle    : 0x0000 (0)
 ConnInterval    : 0x0050 (80)
 ConnLatency    : 0x0000 (0)
 ConnTimeout    : 0x07D0 (2000)
 ClockAccuracy    : 0x00 (0)
Dump(Rx):
04 FF 13 05 06 00 00 0A DE 85 B7 2D 3C 00 00 50
00 00 00 D0 07 00

------------------------------------------------------------------------------------------------------------------------
[19] : <Rx> - 07:11:36.831
-Type        : 0x04 (Event)
-EventCode    : 0xFF (HCI_LE_ExtEvent)
-Data Length    : 0x06 (6) bytes(s)
 Event        : 0x0606 (GAP_TerminateLink)
 Status        : 0x00 (Success)
 ConnHandle    : 0x0000 (0)
 Reason        : 0x3E (Failed To Establish)

Dump(Rx):
04 FF 06 06 06 00 00 00 3E

------------------------------------------------------------------------------------------------------------------------

 

No connection has been stablished. If I try to connect both devices once more after the last procedure, my slave device is no longer being discover, but if I press the reset button it gets discovered again but no connection can be stablished though.

Could you give a hint, how could I proceed on this and fix it?

Thanks,

Joel 

  • A "Failed to Establish" (0x3E) error occurs if the master is unable to receive a packet from the slave within the first 6 connection events after sending a connection request. This could be caused a number of reasons. Here are a few possibilities:

    • The RF performance on one or both devices is not good, so the slave either never receives the connection request, or the master never receives any packets from the slave during the first 6 connection events
    • There could be a timing issue in either device. If the link layer clock on either device is not running at 32.768kHz (within the tolerance set using the HCI_Ext_SetSCACmd function; default is +/-50ppm) then the timing will be off and the slave might not be listening at the correct time to receive the master's packets.
    • If the slave device is advertising with the whitelist filter policy set to GAP_FILTER_POLICY_WHITE_CON or GAP_FILTER_POLICY_WHITE then the slave will ignore the connection from the master and continue advertising normally, and the master will get the 0x3E error since it does not receive any packets from the slave during the first 6 connection events.