I've made a custom device which uses a Nordic Semiconductors MCU. I have a python GUI which uses the bleak library and has no issue connecting and communicating with the device when it uses open broadcast. However, I run into issues when I implement security (LE Secure Connections) with a static passkey. I intend to bond the device to the PC before communicating with the GUI as bleak does not support pairing.
I have already established that the pairing works completely fine with both the nRF connect mobile app and a custom flutter android app. This is an issue only encountered when pairing with a windows PC.
According to the debug logs it connects, but before any bonding occurs, it disconnects after 10 seconds. The error codes are nondescript. Upon disconnect, the RPA automatically changes and the device starts advertising again. That is expected behavior. The unexpected behavior is the lack of pairing and forced disconnect. On the PC, there is no prompted passkey to enter.
I used a sniffer to capture the packets. This is the entire sequence exchanged before PC and MCU disconnect. I am new to BLE and researching so I do not know the exact correct sequence of exchanges.
Is there anything that stands out with this capture? I can share the wireshark .pcapng if required. Is there a way that windows does BLE bonding which differs from that of mobile devices?
I'm self-answering this post to close it. Emil and Risto provided information for the workaround by disabling the PHY update on the peripheral, however it was ultimately a firmware issue with my intel Bluetooth driver which was outdated. See the nordic forum links for more information.