Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Maybe a bug in SDK 15.2.0?? id_manager.c/im_device_identities_list_set

If the peer_cnt > BLE_GAP_DEVICE_IDENTITIES_MAX_COUNT, I think it may cause null point error.

    for (uint32_t i = 0; i < peer_cnt; i++)
    {
        memset(&bond_data, 0x00, sizeof(bond_data));

        // Read peer data from flash.
        ret = pds_peer_data_read(p_peers[i], PM_PEER_DATA_ID_BONDING,
                                 &peer_data, &buf_size);

        if ((ret == NRF_ERROR_NOT_FOUND) || (ret == NRF_ERROR_INVALID_PARAM))
        {
            NRF_LOG_WARNING("peer id %d: Peer data could not be found in flash. Remove the peer ID "
                            "from the peer list and try again.",
                            p_peers[i]);
            return NRF_ERROR_NOT_FOUND;
        }

        uint8_t const addr_type = bond_data.peer_ble_id.id_addr_info.addr_type;

        if ((addr_type != BLE_GAP_ADDR_TYPE_PUBLIC) &&
            (addr_type != BLE_GAP_ADDR_TYPE_RANDOM_STATIC))
        {
            NRF_LOG_WARNING("peer id %d: The address shared by the peer during bonding cannot be "
                            "whitelisted. Remove the peer ID from the peer list and try again.",
                            p_peers[i]);
            return BLE_ERROR_GAP_INVALID_BLE_ADDR;
        }

        // Copy data to the buffer.
        memcpy(&keys[i], &bond_data.peer_ble_id, sizeof(ble_gap_id_key_t));
    }

Parents Reply Children
No Data
Related