Custom board nrf5340 configured as central peripheral HR combo disconnects from HR devices after a 'successful' connection param update.

Hello,

We are currently in the process of developing a custom board containing the nrf5340, which will act as a central for HR devices and a peripheral for data transfers. During the development of the HR side we came across an issue in our custom board that doesn't occur on the discovery kit. The issue is that every time a HR device has connected to our Central, and requests an update of the connection parameters, our central accepts these new parameters but doesn't use them. Thereby causing a timeout in the connection with the peripheral.

This behaviour is visible in the image below:

The wireshark sniffer caught the following traffic:

The central does not seem to actually use the new connection parameters, as between each empty PDU (discounting the re-transmits) is still the original ~50ms interval. Our peripheral does not accept this interval and is quietly disconnected, going back into advertising mode (which is temporarily a NONCONN).
The only visible hint on what could be wrong here is in the control opcode message, which has a red error message in the protocol window, as seen in the below image:

At first we assumed this to be a software issue, where our device isn't correctly setting the new connection parameters, so we went back to the nordic samples. 

The above images were all taken from the Central And Peripheral HR sample from Nordic, with the authentication, security elements and DK associations completely stripped from the sample. The only addition is a le_param_updated callback, which prints out the new connection parameters. We created two build configurations, one for our DK and one for our own hardware (the dts of which is solely based on that of the DK with DK elements removed). Flashing this sample to our DK we observed the expected behaviour, as seen in the image below:

Although it takes a few packages for the connection parameters to actually update, we can see that from package ID 327 and onward that the connection interval has been changed to ~330ms and the peripheral keeps notifying the device of new heart rate intervals. Curiously the above behaviour is captured after we flashed the build configuration that was actually meant for our custom hardware, yet it still works. This would mean that (as far as we are aware) the firmware of both devices is the exact same, yet on our custom hardware it seems to fail which points to it being a hardware issue (although we do find this a strange hardware symptom).

Our hardware configuration is based on configuration 3 of the datasheet (9.3.3 Circuit configuration no. 3 for QKAA aQFN94, engineering sample D (QKAAD0) ), except that we have added an antenna connector (CONUFL001) so that we can add an external antenna.

We have tried a lot of different troubleshooting options including but not limited to:
- Manually accepting the new parameters using the le_param_updage_req callback
- Flashing the build configuration meant for the DK to our custom hardware
- Changing the antenna
- Disabling the peripheral side
- Using a different HR peripheral
- Using a different SN custom board
- Changing from SDK/Toolchain 2.9.0 to 3.0.0

What does work is that we can use the le_param_update_req callback to simply decline the connection parameter update request, which keeps the communication alive as normal on the 50ms interval, however considering the low-power requirements of the peripherals we are connected with, this isn't a viable long-term solution.

We are currently out of ideas to further troubleshoot this issue, so we require advice on how to continue. The Control Opcode error in the third image might be a hint as to what is going wrong.

Parents
  • Hello,

    Thank you for the detailed description!

    Let me see if I got this right. You are the central in the connection that we are investigating now, and the issue occurs only on your custom board, but you are not able to see the behavior on a DK, right?

    Are you the developer of the peripheral device as well? Is that another nRF device? If so, according to the log, what is the disconnect reason from the peripheral? And what is the disconnect reason for the central?

    Is this issue consistent, or does it happen occationally?

    What does work is that we can use the le_param_update_req callback to simply decline the connection parameter update request

    Can you show me the code where you accept it?

    If it sometimes works without the disconnection, can you please upload a sniffer trace of that scenario as well? If it happens all the time, can you please upload a sniffer trace of the issue noe happening on the DK?

    We created two build configurations, one for our DK and one for our own hardware (the dts of which is solely based on that of the DK with DK elements removed).

    Can you specify what DK elements that was removed?

    Best regards,

    Edvin

  • Hello Edvin,

    Thank you for your reply!

    Let me see if I got this right. You are the central in the connection that we are investigating now, and the issue occurs only on your custom board, but you are not able to see the behavior on a DK, right?

    Your problem description is correct.

    Are you the developer of the peripheral device as well? Is that another nRF device? If so, according to the log, what is the disconnect reason from the peripheral? And what is the disconnect reason for the central?

    We are currently not in control of the peripheral, but from looking at the wireshark data we can see that our Central pretty much stops communicating on its own. The peripheral therefore receives a communication timeout and starts advertising itself again. Our central meanwhile also disconnects because of a timeout, which is odd because what I can see from the wireshark it was our central who was responsible for keeping the connection alive. I will program a HR gatt server into another nordic dev board and get back to you with a log from that.

    Is this issue consistent, or does it happen occationally?

    It is a systemic issue, in that we always see the problem occur. Our device has never once successfully kept the communication alive after a connection param update request.

    Can you show me the code where you accept it?

    We do not manually accept the param change request in our current firmware, relying on the back-end to do so as it has been doing that in the sample code in the DK. When we added a decline I temporarily overwrote the param_change_req callback and made it return false regardless of the input.

    If it happens all the time, can you please upload a sniffer trace of the issue noe happening on the DK?

    bluetooth_sniffer_nrf_connect_with_instinct2.pcapng

    The above file is a sniffer trace from a nordic module connected to nRF Connect Desktop connecting with my watch, which successfully updated the connection parameters at package number 551. If you want to see it working with our firmware on a DK, I can get a sniffer trace of that as well if required, but it looks the same.

    Can you specify what DK elements that was removed?

    In all files we removed references to:

    • Led 2 and led 3
    • All buttons
    • Arduino references
    • I2C
    • Quad SPI
    • GPIO forwarder
    • USB
    • Aliases for mcuboot button and led
    • Configs related to serial, console and UART_CONSOLE as we do not have a uart console (we use RTT)
    • Any references to I2C, qspi, uart1 and spi in pintctrl
    • Changed pins of the UART to match ours (tx at gpio0, 21 and rx at gpio0, 19)
    • Under the 'chosen' node, removed anything linked to the uart0 alias

    In the common file we added nfct-pins-as-gpios under the &uicr node alias.

    Thank you,

    Jeroen

  • Hi Edvin,

    I will program a HR gatt server into another nordic dev board and get back to you with a log from that.

    I have programmed a nRF52840DK with the zephyr Perihperal HR example and changed the preferred connection interval to be 800/800, which gives me the following log:

    Connected
    Stop blinking LED.
    [00:02:26.076,751] <inf> hrs: HRS notifications enabled
    HRS notification status changed: enabled
    [00:02:34.578,125] <wrn> bt_conn: conn 0x200021a0: not connected
    [00:02:34.578,277] <inf> hrs: HRS notifications disabled
    HRS notification status changed: disabled
    Disconnected, reason 0x08
    [00:02:34.578,399] <wrn> bt_conn: conn 0x200021a0: not connected
    Starting Legacy Advertising (connectable and scannable)
    Start blinking LED...

    Reason number 0x08 is a timeout, as expected.

    What is interesting however, is that the example originally wanted to talk at an interval of 24/40 and our module accepted and used it just fine, so I will experiment with the connection interval for a bit to see when the parameter update is no longer propagated correctly.

Reply
  • Hi Edvin,

    I will program a HR gatt server into another nordic dev board and get back to you with a log from that.

    I have programmed a nRF52840DK with the zephyr Perihperal HR example and changed the preferred connection interval to be 800/800, which gives me the following log:

    Connected
    Stop blinking LED.
    [00:02:26.076,751] <inf> hrs: HRS notifications enabled
    HRS notification status changed: enabled
    [00:02:34.578,125] <wrn> bt_conn: conn 0x200021a0: not connected
    [00:02:34.578,277] <inf> hrs: HRS notifications disabled
    HRS notification status changed: disabled
    Disconnected, reason 0x08
    [00:02:34.578,399] <wrn> bt_conn: conn 0x200021a0: not connected
    Starting Legacy Advertising (connectable and scannable)
    Start blinking LED...

    Reason number 0x08 is a timeout, as expected.

    What is interesting however, is that the example originally wanted to talk at an interval of 24/40 and our module accepted and used it just fine, so I will experiment with the connection interval for a bit to see when the parameter update is no longer propagated correctly.

Children
  • I have been testing a bit more and found some strange results.

    For testing we are using a watch and a heart rate band, the watch has a preferred connection interval of 330ms and the band 500ms. Setting these intervals in the zephyr example causes no issues. The connection interval is updated by our central and kept alive just fine. The bluetooth sniffer however stops receiving after the event instant for the connection param update has passed (so the connection interval specifies instant 211, and as soon as event 211 occurs, the sniffer stops receiving, while our RTT is still logging a valid connection).

    When we disable the zephyr example and instead connect the band or the watch, the problem returns. The problem is still not visible on our DK board, which can connect with both the band and the watch.

    Setting the connection interval back to 800 (1000ms) the zephyr example will also get timed out after a connection parameter update request.

    @Edvin do you have any further advice?

Related