You mention the PIN screen only shows when you try to write to a characteristic? How about removing the startBonding line and instead just trying to access the characteristic (but while listening for the passkeyRequest event)? It's possible that would be more successful at kicking off the bonding properly?
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Ok, just some more thoughts:
NRF.setSecurity({keyboard:1, mitm:1});
startBonding
line and instead just trying to access the characteristic (but while listening for the passkeyRequest event)? It's possible that would be more successful at kicking off the bonding properly?