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 HCI errors 0x3D and 0x3E

Other Parts Discussed in Thread: CC2541, CC2540

Hi all,

we have a project - receiver and keyfob based on CC2541 controller and BLE stack v. 1.3.1. Keyfob uses SimpleBleCentral application as a framework while receiver uses SimpleBlePeripheral application. Keyfob implements GAP Central profile and receiver implements GAP Peripheral profile.

Keyfob is used to send commands to the receiver (writes characteristic value) and receives status (characteristic notifications ) from the receiver. Keyfob and receiver are bonded; keyfob uses white list when scanning for advertising receiver.

We do a simple test that fails most of the times:

- Receiver is advertising and keyfob is successfully connected to it by pressing the button.

- We increase the distance between the keyfob and the receiver and we are still able to send commands to the receiver and also receive notifications from the receiver without any problems.

- After supervision time runs out, receiver is put back to advertising mode. We initiate the connection once again by pressing the key fob button. Most of the times we get disconnection event few seconds later on the keyfob side with error codes 0x3D (CONNECTION TERMINATED DUE TO MIC FAILURE) and sometimes 0x3E (CONNECTION FAILED TO BE ESTABLISHED). In rare cases, connection is successfully established.

- If we put the key fob closer to the receiver, there are no problems with connection initiation. Let me stress once again that operation is just OK at greater distances when key fob and receiver are already connected!

What are the reasons that cause those HCI errors? I've searched the forum but didn't find anything about 0x3D HCI error code. How could we avoid those errors when initiating the connection?


Best,

Primoz

  • Hey,

    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. The RF Performance could be bad due to a failed CRC, collision or maybe the devices are just out of range.
    • 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_CONor 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.

    Primoz Rebec said:
    - If we put the key fob closer to the receiver, there are no problems with connection initiation.

    This is because the devices can miss alot of packets (which are then re-transmitted) while maintaining the link as long as the supervision time-out isn't triggered. it's a robustness factor that applies to connections but not the connection establishment.

    What distances are we talking about here?

    Best Regards

    Joakim

  • Hi Joakim,

    thank you for useful information. I'll check for clocks and tolerances on both devices.

    I don't believe that advertising policy is the problem because our slave device policy is set to GAP_FILTER_POLICY_ALL.

    Regarding the distances. We have approx. 8 meters range in open-air, but the key fob is put into a plastic housing with metallic cover. This is the range when devices are connected but connection establishment is problematic.

    Best,

    Primoz

  • Hi Joakim,

    what do you think about the 8-meter range i mentioned in previous post? Should we get better range with CC2541? Prototype antenna design followed reference designs. Later, we did some improvements and its performance improved if we keep the key fob in the plastic housing with metallic cover...

    Best

    Primoz

  • Hi Primoz,

    8m range is something you should get easily, at least with our reference designed. Metal housing will affect the performance but it depends very much on the design. The range is dependent of;

    • Sensitivity of the Radio Receiver
    • Output Power of the Radio Transmitter
    • Environment and coexistence
    • Antenna Performance

    I have personally measured up to 260m with CC2540 EM on a SmartRF05 using a dipole antenna with configured output power of 4dBm. This was in clear sight though. With a small chip antenna (0304), typical range is around 10m. Have a look at the indoor range estimator tool here: http://e2e.ti.com/support/wireless_connectivity/f/538/t/375823.aspx