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

  • Have you checked the HFXO frequency?

    We had another thread here some time (weeks?) ago where improperly sized loading capacitors caused HFXO frequency to shift outside acceptable range.

    I recommend using GPIOTE and a timer/RTC peripherial in order to check both crystal frequencies.

  • Indeed, this is worth looking into.

    And if you haven't already, can you please create a ticket (you might want that to be a private ticket) where you upload your schematics and PCB layout files, and request a HW review, to check that things (such as capacitors around the XTALs) have proper values. 

    Best regards,

    Edvin

  • Hi Edvin,

    We are currently running the GPPI one_to_one example to see how accurate our timer is. Would this sample provide us with that information? We are using an oscilloscope on a test pin (not an LED because our LED was routed to the other bank GPIO1), but doing this gives us a high and low time of 990ms instead of 1000ms, so either our clock has a 1% inaccuracy, or more likely we are using the sample incorrectly.

    (such as capacitors around the XTALs)

    We have dutifully followed the recommendations of the nordic datasheet specifying configuration 3 and are using the internal load capacitors for both the high frequency and low frequency clock. Calculating the required load capacitors based on our trace and pad capacitance, plus the capacitance required by the crystal, we came to a value of 7pF for our 32kHz and 14pF (2x7) for our 32MHz clock. We have selected these as well in the config files.

    CONFIG_SOC_HFXO_CAP_INT_VALUE_X2=14
    CONFIG_SOC_LFXO_CAP_INT_7PF=y

    Varying these values does not change the outcome, the board still fails after a connection interval change.

    I will be looking more into debugging the timing values.

    And if you haven't already, can you please create a ticket (you might want that to be a private ticket) where you upload your schematics and PCB layout files, and request a HW review,

    What would be the specifics of such a ticket? Assuming Problem Type = Hardware, Development Stage = Development, Product = nRF5340, Distributor = None?

    Regards,

    Jeroen

  • Relitech-Jeroen said:
    GPPI one_to_one example

    Which sample is this? And is it testing the HFCLK or the LFCLK?

    Relitech-Jeroen said:
    but doing this gives us a high and low time of 990ms instead of 1000ms, so either our clock has a 1% inaccuracy, or more likely we are using the sample incorrectly

    Do you see the same on the nRF5340DK?

    Relitech-Jeroen said:

    What would be the specifics of such a ticket? Assuming Problem Type = Hardware, Development Stage = Development, Product = nRF5340, Distributor = None?

    I suspect you need to select a distributor to be allowed to create a private ticket, but you can test without. The rest is fine.

    Best regards,

    Edvin

  • We have found the cause of the problem, and verified a fix. The issue indeed came from our crystal being incorrectly specified to the load capacitance, as our 32k crystal expected 4pF but the nordic chip could only go down to 6pf internal capacitance.

    To validate this, I have desoldered the 32k crystal from a defect DK board we had lying around, and replaced our own with it. After doing this and using the default crystal settings in the board configuration, the device was able to keep a connection alive after a connection parameter update request was called.

    Why or how flashing a DK with a heart rate peripheral firmware meant that our device was able to accept longer connection intervals, is a mystery to me. Why our device was unable to synthesize the 32kHz clock is also a dubious issue, but not an important one.

    Thank you for your time and help .

Reply
  • We have found the cause of the problem, and verified a fix. The issue indeed came from our crystal being incorrectly specified to the load capacitance, as our 32k crystal expected 4pF but the nordic chip could only go down to 6pf internal capacitance.

    To validate this, I have desoldered the 32k crystal from a defect DK board we had lying around, and replaced our own with it. After doing this and using the default crystal settings in the board configuration, the device was able to keep a connection alive after a connection parameter update request was called.

    Why or how flashing a DK with a heart rate peripheral firmware meant that our device was able to accept longer connection intervals, is a mystery to me. Why our device was unable to synthesize the 32kHz clock is also a dubious issue, but not an important one.

    Thank you for your time and help .

Children
No Data
Related