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-Stack library behavior

Other Parts Discussed in Thread: BLE-STACK

Hi all,

I need to get advice about behavior of BLE-stack library. 

I'm using ble-stack in network processor project with master mode configuration. BLE-stack is driven externaly. 

I discovered problem after establish connection with bad MAC address to slave device. When I send GAP_EstablishLinkReq command to device with bad MAC address, then is this task in progress forever until I stop this request by sending GAP_TerminateLinkReq to the loopback connection handle. The following GAP_EstablishLink event contains status 0x31( The connection was not connected) and null Mac address (00:00:00:00:00) or conn handle (0x0000).

I need to know why this event does not contain MAC address which was required to connect command. Is it bug or it conforms to the BLE core specification. 

Below I attach an attechment with log file, where is problem captured.

[1] : <Tx> - 01:12:30.107
-Type		: 0x01 (Command)
-Opcode		: 0xFE09 (GAP_EstablishLinkRequest)
-Data Length	: 0x09 (9) byte(s)
 HighDutyCycle	: 0x00 (Disable)
 WhiteList		: 0x00 (Disable)
 AddrTypePeer	: 0x00 (Public)
 PeerAddr		: 01:93:0C:AF:59:90				<- Bad MAC address
Dump(Tx):
01 09 FE 09 00 00 00 01 93 0C AF 59 90 
------------------------------------------------------------------------------------------------------------------------
[2] : <Rx> - 01:12:30.126
-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 
------------------------------------------------------------------------------------------------------------------------
[3] : <Tx> - 01:12:33.821
-Type		: 0x01 (Command)
-Opcode		: 0xFE0A (GAP_TerminateLinkRequest)
-Data Length	: 0x03 (3) byte(s)
 ConnHandle	: 0xFFFE (65534)
 discReason	: 0x13 (Remote User Terminated Connection)
Dump(Tx):
01 0A FE 03 FE FF 13 
------------------------------------------------------------------------------------------------------------------------
[4] : <Rx> - 01:12:33.977
-Type		: 0x04 (Event)
-EventCode	: 0xFF (HCI_LE_ExtEvent)
-Data Length	: 0x06 (6) bytes(s)
 Event		: 0x067F (GAP_HCI_ExtentionCommandStatus)
 Status		: 0x00 (Success)
 OpCode		: 0xFE0A (GAP_TerminateLinkRequest)
 DataLength	: 0x00 (0)
Dump(Rx):
04 FF 06 7F 06 00 0A FE 00 
------------------------------------------------------------------------------------------------------------------------
[5] : <Rx> - 01:12:34.277
-Type		: 0x04 (Event)
-EventCode	: 0xFF (HCI_LE_ExtEvent)
-Data Length	: 0x13 (19) bytes(s)
 Event		: 0x0605 (GAP_EstablishLink)
 Status		: 0x31 (The Connection Was Not Accepted)
 DevAddrType	: 0x00 (Public)
 DevAddr		: 00:00:00:00:00:00		<- null MAC address
 ConnHandle	: 0x0000 (0)
 ConnInterval	: 0x0000 (0)
 ConnLatency	: 0x0000 (0)
 ConnTimeout	: 0x0000 (0)
 ClockAccuracy	: 0x00 (0)
Dump(Rx):
04 FF 13 05 06 31 00 00 00 00 00 00 00 00 00 00 
00 00 00 00 00 00 
------------------------------------------------------------------------------------------------------------------------

I hope, that there will be someone who can advise me. Thank you in advance for your help.

  • Hello Jan,

    What firmware do you have loaded in the slave?  Are you able to establish a link with the slave using BTool?

    Thanks,

  • Hi,

    You should use the HCI_LE_Create_Connection_Cancel command to cancel an existing connection request according to the specs.

    The GAP_TerminateLinkReq is used to terminate a connection that was already successfully connected before.

  • Hi,

    Thank you for your response. 

    I tried to send command HCI_LE_Create_Connection_Cancel, but with the same result. I use same scenario as before - GAP_EstablishLinkReq with bad MAC address and then send cancel command, but I received GAP_EstablishLink event with "The Connection Was Not Accepted" status and null MAC address. 

    I'm interested in knowledge why this event contains null MAC address, because my application would need to know that this event is responding to the termination of the connection that was created with a specific MAC address. 

    Thank you for your willingness to help me

    I attach log file with tested commands:

    [1] : <Tx> - 07:34:35.575
    -Type		: 0x01 (Command)
    -Opcode		: 0xFE09 (GAP_EstablishLinkRequest)
    -Data Length	: 0x09 (9) byte(s)
     HighDutyCycle	: 0x00 (Disable)
     WhiteList		: 0x00 (Disable)
     AddrTypePeer	: 0x00 (Public)
     PeerAddr		: 7E:89:18:AF:59:90
    Dump(Tx):
    01 09 FE 09 00 00 00 7E 89 18 AF 59 90 
    ------------------------------------------------------------------------------------------------------------------------
    [2] : <Rx> - 07:34:35.589
    -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 
    ------------------------------------------------------------------------------------------------------------------------
    [3] : <Tx> - 07:34:38.705
    -Type		: 0x01 (Command)
    -Opcode		: 0x200E (Unknown Op Code)
    -Data Length	: 0x00 (0) byte(s)
     Raw		: 
    Dump(Tx):
    01 0E 20 00 
    ------------------------------------------------------------------------------------------------------------------------
    [4] : <Rx> - 07:34:39.141
    -Type		: 0x04 (Event)
    -EventCode	: 0xFF (HCI_LE_ExtEvent)
    -Data Length	: 0x13 (19) bytes(s)
     Event		: 0x0605 (GAP_EstablishLink)
     Status		: 0x31 (The Connection Was Not Accepted)
     DevAddrType	: 0x00 (Public)
     DevAddr		: 00:00:00:00:00:00
     ConnHandle	: 0x0000 (0)
     ConnInterval	: 0x0000 (0)
     ConnLatency	: 0x0000 (0)
     ConnTimeout	: 0x0000 (0)
     ClockAccuracy	: 0x00 (0)
    Dump(Rx):
    04 FF 13 05 06 31 00 00 00 00 00 00 00 00 00 00 
    00 00 00 00 00 00 
    ------------------------------------------------------------------------------------------------------------------------
    

  • Hi,

    I'm testing ble-stack without slave in this case. I try to send connect command to bad address or address of device, which is not connectable. Then I send command to terminate loopback connection to connection handle 0xFFFE. My problem is in event, which is responding to terminate request. This event contains error status, which is correct, but MAC address, which it was unable to connect does not match the address, which I originally wanted to connect. This address is still only consisting of zeros. 

    Thank you for trying to help me.