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

some promble with s332 ant backgroud scan

Hey, guys, let me ask you a question.I have a device that does bluetooth broadcasting and ant background scanning.After working for 12 hours, the bluetooth broadcast frequency changed to 2.5s once.When I turned off the ant background scan, the bluetooth radio worked again.Using sdk14.2, s332 protocol stack.Have you ever encountered such problem

Parents
  • Compensation: no reset mcu.open the ant background scan again ,Bluetooth broadcast frequency changed to 2.5s once

  • hi,Kebbeth。last Friday i use ant_search_init(ant_search_config_t const * p_config)to config to config ant.the bluetooth broadcasting is working normal.but i dont no what  cased this? you give document  only say 
    may affect co-existence with other protocolson multimode communication chipsets.dont give me reason.Even if it is not initialized, it should not affect bluetooth broadcasting.can you give answer  ?thinks!!

  • If you are not calling ant_search_init(), then the stack will use default search priority:

    "When an ANT channel is opened on a slave device, the search is automatically and immediately initiated. ANT will first search in low priority mode, and then will only switch to high priority mode after a defined time out. If the high priority search also times out, then ANT will issue an EVENT_RX_SEARCH_TIMEOUT and close the channel ()."

    So if you want to avoid high priority search mode you should call ant_search_init() first.

  • High priority search may affect bluetooth broadcasting?Why didn't it show up when it first started?It was only when I worked for a long time that it became a problem.Ps: it took a long time for the ant background scan to cause bluetooth broadcasting is working abnormality.

  • Hi,

    I believe the reason is: "ANT will first search in low priority mode, and then will only switch to high priority mode after a defined time out."

    I suggest you call ant_search_init() to avoid high priority mode to occur, from my understanding you can confirm this works?

    When you open scanning channel, what timeout do you define? 

    When you start advertising, what timeout do you define?

    Best regards,
    Kenneth

  • hi,Kebbeth ,this problem continues.this is my  ant config.

    err_code = sd_ant_stack_reset();
    APP_ERROR_CHECK(err_code);
    err_code = ant_stack_static_config();
    APP_ERROR_CHECK(err_code);



    // Set Network Address.
    pa_lna_assist(TXEN_RFPA,RXEN_RFPA);

    ant_channel_config_t channel_config =
    {
    .channel_number = 0,
    .channel_type = CHANNEL_TYPE_SLAVE,
    .ext_assign = 0x00,
    .rf_freq = ANTPLUS_RF_FREQ,
    .transmission_type = 0,
    .device_type = 0,
    .device_number = 0x00, // Wildcard
    .channel_period = 0x00, // Not used, since this is going to be scanning
    .network_number = ANTPLUS_NETWORK_NUMBER,
    };

    err_code = ant_channel_init(&channel_config);
    APP_ERROR_CHECK(err_code);

    err_code = sd_ant_channel_assign(0,
    CHANNEL_TYPE_SLAVE,
    ANTPLUS_NETWORK_NUMBER,
    0x00);

    err_code = sd_ant_network_address_set(ANTPLUS_NETWORK_NUMBER, m_network_key);
    APP_ERROR_CHECK(err_code);


    err_code = sd_ant_lib_config_set(ANT_LIB_CONFIG_MESG_OUT_INC_RSSI
    | ANT_LIB_CONFIG_MESG_OUT_INC_DEVICE_ID);
    APP_ERROR_CHECK(err_code);

    const ant_search_config_t bs_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_code = ant_search_init(&bs_search_config);
    APP_ERROR_CHECK(err_code);.

    I use ant_search_init().There's something wrong with the bluetooth radio.Work at least 14 or above

    ,the ant background must impacted bluetooth radio.Can you give it a try?thank you very much.

Reply
  • hi,Kebbeth ,this problem continues.this is my  ant config.

    err_code = sd_ant_stack_reset();
    APP_ERROR_CHECK(err_code);
    err_code = ant_stack_static_config();
    APP_ERROR_CHECK(err_code);



    // Set Network Address.
    pa_lna_assist(TXEN_RFPA,RXEN_RFPA);

    ant_channel_config_t channel_config =
    {
    .channel_number = 0,
    .channel_type = CHANNEL_TYPE_SLAVE,
    .ext_assign = 0x00,
    .rf_freq = ANTPLUS_RF_FREQ,
    .transmission_type = 0,
    .device_type = 0,
    .device_number = 0x00, // Wildcard
    .channel_period = 0x00, // Not used, since this is going to be scanning
    .network_number = ANTPLUS_NETWORK_NUMBER,
    };

    err_code = ant_channel_init(&channel_config);
    APP_ERROR_CHECK(err_code);

    err_code = sd_ant_channel_assign(0,
    CHANNEL_TYPE_SLAVE,
    ANTPLUS_NETWORK_NUMBER,
    0x00);

    err_code = sd_ant_network_address_set(ANTPLUS_NETWORK_NUMBER, m_network_key);
    APP_ERROR_CHECK(err_code);


    err_code = sd_ant_lib_config_set(ANT_LIB_CONFIG_MESG_OUT_INC_RSSI
    | ANT_LIB_CONFIG_MESG_OUT_INC_DEVICE_ID);
    APP_ERROR_CHECK(err_code);

    const ant_search_config_t bs_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_code = ant_search_init(&bs_search_config);
    APP_ERROR_CHECK(err_code);.

    I use ant_search_init().There's something wrong with the bluetooth radio.Work at least 14 or above

    ,the ant background must impacted bluetooth radio.Can you give it a try?thank you very much.

Children
  • Hello again,

    Can you try the following:

    1. First read in current coex configuration using sd_ant_coex_config_get(). This way you only need to alter configurations for the ones that you are interested in and leave default for everything else. Can ignore adv coex config for now by setting input parameter to NULL.

    ANT_BUFFER_PTR readCfg;
    uint8_t buffer[10];
    readCfg.ucBufferSize = 10;
    readCfg.pucBuffer = &buffer[0];
    error = sd_ant_coex_config_get(channel, &readCfg, NULL);
    Note: default configuration should read 0x0D,0x00,0x04,0x03,0x00,0x3A,0x00,0x3A,0x14,0x3C

    2. Disable the fixed search priority interval (bit 3 in Byte0 field).

    readCfg.pucBuffer[0] &= ~0x08; // disable fixed search hp interval priority config

    3. Write back configuration. Again, ignore advanced coex cfg by setting input parameter to NULL

    error = sd_ant_coex_config_set(channel, &readCfg, NULL);

    4. Byte 0 should be 0x05 (instead of previous value 0x0D) if the configuration is now read back using sd_ant_coex_config_get(..).

    Best regards,
    Kenneth

  • hello!yesterday, i use yours sdk14.2 demo have same problem.today ,I'll try it your way.Thank you very much!

  • This method has no effect.i try your method,but problems remain.

  • On the nrf SoftDevice, normally ANT and BLE share the same priority such that whoever schedules the slot first will normally take it.

    Note: BLE advertisement is not truly periodic (according to spec there is a 0-10ms random delay between each advertisement) and may occasionally collide with ANT scheduled activities. 

    Since the previous suggestions using sd_ant_coex_config_get() does not help, you may instead need to adjust the BLE advertisement interval so that it is not synchronous with ANT activities and use the default coexistence configuration.  

    Given that there is some random delay for the advertisement intervals involved, it may not be possible to guarantee perfect periodic transmissions from BLE all the time, and some pre-emption may be necessary to prevent starving the ANT stack completely.  It may seem you will need to some experimentation to figure out the best configuration combination of ANT and BLE to achieve what you need. 

    Some questions:

    What is the BLE advertisement interval you are using here?

    We are not clear what “frequency changed to 2.5s once” means.  All BLE advertisements after this point are transmitted every 2.5 s?  Or  for one instance only the interval between two BLE advertisements was 2.5 s, and then went back to its expected period? 

    Best regards,
    Kenneth

  • hi,Kebbeth

    init.config.ble_adv_slow_interval = 400;
    init.config.ble_adv_slow_timeout = 10;

    this my config.All BLE advertisements after this point are transmitted every 2.5 s? sorry ,my english is very poor. Some questions are not well expressed.the app "nrf connect"  show my device Radio once every 2500ms .but my frequency is 250ms.and in my debug,Bluetooth radio parameters are normal.

Related