Bluetooth master-slave start scan failed

I have written a master-slave program based on NCS 2.2.0 and use nRF52840 board.

Firstly, I turned on two broadcast frames and set the scan timeout to 0. This successfully enabled scanning. Here is my configuration.

CONFIG_BT=y
CONFIG_BT_CENTRAL=y
CONFIG_LOG=y
CONFIG_LOG_PRINTK=y
CONFIG_SEGGER_RTT_BUFFER_SIZE_UP=5122

CONFIG_BT_EXT_ADV=y
CONFIG_BT_PERIPHERAL=y
CONFIG_BT_LL_SW_SPLIT=y

CONFIG_BT_EXT_ADV_MAX_ADV_SET=2
CONFIG_BT_MAX_CONN=2

But when I set the scan timeout to 2s, the scan fails to start. 

At this point if I set CONFIG_BT_EXT_ADV_MAX_ADV_SET to 3, I can successfully start the scan.

What I can't understand is what scanning has to do with CONFIG_BT_EXT_ADV_MAX_ADV_SET? Or there is some other reason why the scan failed to start?

Attached is my test sample

3124.central.zip

Parents
  • AHaug said:
    It looks like that there could be an implied dependency that increases BT_MAX_CONN to 3 if BT_EXT_ADV_MAX_ADV_SET is set to 3 which might be why the scanning starts with the last configuration.

    It looks like this is correct. 

    From what I have seen in other similar cases and discussion, the fix is to either increase the CONFIG_BT_MAX_CONN=3 or disable BT_CENTRAL, which should give you two advertising sets and one scan. When you set the number of slave connections to 2, you will need to disable the central role support or to increase the maximum allowed BT_CONN. Having both Central and peripheral support = 2 connections. If you add scanning this will require BT_MAX_CONN = 3 to run.

    Could you try with the following configuration and report back to me what you see?

    Scan timeout = 2
    CONFIG_BT_EXT_ADV_MAX_ADV_SET=2
    CONFIG_BT_MAX_CONN=3

    Kind regards,
    Andreas

Reply
  • AHaug said:
    It looks like that there could be an implied dependency that increases BT_MAX_CONN to 3 if BT_EXT_ADV_MAX_ADV_SET is set to 3 which might be why the scanning starts with the last configuration.

    It looks like this is correct. 

    From what I have seen in other similar cases and discussion, the fix is to either increase the CONFIG_BT_MAX_CONN=3 or disable BT_CENTRAL, which should give you two advertising sets and one scan. When you set the number of slave connections to 2, you will need to disable the central role support or to increase the maximum allowed BT_CONN. Having both Central and peripheral support = 2 connections. If you add scanning this will require BT_MAX_CONN = 3 to run.

    Could you try with the following configuration and report back to me what you see?

    Scan timeout = 2
    CONFIG_BT_EXT_ADV_MAX_ADV_SET=2
    CONFIG_BT_MAX_CONN=3

    Kind regards,
    Andreas

Children
No Data
Related