This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Can't establish connection from reset when peripheral and central advertise/scan with whitelist

I'm using the RSCS demo as the peripheral and the Relay demo as the central. I've modified each to use stored bond information if it is found in flash upon startup. I make sure they are connected and bonded, then I reset each board. Looking at Debug output, it appears that the central sees the advertisement from the peripheral, but the connection gets abruptly disconnected before discovery can occur. Error code 0x3E is reported. Here's a snippet of the output:

Found 1 bonds (keys)
Found 0 addrs, first is below
00 00 00 45 2F 02 addr type: 0
[APPL]: scan mode: 1, pstorage count: 0
[DM]: >> dm_whitelist_create

[DM]: Created whitelist, number of IRK = 0x01, number of addr = 0x00

[DM]: << dm_whitelist_create

[ADV]: Starting fast advertisement.

        [APPL]: 1814

RSC found

[DM]: Request to allocation connection instance

[DM]:[00]: Connection Instance Allocated.

[DM]: Searching for device 0x21 0x3C 0xF6 0x04 0x9B 0x50.

[DM]:[DI 0x00]: Device type 0x01.

[DM]: Device Addr 0xB9 0x34 0x46 0x6B 0x19 0xE3.

[DM]:[DI 0x01]: Device type 0xFF.

[DM]: Device Addr 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF.

[DM]:[DI 0x02]: Device type 0xFF.

[DM]: Device Addr 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF.

[DM]:[DI 0x03]: Device type 0xFF.

[DM]: Device Addr 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF.

[DM]:[DI 0x04]: Device type 0xFF.

[DM]: Device Addr 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF.

[DM]:[DI 0x05]: Device type 0xFF.

[DM]: Device Addr 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF.

[DM]:[DI 0x06]: Device type 0xFF.

[DM]: Device Addr 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF.

[DM]: Notifying application of event 0x11

[APPL]: >> DM_EVT_CONNECTION

[APPL]:[21 3C F6 04 9B 50]: Connection Established

[DB]: Starting disc[DM]: Disconnect Reason 0x003E

[DM]: Notifying application of event 0x12

[APPL]: >> DM_EVT_DISCONNECTION

[APPL]: Begin in state: 1, event 4
[APPL]: Transition to state: 1
[APPL]: << DM_EVT_DISCONNECTION

[DM]:[CI 0x00]: Freeing connection instance

[DM]:[00]: Freed connection instance.

[DM]: Initializing Connection Instance 0x00000000.

I just want to make sure using whitelist advertising and scanning at the same time is supposed to work. I'll keep looking at this and see if there's any way my application could be doing anything wrong, though.

EDIT: added attachments

relay main.c: main.c wireshark capture sniff1.pcapng wireshark screen sniff1.PNG rscs main.c main.c

modified relay project: ble_richv_demo.zip

modified rscs project: ble_app_rscs_richv.zip

  • I prefer Keil :) I got you projects up and running. It seems they connect, but then the peripheral doesn't respond, so the connection times out and the central disconnects. I'll have closer look tomorrow morning.

  • I think the Keil projects are up-to-date in those zips that I attached. I stopped using them because I only have the trial version and one of the projects created images that became too big to use the free version.

    Thanks for taking a look, I can also look a bit more on the peripheral side with the clue you have given me.

  • Actually, I think they never get connected. The central sends a connection request, but the address/IRK is not in the whitelist so the peripheral ignores the connection request. The central believes it is in a connection until the peripheral doesn't respond, and then it disconnects. Something like this:

    Peripheral   -> Central      Advertising
    Central      -> Peripheral   Connection Request (filtered by peripheral, but central belives it is in a connection)
    Central      -> Peripheral   Empty Packet
    Central      -> Peripheral   Empty Packet
    Central      -> Peripheral   Empty Packet
    Central      -> Peripheral   Empty Packet
    Central      -> Peripheral   Empty Packet
    Central      -> Peripheral   Empty Packet (Disconnect)
    

    For what I can see the central is not distributing LTK or IRK, because

    register_param.sec_param.kdist_central.enc = 1;
    register_param.sec_param.kdist_central.id = 1;
    

    is not set in device_manager_init().

    The second thing I would check is if the IRK distributed by the central is equal to the IRK you are actually putting into the whitelist. Maybe by printfing it.

  • @Petter, the kdist_central struct member isn't there anymore when using the peer manager as opposed to the device manager. I'm seeing the same issue as Richard. Is there something I need to do to the peer manager when using a whitelist?

Related