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.

CC2541 not connecting

Other Parts Discussed in Thread: CC2541, CC2540

I have two separate boards with different sensors, both driven by CC2541 devices.   The layouts in the Bluetooth area are almost identical.  Both are peripheral devices.

One board establishes a connection to Btool while the other won't.  

I have attached two log files from Btool.   

Board1_Log_Success.txt shows the Btool log of Board1 establishing a connection to Btool.

Board2_Log_Failure.txt shows the Btool log of Board2 failing to establish a connection to Btool.

Both logs are identical up through frame [3] (except for the board addresses and RSSI).   It appears that Board2 responds with its address in frame [3], but Btool does not see Board2's GAP_DeviceInformation in frame [4] as the log of Board1 shows.    

It looks like Board2's RSSI is slightly less (202 vs 206) than Board1's RSSI...

I'm assuming that the <Tx> and <Rx> notations on the Btool logs are with respect to the Btool device (ie. <Tx> shows packets that Btool has sent and <Rx> shows packets that Btool has received from the peripheral).     

I'm looking for advice on how to proceed with debugging...     Why would Board 2 give frame [3] but not frame [4]?

The software (except for the sensor interfaces) in the two boards is identical...    The software is based on the TI peripheral device example.

Thanks!

[1] : <Tx> - 12:53:23.874
-Type		: 0x01 (Command)
-Opcode		: 0xFE04 (GAP_DeviceDiscoveryRequest)
-Data Length	: 0x03 (3) byte(s)
 Mode		: 0x03 (All)
 ActiveScan	: 0x01 (Enable)
 WhiteList		: 0x00 (Disable)
Dump(Tx):
01 04 FE 03 03 01 00 
------------------------------------------------------------------------------------------------------------------------
[2] : <Rx> - 12:53:23.887
-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 
------------------------------------------------------------------------------------------------------------------------
[3] : <Rx> - 12:53:23.987
-Type		: 0x04 (Event)
-EventCode	: 0xFF (HCI_LE_ExtEvent)
-Data Length	: 0x14 (20) bytes(s)
 Event		: 0x060D (GAP_DeviceInformation)
 Status		: 0x00 (Success)
 EventType	: 0x00 (Connectable Undirect Advertisement)
 AddrType	: 0x00 (Public)
 Addr		: 6C:EC:EB:57:42:B8
 Rssi		: 0xCE (206)
 DataLength	: 0x07 (7)
 Data		: 02:01:06:03:02:F0:FF
Dump(Rx):
04 FF 14 0D 06 00 00 00 B8 42 57 EB EC 6C CE 07 
02 01 06 03 02 F0 FF 
------------------------------------------------------------------------------------------------------------------------
[4] : <Rx> - 12:53:24.007
-Type		: 0x04 (Event)
-EventCode	: 0xFF (HCI_LE_ExtEvent)
-Data Length	: 0x2B (43) bytes(s)
 Event		: 0x060D (GAP_DeviceInformation)
 Status		: 0x00 (Success)
 EventType	: 0x04 (Scan Response)
 AddrType	: 0x00 (Public)
 Addr		: 6C:EC:EB:57:42:B8
 Rssi		: 0xCD (205)
 DataLength	: 0x1E (30)
 Data		: 14:09:54:72:69:63:6F:72:64:65:72:54:6F:72:73:6F:
		  50:61:74:63:68:05:12:06:00:0C:00:02:0A:00
Dump(Rx):
04 FF 2B 0D 06 00 04 00 B8 42 57 EB EC 6C CD 1E 
14 09 54 72 69 63 6F 72 64 65 72 54 6F 72 73 6F 
50 61 74 63 68 05 12 06 00 0C 00 02 0A 00 
------------------------------------------------------------------------------------------------------------------------
[5] : <Rx> - 12:53:34.138
-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 Undirect Advertisement)
 AddrType	: 0x00 (Public)
 Addr		: 6C:EC:EB:57:42:B8
Dump(Rx):
04 FF 0C 01 06 00 01 00 00 B8 42 57 EB EC 6C 
------------------------------------------------------------------------------------------------------------------------
[6] : <Tx> - 12:53:37.948
-Type		: 0x01 (Command)
-Opcode		: 0xFE09 (GAP_EstablishLinkRequest)
-Data Length	: 0x09 (9) byte(s)
 HighDutyCycle	: 0x00 (Disable)
 WhiteList		: 0x00 (Disable)
 AddrTypePeer	: 0x00 (Public)
 PeerAddr		: B8:42:57:EB:EC:6C
Dump(Tx):
01 09 FE 09 00 00 00 B8 42 57 EB EC 6C 
------------------------------------------------------------------------------------------------------------------------
[7] : <Rx> - 12:53:37.970
-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 
------------------------------------------------------------------------------------------------------------------------
[8] : <Info> - 12:53:38.165
Device Connected
Handle = 0x0000
Addr Type = 0x00 (Public)
BDAddr = 6C:EC:EB:57:42:B8
------------------------------------------------------------------------------------------------------------------------
[9] : <Rx> - 12:53:38.160
-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		: 6C:EC:EB:57:42:B8
 ConnHandle	: 0x0000 (0)
 ConnInterval	: 0x0050 (80)
 ConnLatency	: 0x0000 (0)
 ConnTimeout	: 0x07D0 (2000)
 ClockAccuracy	: 0x00 (0)
Dump(Rx):
04 FF 13 05 06 00 00 B8 42 57 EB EC 6C 00 00 50 
00 00 00 D0 07 00 
------------------------------------------------------------------------------------------------------------------------
[10] : <Rx> - 12:53:44.954
-Type		: 0x04 (Event)
-EventCode	: 0xFF (HCI_LE_ExtEvent)
-Data Length	: 0x0B (11) bytes(s)
 Event		: 0x0607 (GAP_LinkParamUpdate)
 Status		: 0x00 (Success)
 ConnHandle	: 0x0000 (0)
 ConnInterval	: 0x000C (12)
 ConnLatency	: 0x0000 (0)
 ConnTimeout	: 0x03E8 (1000)
Dump(Rx):
04 FF 0B 07 06 00 00 00 0C 00 00 00 E8 03 
------------------------------------------------------------------------------------------------------------------------
[1] : <Tx> - 12:55:42.036
-Type		: 0x01 (Command)
-Opcode		: 0xFE04 (GAP_DeviceDiscoveryRequest)
-Data Length	: 0x03 (3) byte(s)
 Mode		: 0x03 (All)
 ActiveScan	: 0x01 (Enable)
 WhiteList		: 0x00 (Disable)
Dump(Tx):
01 04 FE 03 03 01 00 
------------------------------------------------------------------------------------------------------------------------
[2] : <Rx> - 12:55:42.045
-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 
------------------------------------------------------------------------------------------------------------------------
[3] : <Rx> - 12:55:42.415
-Type		: 0x04 (Event)
-EventCode	: 0xFF (HCI_LE_ExtEvent)
-Data Length	: 0x14 (20) bytes(s)
 Event		: 0x060D (GAP_DeviceInformation)
 Status		: 0x00 (Success)
 EventType	: 0x00 (Connectable Undirect Advertisement)
 AddrType	: 0x00 (Public)
 Addr		: 6C:EC:EB:57:42:8F
 Rssi		: 0xCA (202)
 DataLength	: 0x07 (7)
 Data		: 02:01:06:03:02:F1:FF
Dump(Rx):
04 FF 14 0D 06 00 00 00 8F 42 57 EB EC 6C CA 07 
02 01 06 03 02 F1 FF 
------------------------------------------------------------------------------------------------------------------------
[4] : <Rx> - 12:55:52.297
-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 Undirect Advertisement)
 AddrType	: 0x00 (Public)
 Addr		: 6C:EC:EB:57:42:8F
Dump(Rx):
04 FF 0C 01 06 00 01 00 00 8F 42 57 EB EC 6C 
------------------------------------------------------------------------------------------------------------------------
[5] : <Tx> - 12:55:54.261
-Type		: 0x01 (Command)
-Opcode		: 0xFE09 (GAP_EstablishLinkRequest)
-Data Length	: 0x09 (9) byte(s)
 HighDutyCycle	: 0x00 (Disable)
 WhiteList		: 0x00 (Disable)
 AddrTypePeer	: 0x00 (Public)
 PeerAddr		: 8F:42:57:EB:EC:6C
Dump(Tx):
01 09 FE 09 00 00 00 8F 42 57 EB EC 6C 
------------------------------------------------------------------------------------------------------------------------
[6] : <Rx> - 12:55:54.277
-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 
------------------------------------------------------------------------------------------------------------------------
[7] : <Info> - 12:56:01.333
Device Connected
Handle = 0x0000
Addr Type = 0x00 (Public)
BDAddr = 6C:EC:EB:57:42:8F
------------------------------------------------------------------------------------------------------------------------
[8] : <Rx> - 12:56:01.328
-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		: 6C:EC:EB:57:42:8F
 ConnHandle	: 0x0000 (0)
 ConnInterval	: 0x0050 (80)
 ConnLatency	: 0x0000 (0)
 ConnTimeout	: 0x07D0 (2000)
 ClockAccuracy	: 0x00 (0)
Dump(Rx):
04 FF 13 05 06 00 00 8F 42 57 EB EC 6C 00 00 50 
00 00 00 D0 07 00 
------------------------------------------------------------------------------------------------------------------------
[9] : <Info> - 12:56:01.898
Device Disconnected
Handle = 0x0000
Addr Type = 0x00 (Public)
BDAddr = 6C:EC:EB:57:42:8F
------------------------------------------------------------------------------------------------------------------------
[10] : <Rx> - 12:56:01.898
-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 
------------------------------------------------------------------------------------------------------------------------

  • Hi Ed,

    Unfortunately, the BTool logs don't provide much insight. Failure to connect can be caused by many reasons. One of the more common reasons we see is due to RF / RX issues. Have you performed RF characterization of your board and verified the crystals are in spec? Note that you need to configure the Sleep Clock Accuracy if you are using a 32k crystal that has an error higher than 40ppm. One quick way to check this is to disable power management and see if the connection is established reliability.

    Beyond that, providing a sniffer trace may help.

    Can you also advise the BLE Stack version? Also, can you run your SW on a CC2541EM and confirm if a connection can be established?

    Best wishes
  • Thanks for your reply...

    The 32KHz crystal that I'm using has a tolerance of 20ppm (DigiKey Part SER2407CT-ND).

    I turned power management off and it now connects for about 1 second before dropping. What is the significance of this?

    I'm using BLE Stack version 1.4.0

    I used this software on an earlier prototype with no problem... It also connects on Board1 with no problem.

    Thanks...
  • Sorry, I spoke too soon. Turning power management off did not improve the situation...
  • Can you attach a working & non-working sniffer trace, i.e. Board1 & Board2?
    Have you checked the HW for a board issue?

    Best wishes
  • Board1_SnifferLog.psdBoard2_SnifferLog.psd

    OK, thanks!    I configured the CC2540 dongle I was using for Btool to run with the Packet Sniffer and have attached the logs.    I see a lot of FCS errors on Board 2.      What does this signify?  

  • Board1_SnifferLog_Pass.psdBoard2_SnifferLog_Fail.psd

    Here are a couple of additional PacketSniffer traces.   Board 1 is working; Board 2 isn't.   Both have nearly identical layouts and use the same software w.r.t. Bluetooth.

    Obviously the Board 2 trace shows lots of errors.    The question is: What causes these types of errors?   Is there possibly a slight timing issue?  Is there some sort of tuning (osc/clock?) that must be done?    I'm using one of the TI recommended 32 MHz crystals.

    The processor seems to be working otherwise (ie. executes OSAL loop, periodic timing events being seen/serviced, etc.)

    Thanks!

  • The 32 MHz crystals are the same on all boards and have a 10 ppm tolerance. The load capacitors are also the same on all boards as the layouts are very similar. But I'm beginning to suspect that my problem is different loading on the crystal on the two boards (even though they have very similar layouts). Is there is way to use SmartRFStudio and/or the HCI_EXT_SetFreqTune_Cmd to adjust the crystal while watching the output? It appears that the "Register" tab isn't available on SmartRFStudio while in BLE mode!
  • I'm finding that the CC2541 is extremely sensitive to the load capacitance on the 32 MHz crystal.   I have three different boards, all using the part.   Two have almost identical layouts w.r.t. the XTAL and load caps.   I'm using one of the TI suggested 32 MHz crystals.   One board requires 12 pF capacitors.   The second requires 15 pF capacitors.   The third board has a slightly different layout and hasn't worked with 12 pF, 15 pF, or 18 pF capacitors.    

    The crystal app note (AN100 - swra372c) states that the crystal load capacitance CL = (C1 * C2) / (C1 + C2)

    If we assume C1 and C2 are equal and the crystal spec says that CL = 10 pF, then C1 = C2 = 20 pF.

    If we assume 2 pF of stray (board, pins, etc.) capacitance, then C1 is actually 18 pF;  if we assume 5 pF of stray capacitance, then C1 is actually 15 pF, etc.

    Barring putting all possible values of capacitance from 20 pF downto (a little VHDL here :-) 10 pF, is there a better way to figure out what value should actually be used?

    I see the register FREQTUNE can be used to pull the crystal internally.  The value 0x0f represents no internal capacitance (no added capacitance).    The document (swru191f) states:  

    Changing the setting from default switches in extra capacitance to the oscillator,
    effectively lowering the XOSC frequency. Hence, a higher setting gives
    a higher frequency.

    So if a higher setting gives a higher frequency, then a higher setting gives less capacitance?    What values of capacitance are represented by the values 0x00 through 0x0e?  

    Can this register be written before the crystal is "started"?   ie:

      FREQTUNE= 0x05;

      START_HSOSC_XOSC();

      SET_OSC_TO_HSOSC();

      SET_32KHZ_OSC();

      SET_OSC_TO_XOSC();

      STOP_HSOSC();

    as shown in the examples?