This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

ANT+ scan and track multiple sensors

Dear nordic:

I am working on a tool which can collect data from multiple ant+ sensors with different device types,like a bike computer.

It allows user to assign up to 3 sensors for the same device type. When the tool starts up, it will search sensors user assigned circularly until it can track one.

For example: User assigned 3 heart rate sensors, HR1,HR2,HR3. When the tool is opened, it will search HR1 firstly, when timeout event occurs,it will close the channel and reopen it to search HR2.It will keep searching until it tracks one. And when the tracking sensor is lost, It sequentially execute searching logic.

It works well if i use one channel only to collect one kind of device type data. Unfortunately, i plan to support 4 channels to collect 4 kinds of sensors: HRM,Speed,Cadence,Bike Power. For each channel, I will consider to search up to 3 sensors until i find a available one.

For 4 channels, the issue is just the firstly opened two channels can return search timeout event. Another two channels have nothing returned from the stack for searching.

Belows are my search configrations:

  (HRM_DISP_CHANNEL_CONFIG(my_hrm))->device_number = device;
  ant_bsc_disp_init(&m_ant_cadence_dis_profile, BSC_DISP_CHANNEL_CONFIG(my_hrm),
                    BSC_DISP_PROFILE_CONFIG(my_hrm));

  const ant_search_config_t hrm_search_config = {
      .channel_number = MG_ANT_HRM_DIS_CHANNEL_NUM,
      .low_priority_timeout = 4,
      .high_priority_timeout = ANT_HIGH_PRIORITY_SEARCH_DISABLE,
      .search_sharing_cycles = ANT_SEARCH_SHARING_CYCLES_DISABLE,
      .search_priority = ANT_SEARCH_PRIORITY_HIGHEST,
      .waveform = ANT_WAVEFORM_DEFAULT,
  };

  APP_ERROR_CHECK(ant_search_init(&hrm_search_config));
  ant_bsc_disp_open(&m_ant_hrm_dis_profile);

How can i operate different channels to periodcally close/open to find different devices for each channel. Current situation seems that I lose ant event. I want each channel to execute search logic independently unless it's impossible.

Related