Failed to generate DHKey

Hello,

I'm getting this error when trying to connect, which seems to happen after the first SMP Timeout. Most of the time connecting/disconnecting works, deleting bonds etc, but it seem to get into the state. After this it doesn't matter which device is connecting, it will keep coming up with the same error.

Any idea on what is causing this problem?

Parents
  • Hi,

    I do not recall seeing the "Failed to generate DHKey" error before, and have not found any other references to it here on DevZone. It can be pårinted from a few locations, but I assume you see it printed from smp.c? Can you check that with a debugger? And if so, can you step down into bt_dh_key_gen() and see if you can learn more about what caused it to fail?

    Also, which SDK version are you using? Did LESC pairing work on your product before? If so, which changes did you do when it stopped working?

  • Yes you were right as it is going into the smp.c and into the bt_dh_key_gen() function. From this it's getting the error code -120.

    I can repeat what happening, which I think is that an interrupt from a peripheral is being triggered around the same time it goes into pairing mode. Then I'll get the E: SMP Timeout, and then E: Failed to generate DHKey .

    Maybe unrelated (although I don't think it is), but some threads also stop responding in this error state. For example I have a timer that will give a semaphore to a thread to run. When the error condition occurs, the thread stops receiving the semaphore, despite the timer going off.

    I'm using v2.7.0 SDK, and yes pairing for has been working. I did change the pairing process, but I have seen the button problem before, as well as not being able to pair unless reflashing the chip.

  • I'm pretty sure it's because of the interrupt happening. I pressed the button to put it into pairing mode without tripping the imu interrupt, 10 times and every time it deleted the pairing, advertised and allowed devices to pair again. The next time I pressed the button and set the imu off, which will trigger and interrupt, it failed, and got into this state.

    Even if it fails the first time, it never recovers from this state, unless I power down the device.


  • I see. I am not able to see how this could happen. Are you able to reproduce this on a DK? If so, can you share the code along with instruction on how to reproduce?

Reply Children
No Data
Related