This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Static passkey and write_no_response

Dear All, I'm trying to set a static passkey. I have created 2 custom characterestic. One characterestic is used for notifications and the other one for writing. For communication I'm using NRF Master Control app.

When I set in my second characterestic char_md.char_props.write = 1 (write request) my program works as expected. When I connect and first time try to write something it requires the passkey, but when I change it to char_md.char_props.write_wo_resp = 1 (write command) I can write any data without typing the passkey. It doesn't require to type a passkey. Please have a look at this file how I created services and characterstics.ble_mps.c Can someone help me to solve my the problem? Thanks a lot for your help.

Harut

  • @Harut: It's strange what you described. This means when you set the properties to write without response you can access the characteristic without encryption. Have you make sure you have set the characteristic write permission with encryption ? Such as with BLE_GAP_CONN_SEC_MODE_SET_ENC_WITH_MITM() ?

    If possible, please upload your project source code so that we can test here.

  • Hi Hung Bui

    Thanks for your response and really appreciate your help. Yes I've set the MITM protection. You can see above in the attached file some part of my code. How I created the service and 2 characterstics. If you would need more data, I'd be glad to provide.

    Thanks again for your assistance.

  • @haruthakop: It would be easier if you can send us the whole project (and the SDK version) so we can compile here.

    Have you tried to read the value back after you write ? to make sure that the write command is actually executed and the value is updated?

    Note that with write command, there will be no response from the peripheral, telling that the write was not accepted because the link is not encrypted (Insufficient Authentication) as with write request.

    And without that "Insufficient Authentication" response, the phone won't automatically trigger bonding.

  • Hi Hung Bui

    Thanks a lot, your advices were really helpful. My write command wasn't actually executed. I was looking at the MCP value and the sniffer and was thinking the value was changing, but actually not. If I do bonding first, the write command start executing.

Related