Many-to-one sensor collector topology, which BLE sample is better to modify?

Hi, 

1) I want to collect sensor data using BLE like the following topology, the sensor devices are battery-powered, which sample in the NCS is suitable to modify?

2) Does NUS central/peripheral can do many-to-one topology in this usage? or need to use BLE mesh?

Parents
  • Ok, I see what's going on. Please see:

    00> [00:01:46.234,741] <inf> central_uart: Disconnected: E3:4A:AE:AC:E6:6E (random), reason 0x08 
    00> [00:01:47.230,865] <inf> central_uart: Filters matched. Address: E3:4A:AE:AC:E6:6E (random) connectable: 0
    00> [00:01:47.329,833] <inf> central_uart: Connected: E3:4A:AE:AC:E6:6E (random)
    00> [00:01:47.336,364] <inf> central_uart: NUS Client module initialized
    00> [00:01:47.342,803] <err> central_uart: Stop LE scan failed (err 0)
    00> [00:01:47.449,584] <inf> central_uart: MTU exchange done
    00> [00:01:47.699,645] <inf> central_uart: Security changed: E3:4A:AE:AC:E6:6E (random) level 2
    00> [00:01:48.549,499] <inf> central_uart: Service discovery completed
    00> [00:01:48.554,351] <inf> central_uart: Scanning successfully started L514
    00> [00:01:48.558,898] <inf> central_uart: Sent data to NUS server 0: 00
    00> àY
    00> [00:01:52.749,603] <inf> central_uart: Filters matched. Address: E3:4A:AE:AC:E6:6E (random) connectable: 0
    00> [00:01:52.750,061] <wrn> bt_conn: Found valid connection (0x20002530) with address E3:4A:AE:AC:E6:6E (random) in connected state 
    00> [00:01:52.750,061] <wrn> central_uart: Connecting failed
    00> [00:01:53.480,438] <inf> central_uart: Filters matched. Address: E3:4A:AE:AC:E6:6E (random) connectable: 0
    00> [00:01:53.482,025] <wrn> bt_conn: Found valid connection (0x20002530) with address E3:4A:AE:AC:E6:6E (random) in connected state 
    00> [00:01:53.482,025] <wrn> central_uart: Connecting failed
    00> [00:01:53.583,038] <inf> central_uart: Filters matched. Address: E3:4A:AE:AC:E6:6E (random) connectable: 0
    00> [00:01:53.585,113] <wrn> bt_conn: Found valid connection (0x20002530) with address E3:4A:AE:AC:E6:6E (random) in connected state 
    00> [00:01:53.585,113] <wrn> central_uart: Connecting failed
    00> [00:01:53.690,216] <inf> central_uart: Filters matched. Address: E3:4A:AE:AC:E6:6E (random) connectable: 0
    00> [00:01:53.691,314] <wrn> bt_conn: Found valid connection (0x20002530) with address E3:4A:AE:AC:E6:6E (random) in connected state 
    00> [00:01:53.691,345] <wrn> central_uart: Connecting failed
    00> [00:01:53.792,144] <inf> central_uart: Filters matched. Address: E3:4A:AE:AC:E6:6E (random) connectable: 0
    00> [00:01:53.792,602] <wrn> bt_conn: Found valid connection (0x20002530) with address E3:4A:AE:AC:E6:6E (random) in connected state 
    00> [00:01:53.792,602] <wrn> central_uart: Connecting failed
    00> [00:01:54.113,372] <inf> central_uart: Filters matched. Address: E3:4A:AE:AC:E6:6E (random) connectable: 0
    00> [00:01:54.117,004] <wrn> bt_conn: Found valid connection (0x20002530) with address E3:4A:AE:AC:E6:6E (random) in connected state 
    00> [00:01:54.117,004] <wrn> central_uart: Connecting failed
    00> [00:01:54.536,834] <inf> central_uart: Filters matched. Address: E3:4A:AE:AC:E6:6E (random) connectable: 0
    00> [00:01:54.537,872] <wrn> bt_conn: Found valid connection (0x20002530) with address E3:4A:AE:AC:E6:6E (random) in connected state 
    00> [00:01:54.537,902] <wrn> central_uart: Connecting failed
    00> [00:01:54.641,754] <inf> central_uart: Filters matched. Address: E3:4A:AE:AC:E6:6E (random) connectable: 0
    00> [00:01:54.642,211] <wrn> bt_conn: Found valid connection (0x20002530) with address E3:4A:AE:AC:E6:6E (random) in connected state 
    00> [00:01:54.642,242] <wrn> central_uart: Connecting failed
    00> [00:01:55.273,284] <inf> central_uart: Filters matched. Address: E3:4A:AE:AC:E6:6E (random) connectable: 0
    00> [00:01:55.276,672] <wrn> bt_conn: Found valid connection (0x20002530) with address E3:4A:AE:AC:E6:6E (random) in connected state 
    00> [00:01:55.276,702] <wrn> central_uart: Connecting failed
    00> [00:01:55.378,540] <inf> central_uart: Filters matched. Address: E3:4A:AE:AC:E6:6E (random) connectable: 0
    00> [00:01:55.380,249] <wrn> bt_conn: Found valid connection (0x20002530) with address E3:4A:AE:AC:E6:6E (random) in connected state 
    00> [00:01:55.380,249] <wrn> central_uart: Connecting failed
    00> [00:01:55.749,725] <inf> central_uart: Disconnected: E3:4A:AE:AC:E6:6E (random), reason 0x08 
    00> [00:01:55.787,689] <inf> central_uart: Filters matched. Address: E3:4A:AE:AC:E6:6E (random) connectable: 0
    00> [00:01:56.099,243] <inf> central_uart: Connected: E3:4A:AE:AC:E6:6E (random)
    00> [00:01:56.105,743] <inf> central_uart: NUS Client module initialized
    00> [00:01:56.112,091] <err> central_uart: Stop LE scan failed (err 0)
    00> [00:01:56.249,572] <inf> central_uart: MTU exchange done

    You can see that the disconnected event occurs after the initial attempts to connect. And the log also says that it is already connected to the device with that address. So what happens is that you reset the DK (peripheral), and then it will start advertising immediately. Since the central is already scanning, it will immediately trigger the filter match, and try to connect, but it will fail to connect because it is still in a connection with the device with the same address. Then, later, when the central receives an latency timeout (disconnect reason 08), it will regard the old connection as disconnected. Then it will be able to connect to the peripheral again.

    The reason you don't see this in the normal central_uart application is because it is not scanning while it is in a connection. 

    In reality, you wouldn't see this issue either, because the peripheral wouldn't advertise while in a connection. And if they are getting out of range, they will still remain in a connection, until they time out at the same point in time (it is part of the connection parameters). Hence, the peripheral wouldn't start advertising before the central would consider the device disconnected. And should you for some reason experience a reset on the peripheral, it would still connect, but it takes a short while. 

    Best regards,

    Edvin

  • Hi,

    According to your reply, I notice in the disconnected(), I don't change 

    bt_conn_unref(default_conn) to 
    bt_conn_unref(conn).
    The connection handle is still in central, cause the peripheral can't reconnect.
    The reconnect issue seems ok now.
Reply Children
No Data
Related