Hello,
I need to use muti role in NRF connect, to continue advertising when one connection is active.
I can find some topics about it using legacy sofdevices, but did not fined how to do in NRF Connect.
Thanks,
BR
Johanan
Hello,
I need to use muti role in NRF connect, to continue advertising when one connection is active.
I can find some topics about it using legacy sofdevices, but did not fined how to do in NRF Connect.
Thanks,
BR
Johanan
Hello,
I tried, but it failed in your state machine.
Can you just try this:
/* Callbacks */ void on_connected(struct bt_conn *conn, uint8_t err) { int ret; char addr[BT_ADDR_LE_STR_LEN]; if (err) { LOG_ERR("Connection error %d", err); return; } LOG_INF("Connected"); my_conn = bt_conn_ref(conn); newConState = connected; bt_addr_le_to_str(bt_conn_get_dst(conn), addr, sizeof(addr)); LOG_INF("Connected %s", addr); ret = bt_le_adv_start(adv_param, ad, ARRAY_SIZE(ad), NULL, 0); LOG_INF("connected - adv %d", ret); }
Do you need to have CONFIG_BT_CENTRAL=y? It seems like this is what is causing the issues. However, I don't know exactly why. I would need to investigate further.
Best regards,
Edvin
Our Bluetooth stack team came to the rescue.
The config you need to add is this one:
https://github.com/nrfconnect/sdk-nrf/blob/main/subsys/bluetooth/controller/Kconfig#L110
CONFIG_BT_CTLR_SDC_PERIPHERAL_COUNT=2
and your
CONFIG_BT_MAX_CONN needs to be at least 3.
That should do it.
Best regards,
Edvin
Hi,
That state machine was just a crude attempt to restart advertising outside the on_connect() function.
I removed it, and revert to the straightforward simple on_connect().
The problem, as you stated was this:
CONFIG_BT_CENTRAL=y
which is not really needed. I removed it and all working as expected.
So, I assume the last answer applies if one needs CENTRAL as well (which I might need in developing the next project: a central unit for these sensors, that can also be connected also to a mobile app)
Thanks again for your support.
BR
Johanan
I suspect you didn't get my very latest reply here. (If you loaded the page and wrote your last answer when I publiched mine).
The issue is that if CONFIG_BT_CENTRAL=y, then CONFIG_BT_CTLR_SDC_PERIPHERAL_COUNT defaults to 1. Do you just need to increment this config, and it should work as you would expect. You can probably keep your state machine as well. It was merely a coincidence that I removed it before figuring out that CONFIG_BT_CENTRAL=n changed the behavior.
BR,
Edvin
Case closed,
Thanks a lot.