ANT+ with NCS BLE scanning

Hello, 

I'm currently working on NCS2.6.0 and ANT sdk v1.3.0, 

I would like to know is it possible to do BLE scanning(without connection) and ANT+ heart rate searching at the same time?

Now I'm able to scan BLE manufacturer data and ANT+ heart rate pages saparately, but I need to combine it on my nRF52832 custom board with NCS platfrom.

Could you provide some suggestions? Thank you.

Here's something in my main.c code for more information:

int ant_stack_setup(void)
{
	int err = ant_init();
	if (err)
	{
		LOG_ERR("ant_init failed: %d", err);
		return err;
	}
	LOG_INF("ANT Version %s", ANT_VERSION_STRING);

	err = ant_cb_register(&ant_evt_handler);
	if (err)
	{
		LOG_ERR("ant_cb_register failed: %d", err);
		return err;
	}

	err = ant_plus_key_set(CONFIG_HRM_RX_NETWORK_NUM);
	if (err)
	{
		LOG_ERR("ant_plus_key_set failed: %d", err);
	}
	return err;
}

static int start_scan(void) {
  uint8_t channel_number = 0;  

  ant_channel_config_t channel_config = {
    .channel_number = channel_number,
    .channel_type = CHANNEL_TYPE_SLAVE_RX_ONLY, 
    .ext_assign = EXT_PARAM_ALWAYS_SEARCH,  
    .rf_freq = 57,  
    .transmission_type = 0,  
    .device_type = 120,  
    .device_number = 0,  
    .channel_period = 8070,  
    .network_number = CONFIG_HRM_RX_NETWORK_NUM
  };

  int err = ant_channel_init(&channel_config);
  if (err) {
    LOG_ERR("ant_channel_init failed: %d", err);
    return err;
  }

  err = ant_channel_open(channel_number);
  if (err) {
    LOG_ERR("ant_channel_open failed: %d", err);
    return err;
  }

  LOG_INF("ANT+ scanning started on channel %d", channel_number);

  return 0;
}

int main(void)
{

	uint32_t baudrate, dtr = 0U;
	int ret;
	int err;
	
	err = ant_stack_setup();
	if (err)
	{
		goto ERROR_EXIT;
	}
	
	err = start_scan();
	if (err) {
		goto ERROR_EXIT;
	}
	
	ret = bt_enable(NULL);
	if (ret)
	{
		printk("Bluetooth init failed (err %d)\n", ret);
		return;
	}

	if (IS_ENABLED(CONFIG_SETTINGS))
	{
		settings_load();
	}

	printk("Bluetooth initialized\n");

	struct bt_le_scan_param scan_param = {
		.type = BT_LE_SCAN_TYPE_ACTIVE,
		.options = BT_LE_SCAN_OPT_CODED,
		.interval = BT_GAP_SCAN_FAST_INTERVAL,
		.window = BT_GAP_SCAN_FAST_WINDOW,
	};

	ret = bt_le_scan_start(&scan_param, scan_cb);
	if (ret)
	{
		printk("Starting scanning failed (err %d)\n", ret);
		return;
	}

	printk("Scanning successfully started\n");
	return 0;
	
ERROR_EXIT:
	ant_state_indicator_fatal_error();
	k_oops();
	
	return 0;
}

Parents
  • Hello,

    They will need to be duty cycled in some way.

    I would likely have looked at the ANT background scanning example:
    \ant\samples\ant_background_scanning\

    Then at the same time ensure that the BLE scanning have reasonable scanning window and interval that still allow ANT background scanning to occur. So if you for instance set BLE scan window = 100ms and BLE scan interval = 200ms, I would expect it would allow both ANT scanning and BLE scanning to occur.

    Kenneth

  • Hi Kenneth,

    Thanks for your reply.

    I tested my code with scan window = 100ms and BLE scan interval = 200ms, but I think ANT+ searching stopped few seconds after BLE scanning started to catch my target advertisment data.

    Do you have any idea about it?

    Here's my steps of testing:

    1.Start nRF52 and enable RTT log

    2.Turn on ANT+ device A

    3.Turn on ANT+ device B and BLE device

    4.Turn off BLE device

    My ANT+ device A never turn off, but the nRF52 device stop at [00:00:40.470,886], and never searching again

    Here's the main.c code, I'm going to test on nRF52840 first and later move for nRF52832:

    /*
     * Copyright (c) 2019 Intel Corporation
     *
     * SPDX-License-Identifier: Apache-2.0
     */
    
    /**
     * @file
     * @brief Sample echo app for CDC ACM class
     *
     * Sample app for USB CDC ACM class driver. The received data is echoed back
     * to the serial port.
     */
    
    #include <stdio.h>
    #include <string.h>
    #include <zephyr/device.h>
    #include <zephyr/drivers/uart.h>
    #include <zephyr/kernel.h>
    #include <zephyr/sys/ring_buffer.h>
    
    #include <errno.h>
    #include <zephyr/devicetree.h>
    #include <zephyr/sys/byteorder.h>
    #include <zephyr/sys/printk.h>
    
    #include <zephyr/bluetooth/bluetooth.h>
    #include <zephyr/bluetooth/hci.h>
    #include <zephyr/bluetooth/conn.h>
    #include <zephyr/bluetooth/uuid.h>
    #include <zephyr/bluetooth/gatt.h>
    
    #include <bluetooth/gatt_dm.h>
    #include <bluetooth/scan.h>
    
    #include <zephyr/settings/settings.h>
    
    #include <zephyr/kernel.h>
    #include <zephyr/drivers/gpio.h>
    
    #include <zephyr/usb/usb_device.h>
    #include <zephyr/usb/usbd.h>
    #include <zephyr/logging/log.h>
    
    #define ENABLE_ANT_PLUS
    #ifdef ENABLE_ANT_PLUS
    #include <ant_parameters.h>
    #include <ant_state_indicator.h>
    #include <ant_key_manager.h>
    #include <ant_profiles/hrm/ant_hrm.h>
    #include "ant_interface.h"
    #endif
    
    LOG_MODULE_REGISTER(cdc_acm_echo, LOG_LEVEL_INF);
    
    const struct device *dev;
    
    static void gpio_output_voltage_setup_3v3(void)
    {
    	
    	if ((NRF_UICR->REGOUT0 & UICR_REGOUT0_VOUT_Msk) !=
    		(UICR_REGOUT0_VOUT_3V3 << UICR_REGOUT0_VOUT_Pos))
    	{
    		NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Wen;
    		while (NRF_NVMC->READY == NVMC_READY_READY_Busy)
    		{
    		}
    
    		NRF_UICR->REGOUT0 = (NRF_UICR->REGOUT0 & ~((uint32_t)UICR_REGOUT0_VOUT_Msk)) |
    							(UICR_REGOUT0_VOUT_3V3 << UICR_REGOUT0_VOUT_Pos);
    
    		NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Ren;
    		while (NRF_NVMC->READY == NVMC_READY_READY_Busy)
    		{
    		}
    
    		
    		NVIC_SystemReset();
    	}
    }
    
    #endif
    #define LED0_NODE DT_ALIAS(led0)
    static const struct gpio_dt_spec led = GPIO_DT_SPEC_GET(LED0_NODE, gpios);
    
    #define RING_BUF_SIZE 1024
    uint8_t ring_buffer[RING_BUF_SIZE];
    
    struct ring_buf ringbuf;
    
    static bool rx_throttled;
    
    static void interrupt_handler(const struct device *dev, void *user_data)
    {
    	ARG_UNUSED(user_data);
    
    	while (uart_irq_update(dev) && uart_irq_is_pending(dev))
    	{
    		if (!rx_throttled && uart_irq_rx_ready(dev))
    		{
    			int recv_len, rb_len;
    			uint8_t buffer[64];
    			size_t len = MIN(ring_buf_space_get(&ringbuf),
    							 sizeof(buffer));
    
    			if (len == 0)
    			{
    				/* Throttle because ring buffer is full */
    				uart_irq_rx_disable(dev);
    				rx_throttled = true;
    				continue;
    			}
    
    			recv_len = uart_fifo_read(dev, buffer, len);
    			if (recv_len < 0)
    			{
    				LOG_ERR("Failed to read UART FIFO");
    				recv_len = 0;
    			};
    
    			rb_len = ring_buf_put(&ringbuf, buffer, recv_len);
    			if (rb_len < recv_len)
    			{
    				LOG_ERR("Drop %u bytes", recv_len - rb_len);
    			}
    
    			LOG_DBG("tty fifo -> ringbuf %d bytes", rb_len);
    			if (rb_len)
    			{
    				uart_irq_tx_enable(dev);
    			}
    		}
    
    		if (uart_irq_tx_ready(dev))
    		{
    			uint8_t buffer[64];
    			int rb_len, send_len;
    
    			rb_len = ring_buf_get(&ringbuf, buffer, sizeof(buffer));
    			if (!rb_len)
    			{
    				LOG_DBG("Ring buffer empty, disable TX IRQ");
    				uart_irq_tx_disable(dev);
    				continue;
    			}
    
    			if (rx_throttled)
    			{
    				uart_irq_rx_enable(dev);
    				rx_throttled = false;
    			}
    
    			send_len = uart_fifo_fill(dev, buffer, rb_len);
    			if (send_len < rb_len)
    			{
    				LOG_ERR("Drop %d bytes", rb_len - send_len);
    			}
    
    			LOG_DBG("ringbuf -> tty fifo %d bytes", send_len);
    		}
    	}
    }
    
    static void scan_cb(const bt_addr_le_t *addr, int8_t rssi, uint8_t adv_type,
    					struct net_buf_simple *buf)
    {
    }
    
    static void ant_hrm_evt_handler(ant_hrm_profile_t *p_profile, ant_hrm_evt_t event);
    
    HRM_DISP_CHANNEL_CONFIG_DEF(hrm, CONFIG_HRM_RX_CHANNEL_NUM, CONFIG_HRM_RX_CHAN_ID_TRANS_TYPE,
    							CONFIG_HRM_RX_CHAN_ID_DEV_NUM, CONFIG_HRM_RX_NETWORK_NUM,
    							HRM_MSG_PERIOD_4Hz);
    
    static ant_hrm_profile_t hrm;
    
    static void ant_hrm_evt_handler(ant_hrm_profile_t *p_profile, ant_hrm_evt_t event)
    {
    	switch (event)
    	{
    	case ANT_HRM_PAGE_0_UPDATED:
    		/* fall through */
    	case ANT_HRM_PAGE_1_UPDATED:
    		/* fall through */
    	case ANT_HRM_PAGE_2_UPDATED:
    		/* fall through */
    	case ANT_HRM_PAGE_3_UPDATED:
    		/* fall through */
    	case ANT_HRM_PAGE_4_UPDATED:
    		LOG_INF("Page was updated");
    		break;
    	default:
    		break;
    	}
    }
    
    static int utils_setup(void)
    {
    	int err = ant_state_indicator_init(hrm.channel_number, HRM_DISP_CHANNEL_TYPE);
    	if (err)
    	{
    		LOG_ERR("ant_state_indicator_init failed: %d", err);
    		return err;
    	}
    
    	return err;
    }
    
    static void ant_evt_handler(ant_evt_t *p_ant_evt)
    {
    	// ant_hrm_disp_evt_handler(p_ant_evt, &hrm);
    	int ret;
    	char data[128];
    	int data_len = 0;
    
    	if (p_ant_evt->event == EVENT_RX)
    	{
    		
    		ANT_MESSAGE *p_ant_message = (ANT_MESSAGE *)&p_ant_evt->message;
    		uint16_t device_id = (uint16_t)(p_ant_message->ANT_MESSAGE_aucExtData[0] |
    										((uint16_t)p_ant_message->ANT_MESSAGE_aucExtData[1] << 8));
    		
    		uint8_t rssi = p_ant_message->ANT_MESSAGE_aucExtData[5];
    		
    		uint8_t current_heart_rate = hrm.HRM_PROFILE_computed_heart_rate;
    		
    		printk("-----------------Received Device ID: %d, RSSI: %d, HeartRate: %d\n", device_id, rssi, current_heart_rate);
    		data_len = snprintf(data, sizeof(data), "(HRM,%d,[%d])", device_id, current_heart_rate);
    
    #ifdef CONFIG_BOARD_NRF52DK_NRF52832
    		uart_data_send(uart, data, data_len);
    		ret = gpio_pin_toggle_dt(&led);
    		if (ret < 0)
    		{
    			return 0;
    		}
    #elif defined(CONFIG_BOARD_NRF52840DK_NRF52840)
    		int bytes_written = uart_fifo_fill(dev, data, data_len);
    		if (bytes_written < data_len)
    		{
    			LOG_INF("Error during UART transmission");
    		}
    		else
    		{
    			LOG_INF("Sent %d bytes over UART", bytes_written);
    			ret = gpio_pin_toggle_dt(&led);
    			if (ret < 0)
    			{
    				return 0;
    			}
    		}
    #endif
    	}
    }
    
    static int profile_setup(void)
    {
    	int err = ant_hrm_disp_init(&hrm, HRM_DISP_CHANNEL_CONFIG(hrm), ant_hrm_evt_handler);
    	if (err)
    	{
    		LOG_ERR("ant_hrm_disp_init failed: %d", err);
    		return err;
    	}
    
    	err = ant_hrm_disp_open(&hrm);
    	if (err)
    	{
    		LOG_ERR("ant_hrm_disp_open failed: %d", err);
    		return err;
    	}
    	ant_state_indicator_channel_opened();
    	return err;
    }
    
    int ant_stack_setup(void)
    {
    	int err = ant_init();
    	if (err)
    	{
    		LOG_ERR("ant_init failed: %d", err);
    		return err;
    	}
    	LOG_INF("ANT Version %s", ANT_VERSION_STRING);
    
    	err = ant_cb_register(&ant_evt_handler);
    	if (err)
    	{
    		LOG_ERR("ant_cb_register failed: %d", err);
    		return err;
    	}
    
    	err = ant_plus_key_set(CONFIG_HRM_RX_NETWORK_NUM);
    	if (err)
    	{
    		LOG_ERR("ant_plus_key_set failed: %d", err);
    	}
    	return err;
    }
    
    static int start_scan(void) {
      uint8_t channel_number = 0;  
    
      ant_channel_config_t channel_config = {
        .channel_number = channel_number,
        .channel_type = CHANNEL_TYPE_SLAVE_RX_ONLY, 
        .ext_assign = EXT_PARAM_ALWAYS_SEARCH,  
        .rf_freq = 57,  
        .transmission_type = 0, 
        .device_type = 120,  
        .device_number = 0, 
        .channel_period = 8070, 
        .network_number = CONFIG_HRM_RX_NETWORK_NUM
      };
    
      int err = ant_channel_init(&channel_config);
      if (err) {
        LOG_ERR("ant_channel_init failed: %d", err);
        return err;
      }
    
      err = ant_channel_open(channel_number);
      if (err) {
        LOG_ERR("ant_channel_open failed: %d", err);
        return err;
      }
    
      LOG_INF("ANT+ scanning started on channel %d", channel_number);
    
      return 0;
    }
    
    int main(void)
    {
    
    	uint32_t baudrate, dtr = 0U;
    	int ret;
    	int err;
    #ifdef CONFIG_BOARD_NRF52840DK_NRF52840
    	gpio_output_voltage_setup_3v3();
    #endif
    
    	if (!gpio_is_ready_dt(&led))
    	{
    		return 0;
    	}
    
    	ret = gpio_pin_configure_dt(&led, GPIO_OUTPUT | GPIO_ACTIVE_LOW);
    	if (ret < 0)
    	{
    		return 0;
    	}
    
    	gpio_pin_set_dt(&led, 1);
    #ifdef CONFIG_BOARD_NRF52DK_NRF52832
    
    	UART_INIT();
    
    #elif defined(CONFIG_BOARD_NRF52840DK_NRF52840)
    	dev = DEVICE_DT_GET_ONE(zephyr_cdc_acm_uart);
    	if (!device_is_ready(dev))
    	{
    		LOG_ERR("CDC ACM device not ready");
    		return 0;
    	}
    
    #if defined(CONFIG_USB_DEVICE_STACK_NEXT)
    	ret = enable_usb_device_next();
    #else
    	ret = usb_enable(NULL);
    #endif
    
    	if (ret != 0)
    	{
    		LOG_ERR("Failed to enable USB");
    		return 0;
    	}
    
    	ring_buf_init(&ringbuf, sizeof(ring_buffer), ring_buffer);
    
    	LOG_INF("Wait for DTR");
    
    	/* They are optional, we use them to test the interrupt endpoint */
    	ret = uart_line_ctrl_set(dev, UART_LINE_CTRL_DCD, 1);
    	if (ret)
    	{
    		LOG_WRN("Failed to set DCD, ret code %d", ret);
    	}
    
    	ret = uart_line_ctrl_set(dev, UART_LINE_CTRL_DSR, 1);
    	if (ret)
    	{
    		LOG_WRN("Failed to set DSR, ret code %d", ret);
    	}
    
    	/* Wait 100ms for the host to do all settings */
    	k_msleep(100);
    
    	ret = uart_line_ctrl_get(dev, UART_LINE_CTRL_BAUD_RATE, &baudrate);
    	if (ret)
    	{
    		LOG_WRN("Failed to get baudrate, ret code %d", ret);
    	}
    	else
    	{
    		LOG_INF("Baudrate detected: %d", baudrate);
    	}
    
    	uart_irq_callback_set(dev, interrupt_handler);
    
    	/* Enable rx interrupts */
    	uart_irq_rx_enable(dev);
    #endif
    
    #ifdef ENABLE_ANT_PLUS
    	err = ant_stack_setup();
    	if (err)
    	{
    		goto ERROR_EXIT;
    	}
    
    	err = start_scan();
    	if (err) {
    		goto ERROR_EXIT;
    	}
    #endif
    
    	ret = bt_enable(NULL);
    	if (ret)
    	{
    		printk("Bluetooth init failed (err %d)\n", ret);
    		return;
    	}
    
    	if (IS_ENABLED(CONFIG_SETTINGS))
    	{
    		settings_load();
    	}
    
    	printk("Bluetooth initialized\n");
    
    	struct bt_le_scan_param scan_param = {
    		.type = BT_LE_SCAN_TYPE_ACTIVE,
    		.options = BT_LE_SCAN_OPT_NONE,
    		.interval = 0x0140,
    		.window = 0x00A0,
    	};
    
    	ret = bt_le_scan_start(&scan_param, scan_cb);
    	if (ret)
    	{
    		printk("Starting scanning failed (err %d)\n", ret);
    		return;
    	}
    
    	printk("Scanning successfully started\n");
    	return 0;
    
    #ifdef ENABLE_ANT_PLUS
    ERROR_EXIT:
    	ant_state_indicator_fatal_error();
    	k_oops();
    #endif
    
    	return 0;
    }

    Here's my RTT log:

    *** Booting nRF Connect SDK v3.5.99-ncs1 ***
    [00:00:00.002,288] <inf> cdc_acm_echo: Wait for DTR
    [00:00:00.381,988] <inf> cdc_acm_echo: Baudrate detected: 115200
    [00:00:00.382,141] <inf> cdc_acm_echo: ANT Version 1.03.00
    [00:00:00.382,446] <inf> cdc_acm_echo: ANT+ scanning started on channel 0
    [00:00:00.382,598] <inf> bt_sdc_hci_driver: SoftDevice Controller build revision: 
                                                36 f0 e5 0e 87 68 48 fb  02 fd 9f 82 cc 32 e5 7b |6....hH. .....2.{
                                                91 b1 5c ed                                      |..\.             
    [00:00:00.386,322] <inf> bt_hci_core: HW Platform: Nordic Semiconductor (0x0002)
    [00:00:00.386,352] <inf> bt_hci_core: HW Variant: nRF52x (0x0002)
    [00:00:00.386,383] <inf> bt_hci_core: Firmware: Standard Bluetooth controller (0x00) Version 54.58864 Build 1214809870
    [00:00:00.387,817] <inf> bt_hci_core: Identity: C6:98:B6:50:D1:ED (random)eceived Device ID: 13105, RSSI: 0, HeartRate: 0
    [00:00:01.321,105] <wrn> usb_cdc_acm: Device not configured or suspended, drop 15 bytes
    [00:00:01.321,136] <inf> cdc_acm_echo: Error during UART transmission
    -----------------Received Device ID: 13105, RSSI: 0, HeartRate: 0
    [00:00:04.522,583] <wrn> usb_cdc_acm: Device not configured or suspended, drop 15 bytes
    [00:00:04.522,583] <inf> cdc_acm_echo: Error during UART transmission
    -----------------Received Device ID: 13105, RSSI: 0, HeartRate: 0
    [00:00:05.015,075] <wrn> usb_cdc_acm: Device not configured or suspended, drop 15 bytes
    [00:00:05.015,106] <inf> cdc_acm_echo: Error during UART transmission
    -----------------Received Device ID: 13105, RSSI: 0, HeartRate: 0
    [00:00:07.724,029] <wrn> usb_cdc_acm: Device not configured or suspended, drop 15 bytes
    [00:00:07.724,060] <inf> cdc_acm_echo: Error during UART transmission
    -----------------Received Device ID: 13105, RSSI: 0, HeartRate: 0
    [00:00:11.418,029] <wrn> usb_cdc_acm: Device not configured or suspended, drop 15 bytes
    [00:00:11.418,029] <inf> cdc_acm_echo: Error during UART transmission
    -----------------Received Device ID: 13105, RSSI: 0, HeartRate: 0
    [00:00:14.619,506] <wrn> usb_cdc_acm: Device not configured or suspended, drop 15 bytes
    [00:00:14.619,506] <inf> cdc_acm_echo: Error during UART transmission
    -----------------Received Device ID: 13105, RSSI: 0, HeartRate: 0
    [00:00:17.820,953] <wrn> usb_cdc_acm: Device not configured or suspended, drop 15 bytes
    [00:00:17.820,953] <inf> cdc_acm_echo: Error during UART transmission
    -----------------Received Device ID: 13105, RSSI: 0, HeartRate: 0
    [00:00:18.313,476] <wrn> usb_cdc_acm: Device not configured or suspended, drop 15 bytes
    [00:00:18.313,476] <inf> cdc_acm_echo: Error during UART transmission
    -----------------Received Device ID: 13105, RSSI: 0, HeartRate: 0
    [00:00:21.514,953] <wrn> usb_cdc_acm: Device not configured or suspended, drop 15 bytes
    [00:00:21.514,953] <inf> cdc_acm_echo: Error during UART transmission
    -----------------Received Device ID: 38858, RSSI: 0, HeartRate: 0
    [00:00:21.890,380] <wrn> usb_cdc_acm: Device not configured or suspended, drop 15 bytes
    [00:00:21.890,411] <inf> cdc_acm_echo: Error during UART transmission
    -----------------Received Device ID: 38858, RSSI: 0, HeartRate: 0
    [00:00:22.383,178] <wrn> usb_cdc_acm: Device not configured or suspended, drop 15 bytes
    [00:00:22.383,178] <inf> cdc_acm_echo: Error during UART transmission
    -----------------Received Device ID: 38858, RSSI: 0, HeartRate: 0
    [00:00:25.584,625] <wrn> usb_cdc_acm: Device not configured or suspended, drop 15 bytes
    [00:00:25.584,625] <inf> cdc_acm_echo: Error during UART transmission
    -----------------Received Device ID: 38858, RSSI: 0, HeartRate: 0
    [00:00:28.786,041] <wrn> usb_cdc_acm: Device not configured or suspended, drop 15 bytes
    [00:00:28.786,071] <inf> cdc_acm_echo: Error during UART transmission
    -----------------Received Device ID: 38858, RSSI: 0, HeartRate: 0
    [00:00:29.278,320] <wrn> usb_cdc_acm: Device not configured or suspended, drop 15 bytes
    [00:00:29.278,320] <inf> cdc_acm_echo: Error during UART transmission
    Filtered Device Found: E8:89:51:C1:E9:E8 (random), Name: HW851-0235466, RSSI: -44
    Manufacturer Data: 00 00 00 00 37 48 
    [00:00:30.456,665] <wrn> usb_cdc_acm: Device not configured or suspended, drop 31 bytes
    [00:00:30.456,695] <inf> cdc_acm_echo: Error during UART transmission
    Filtered Device Found: E8:89:51:C1:E9:E8 (random), Name: HW851-0235466, RSSI: -45
    Manufacturer Data: 00 00 00 00 37 48 
    [00:00:31.450,164] <wrn> usb_cdc_acm: Device not configured or suspended, drop 31 bytes
    [00:00:31.450,195] <inf> cdc_acm_echo: Error during UART transmission
    Filtered Device Found: E8:89:51:C1:E9:E8 (random), Name: HW851-0235466, RSSI: -46
    Manufacturer Data: 00 00 00 00 37 48 
    [00:00:32.459,899] <wrn> usb_cdc_acm: Device not configured or suspended, drop 31 bytes
    [00:00:32.459,930] <inf> cdc_acm_echo: Error during UART transmission
    Filtered Device Found: E8:89:51:C1:E9:E8 (random), Name: HW851-0235466, RSSI: -44
    Manufacturer Data: 00 00 00 00 37 48 
    [00:00:33.459,808] <wrn> usb_cdc_acm: Device not configured or suspended, drop 31 bytes
    [00:00:33.459,838] <inf> cdc_acm_echo: Error during UART transmission
    Filtered Device Found: E8:89:51:C1:E9:E8 (random), Name: HW851-0235466, RSSI: -44
    Manufacturer Data: 00 00 00 00 37 48 
    [00:00:35.463,592] <wrn> usb_cdc_acm: Device not configured or suspended, drop 31 bytes
    [00:00:35.463,623] <inf> cdc_acm_echo: Error during UART transmission
    Filtered Device Found: E8:89:51:C1:E9:E8 (random), Name: HW851-0235466, RSSI: -44
    Manufacturer Data: 00 00 00 00 37 48 
    [00:00:36.471,710] <wrn> usb_cdc_acm: Device not configured or suspended, drop 31 bytes
    [00:00:36.471,740] <inf> cdc_acm_echo: Error during UART transmission
    Filtered Device Found: E8:89:51:C1:E9:E8 (random), Name: HW851-0235466, RSSI: -45
    Manufacturer Data: 00 00 00 00 37 48 
    [00:00:37.471,466] <wrn> usb_cdc_acm: Device not configured or suspended, drop 31 bytes
    [00:00:37.471,496] <inf> cdc_acm_echo: Error during UART transmission
    Filtered Device Found: E8:89:51:C1:E9:E8 (random), Name: HW851-0235466, RSSI: -44
    Manufacturer Data: 00 00 00 00 37 48 
    [00:00:38.466,064] <wrn> usb_cdc_acm: Device not configured or suspended, drop 31 bytes
    [00:00:38.466,094] <inf> cdc_acm_echo: Error during UART transmission
    Filtered Device Found: E8:89:51:C1:E9:E8 (random), Name: HW851-0235466, RSSI: -43
    Manufacturer Data: 00 00 00 00 37 48 
    [00:00:39.473,724] <wrn> usb_cdc_acm: Device not configured or suspended, drop 31 bytes
    [00:00:39.473,754] <inf> cdc_acm_echo: Error during UART transmission
    Filtered Device Found: E8:89:51:C1:E9:E8 (random), Name: HW851-0235466, RSSI: -44
    Manufacturer Data: 00 00 00 00 37 48 
    [00:00:40.470,855] <wrn> usb_cdc_acm: Device not configured or suspended, drop 31 bytes
    [00:00:40.470,886] <inf> cdc_acm_echo: Error during UART transmission

  • Hello,

    ekidsalan123 said:
    but I think ANT+ searching stopped few seconds after BLE scanning started to catch my target advertisment data.

    Be aware that there are both low priority and high priority ANT search options, and some will time out after a few seconds by default:
    https://www.thisisant.com/resources/an11-ant-channel-search-and-background-scanning-channel/ 

    The above application note is a bit old, but it explain the difference between the two. You can control the search priority by calling ant_search_init(&m_search_config).

    Kenneth

  • Thanks for your help, Kenneth.

    As you said, adding following code could disable timeout settings.

    const ant_search_config_t m_search_config =
        {
            .channel_number        = 0,
            .low_priority_timeout  = ANT_LOW_PRIORITY_TIMEOUT_DISABLE,
            .high_priority_timeout = ANT_HIGH_PRIORITY_SEARCH_DISABLE,
            .search_sharing_cycles = ANT_SEARCH_SHARING_CYCLES_DISABLE,
            .search_priority       = ANT_SEARCH_PRIORITY_DEFAULT,
            .waveform              = ANT_WAVEFORM_DEFAULT,
        };
        
        err = ant_search_init(&m_search_config);
    	if (err) {
    		LOG_ERR("ant_search_init() failed: 0x%X", err);
    		return err;
    	}

    I can now perform both BLE scanning and ANT+ searching, but I'm confused: is it normal for the scanning and searching to be slower than when they were combined previously?

Reply
  • Thanks for your help, Kenneth.

    As you said, adding following code could disable timeout settings.

    const ant_search_config_t m_search_config =
        {
            .channel_number        = 0,
            .low_priority_timeout  = ANT_LOW_PRIORITY_TIMEOUT_DISABLE,
            .high_priority_timeout = ANT_HIGH_PRIORITY_SEARCH_DISABLE,
            .search_sharing_cycles = ANT_SEARCH_SHARING_CYCLES_DISABLE,
            .search_priority       = ANT_SEARCH_PRIORITY_DEFAULT,
            .waveform              = ANT_WAVEFORM_DEFAULT,
        };
        
        err = ant_search_init(&m_search_config);
    	if (err) {
    		LOG_ERR("ant_search_init() failed: 0x%X", err);
    		return err;
    	}

    I can now perform both BLE scanning and ANT+ searching, but I'm confused: is it normal for the scanning and searching to be slower than when they were combined previously?

Children
Related