nRF52840 DK stops to scan after 3 hours working

Help me please!!!

nRF52840 DK stops to scan after 3 hours working.

Project is based on central_nordic_uart_service.

Scan params

    struct bt_le_scan_param scan_param = {
        .type     = BT_SCAN_TYPE_SCAN_ACTIVE,
	.interval = 220,
	.window   = 80,
	.options  = BT_LE_SCAN_OPT_CODED | BT_LE_SCAN_OPT_NO_1M
    };

    struct bt_le_conn_param conn_param = {
        .interval_min = 1000,
        .interval_max = 1000,
        .latency = 0,
        .timeout = 2000,
    };

    struct bt_scan_init_param scan_init = {
        .connect_if_match = 0,
	.scan_param = &scan_param,
	.conn_param = &conn_param
    };

    bt_scan_init(&scan_init);
    bt_scan_cb_register(&scan_cb);

    err = bt_scan_filter_add(BT_SCAN_FILTER_TYPE_UUID, BT_UUID_NUS_SERVICE);
    if (err) 
    {
        LOG_ERR("Scanning filters cannot be set (err %d)", err);
        return err;
    }

    err = bt_scan_filter_enable(BT_SCAN_UUID_FILTER, false);
    if (err) 
    {
        LOG_ERR("Filters cannot be turned on (err %d)", err);
        return err;
    }

    LOG_INF("Scan module initialized");
    return err;

it works fine 3 hours and then BLE doesn`t able to scan any peripheral.

Connected devices are working fine until it disconected, and then they can not to connect - no any feedback on central side.

I tried to reinit, start, stop scan - nothing helped.

Parents
  • I think you should review the scan parameters you've set. Then, consider adjusting the interval and window values to see if that affects the performance. Here’s an example of how you might structure your reinitialization logic: geometry dash breeze

    void restart_scan(void) {
        int err;
    
        // Stop scanning if it's currently active
        err = bt_scan_stop();
        if (err) {
            LOG_ERR("Scan stop failed (err %d)", err);
            return;
        }
    
        // Reinitialize scan parameters
        err = bt_scan_init(&scan_init);
        if (err) {
            LOG_ERR("Scan initialization failed (err %d)", err);
            return;
        }
    
        // Restart scanning
        err = bt_scan_start(BT_SCAN_TYPE_SCAN_ACTIVE);
        if (err) {
            LOG_ERR("Scan start failed (err %d)", err);
        } else {
            LOG_INF("Scanning restarted");
        }
    }

  • Pikashow is a popular online movie and streaming app that lets users watch Telugu, Hindi, English, TV series, seasons, dramas, and cricket/IPL movies.

Reply Children
No Data
Related