central device will not raise security level with new periphral if no power reset on central side

The central device has the below settings

static void auth_passkey_entry(struct bt_conn *conn)
{
	char addr[BT_ADDR_LE_STR_LEN];

	bt_addr_le_to_str(bt_conn_get_dst(conn), addr, sizeof(addr));

	// Check for passkey entry event
	unsigned int passkey = STATIC_PASSKEY;
	LOG_DBG("Passkey entered %s: %06u", addr, passkey);

	// Set passkey using bt_conn_auth_passkey_entry()
	bt_conn_auth_passkey_entry(conn, passkey);
}

static void auth_cancel(struct bt_conn *conn)
{
	char addr[BT_ADDR_LE_STR_LEN];

	bt_addr_le_to_str(bt_conn_get_dst(conn), addr, sizeof(addr));

	LOG_INF("Pairing cancelled: %s", addr);
}

static void pairing_complete(struct bt_conn *conn, bool bonded)
{
	char addr[BT_ADDR_LE_STR_LEN];

	bt_addr_le_to_str(bt_conn_get_dst(conn), addr, sizeof(addr));

	LOG_INF("Pairing completed: %s, bonded: %d", addr, bonded);
}

static void pairing_failed(struct bt_conn *conn, enum bt_security_err reason)
{
	char addr[BT_ADDR_LE_STR_LEN];

	bt_addr_le_to_str(bt_conn_get_dst(conn), addr, sizeof(addr));

	LOG_ERR("Pairing failed conn: %s, reason %d", addr, reason);
}

static struct bt_conn_auth_cb conn_auth_callbacks = {
	.passkey_entry = auth_passkey_entry,
	.cancel        = auth_cancel,
};

static struct bt_conn_auth_info_cb conn_auth_info_callbacks = {
	.pairing_complete = pairing_complete,
	.pairing_failed   = pairing_failed
};

One central device A and two peripheral devices B and C,  B and C have the exact same firmware. A can establish the connection with B or C. 

but I have to power reset A in order to change the connection between A-B and A-C otherwise auth_passkey_entry on A will not be triggered and security level will always be the lowest.

I tried to do power reset B and C but the situation still remain the same. 

Is there any flag or bonding info I need to clear on the central side before establish a new connection ?

Parents
  • Hi

    What is the CONFIG_BT_MAX_CONN and CONFIG_BT_MAX_PAIRED set to in your central application? My initial guess would be that you are only allowing one connected/paired device at a time, so the central device isn't able to connect to the other device, and you have to reset the central to disconnect and unpair with one device. Please give these two configs a try and see if that helps. You can also try to enable some logging so we can see what kind of error/return value the central returns when trying to connect to the other device.

    Best regards,

    Simon

Reply
  • Hi

    What is the CONFIG_BT_MAX_CONN and CONFIG_BT_MAX_PAIRED set to in your central application? My initial guess would be that you are only allowing one connected/paired device at a time, so the central device isn't able to connect to the other device, and you have to reset the central to disconnect and unpair with one device. Please give these two configs a try and see if that helps. You can also try to enable some logging so we can see what kind of error/return value the central returns when trying to connect to the other device.

    Best regards,

    Simon

Children
Related