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

Adding peer manager to ble_app_uart

Hi,

I'm developing with 52840 DK, trying to add peer manager to another project I've modified from ble_app_uart (basically I've added saadc, SPI, USB and I2C module based on original example. Also this project was migrated from 52832 DK to 52840 DK and has been proven working).

As for peer manager example, I referred ble_app_bms from SDK16.

Here are the attempts I've done:

- Copying peer_manager_init(); and its evt_handler() from ble_app_bms. Copying and modifying erase_bonds and advertising_start().

- Adding source files from         ...\components\ble\peer_manager   to nRF_BLE group

- Adding        fds.c     fstorage.c        fstorage_sd.c   to nRF_Libraries group

- Including     fds.h   peer_manager.h   peer_manager_handler.h to main.c

- Enable fds, fstorage, peer_manager module in sdk_config

Now here is my situation,

I could compile the project without error and burned it into 52840DK.

Seems like I could erase existing bonds from flash.

I could connect without bonding(which is not what we want) and it works as usual, but when I manually bond it, connection failed and it shows "invalid pin or passkey, bonding failed" on nrf_connect.

And it LOG shows as follows when bonding failed.

I've been stuck by this problem for weeks. But it just works differently from sample projects.

Which part of it goes wrong.

Your help is appreciated, I could upload my project if necessary.

Parents Reply
  • Hi Karl,

    I'm using nordic uart service only. I'm not quite sure if central app requires bonding to access it cuz previously it's possible to connect it directly w/o bonding...

    Now the bonding option pop up everytime when I hit "connect"(which is exactally what we were expecting), perhaps because I allowed "repairing" function in pm_evt_handler like below?

    		case PM_EVT_CONN_SEC_CONFIG_REQ:
            {
                // Reject pairing request from an already bonded peer.
                pm_conn_sec_config_t cfg;
                cfg.allow_repairing = true;
                pm_conn_sec_config_reply(p_evt->conn_handle, &cfg);
            } break;

    Or I might have some unnoticed modification somewhere else...

    Thanks

Children
  • Hello again,

    Avadacadabara said:
    I'm not quite sure if central app requires bonding to access it cuz previously it's possible to connect it directly w/o bonding...

    You are correct that the NUS service does not require bonding to access it by default, yes. I was under the impression that you would have liked to change this, but I might have misunderstood your intentions.

    Avadacadabara said:
    perhaps because I allowed "repairing" function in pm_evt_handler like below?

    You can test this by disabling this again, to see if the behavior changes.

    Avadacadabara said:
    I might have some unnoticed modification somewhere else...

    That does indeed make it harder to pintpoint exactly what led to the change - I thought you did not make any changes to the code when the behavior changed.

    If you would like to find out the root cause, please iteratively revert changes you have made and test the application again each time, to find out exactly what changed the behavior.
     
    Best regards,
    Karl

Related