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

52832 central multilink address filter not working on DIY HW

Hi,

I'm working on a multilink central device with SDK16, nRF52832.

I'm trying to connect the central to 2 peripherals with certain address. So I added 2 address filters in scan_init:

//BLE_NUS_C_DEF(m_ble_nus_c);                                             /**< BLE Nordic UART Service (NUS) client instance. */
BLE_NUS_C_ARRAY_DEF(m_ble_nus_c, NRF_SDH_BLE_CENTRAL_LINK_COUNT);  
NRF_BLE_GATT_DEF(m_gatt);                                               /**< GATT module instance. */

//BLE_DB_DISCOVERY_DEF(m_db_disc);                                        /**< Database discovery module instance. */
BLE_DB_DISCOVERY_ARRAY_DEF(m_db_disc, NRF_SDH_BLE_CENTRAL_LINK_COUNT);
NRF_BLE_SCAN_DEF(m_scan);                                               /**< Scanning Module instance. */
NRF_BLE_GQ_DEF(m_ble_gatt_queue,                                        /**< BLE GATT Queue instance. */
               NRF_SDH_BLE_CENTRAL_LINK_COUNT,
               NRF_BLE_GQ_QUEUE_SIZE);
static uint16_t m_ble_nus_max_data_len = BLE_GATT_ATT_MTU_DEFAULT - OPCODE_LENGTH - HANDLE_LENGTH; /**< Maximum length of data (in bytes) that can be transmitted to the peer by the Nordic UART service module. */


//b859decbd6fa
static uint8_t m_peripheral_addr1[6] = {0xb8, 0x59, 0xde, 0xcb, 0xd6, 0xfa};

//6a637c7022e1
static uint8_t m_peripheral_addr2[6] = {0x6a, 0x63, 0x7c, 0x70, 0x22, 0xe1};

/**@brief Function for initializing the scanning and setting the filters.
 */
static void scan_init(void)
{
    ret_code_t          err_code;
    nrf_ble_scan_init_t init_scan;

    memset(&init_scan, 0, sizeof(init_scan));

    init_scan.connect_if_match = true; 
    init_scan.conn_cfg_tag     = APP_BLE_CONN_CFG_TAG;

    err_code = nrf_ble_scan_init(&m_scan, &init_scan, scan_evt_handler);
    APP_ERROR_CHECK(err_code);

	err_code = nrf_ble_scan_filter_set(&m_scan, SCAN_ADDR_FILTER, m_peripheral_addr1);
	APP_ERROR_CHECK(err_code);
	err_code = nrf_ble_scan_filter_set(&m_scan, SCAN_ADDR_FILTER, m_peripheral_addr2);
	APP_ERROR_CHECK(err_code);
	err_code = nrf_ble_scan_filters_enable(&m_scan, NRF_BLE_SCAN_ADDR_FILTER, false);
  APP_ERROR_CHECK(err_code);
	
	
//    err_code = nrf_ble_scan_filter_set(&m_scan, SCAN_UUID_FILTER, &m_nus_uuid);

//    err_code = nrf_ble_scan_filters_enable(&m_scan, NRF_BLE_SCAN_UUID_FILTER, false);
//    APP_ERROR_CHECK(err_code);
}

NRF_BLE_SCAN_ADDRESS_CNT is set to 2;

CENTRAL_LINK_CNT and TOTAL_LINK_CNT is set to 2;

The software works as expected on 10040 DK, it could connect 2 peripherals with target address only.

But when I was trying to migrate the program to a DIY HW, the address filter seems disabled.

Did I make it work coincidentally on DK? Did I miss any configuration?

Thanks!

  • Hi

    The most common problem when something is running on a DK but not on a custom board is that the project is configured to use the external 32.768kHz LF clock, which a lot of modules and custom boards does not include, as it is optional. Our example projects enable the XTAL LF clock by default, but the steps to enable the external RC oscillator instead is rather simple. Edit the following defines to these values in your sdk_config.h file, and you should be good to go.

    // <h> Clock - SoftDevice clock configuration
    
    //==========================================================
    // <o> NRF_SDH_CLOCK_LF_SRC  - SoftDevice clock source.
     
    // <0=> NRF_CLOCK_LF_SRC_RC 
    // <1=> NRF_CLOCK_LF_SRC_XTAL 
    // <2=> NRF_CLOCK_LF_SRC_SYNTH 
    
    #ifndef NRF_SDH_CLOCK_LF_SRC
    #define NRF_SDH_CLOCK_LF_SRC 0
    #endif
    
    // <o> NRF_SDH_CLOCK_LF_RC_CTIV - SoftDevice calibration timer interval. 
    #ifndef NRF_SDH_CLOCK_LF_RC_CTIV
    #define NRF_SDH_CLOCK_LF_RC_CTIV 16
    #endif
    
    // <o> NRF_SDH_CLOCK_LF_RC_TEMP_CTIV - SoftDevice calibration timer interval under constant temperature. 
    // <i> How often (in number of calibration intervals) the RC oscillator shall be calibrated
    // <i>  if the temperature has not changed.
    
    #ifndef NRF_SDH_CLOCK_LF_RC_TEMP_CTIV
    #define NRF_SDH_CLOCK_LF_RC_TEMP_CTIV 2
    #endif
    
    // <o> NRF_SDH_CLOCK_LF_ACCURACY  - External clock accuracy used in the LL to compute timing.
     
    // <0=> NRF_CLOCK_LF_ACCURACY_250_PPM 
    // <1=> NRF_CLOCK_LF_ACCURACY_500_PPM 
    // <2=> NRF_CLOCK_LF_ACCURACY_150_PPM 
    // <3=> NRF_CLOCK_LF_ACCURACY_100_PPM 
    // <4=> NRF_CLOCK_LF_ACCURACY_75_PPM 
    // <5=> NRF_CLOCK_LF_ACCURACY_50_PPM 
    // <6=> NRF_CLOCK_LF_ACCURACY_30_PPM 
    // <7=> NRF_CLOCK_LF_ACCURACY_20_PPM 
    // <8=> NRF_CLOCK_LF_ACCURACY_10_PPM 
    // <9=> NRF_CLOCK_LF_ACCURACY_5_PPM 
    // <10=> NRF_CLOCK_LF_ACCURACY_2_PPM 
    // <11=> NRF_CLOCK_LF_ACCURACY_1_PPM 
    
    #ifndef NRF_SDH_CLOCK_LF_ACCURACY
    #define NRF_SDH_CLOCK_LF_ACCURACY 1
    #endif

    Best regards,

    Simon

  • Thanks Simonr,

    Sorry about the confusion.

    My LF clock config was exactally the same with your recommendation. The DIY board could connect to two peripherals at the same time. But the problem is that central will connect with first two peripherals dicovered with any address, seems that the address filter is not working. 

    Same code runs well on DK.

    This problem is kinda weird, any other configuration that might be the cause? My DK is the minimum system circuit of 52832.

    Thanks!

  • Hi Simonr,

    Additonally, I modified clock driver to RC:

     

    // <e> NRFX_CLOCK_ENABLED - nrfx_clock - CLOCK peripheral driver
    //==========================================================
    #ifndef NRFX_CLOCK_ENABLED
    #define NRFX_CLOCK_ENABLED 1
    #endif
    // <o> NRFX_CLOCK_CONFIG_LF_SRC  - LF Clock Source
     
    // <0=> RC 
    // <1=> XTAL 
    // <2=> Synth 
    // <131073=> External Low Swing 
    // <196609=> External Full Swing 
    
    #ifndef NRFX_CLOCK_CONFIG_LF_SRC
    #define NRFX_CLOCK_CONFIG_LF_SRC 0
    #endif
    
    // <o> NRFX_CLOCK_CONFIG_IRQ_PRIORITY  - Interrupt priority
     
    // <0=> 0 (highest) 
    // <1=> 1 
    // <2=> 2 
    // <3=> 3 
    // <4=> 4 
    // <5=> 5 
    // <6=> 6 
    // <7=> 7 
    
    #ifndef NRFX_CLOCK_CONFIG_IRQ_PRIORITY
    #define NRFX_CLOCK_CONFIG_IRQ_PRIORITY 6
    #endif

    // <e> NRF_CLOCK_ENABLED - nrf_drv_clock - CLOCK peripheral driver - legacy layer
    //==========================================================
    #ifndef NRF_CLOCK_ENABLED
    #define NRF_CLOCK_ENABLED 1
    #endif
    // <o> CLOCK_CONFIG_LF_SRC  - LF Clock Source
     
    // <0=> RC 
    // <1=> XTAL 
    // <2=> Synth 
    // <131073=> External Low Swing 
    // <196609=> External Full Swing 
    
    #ifndef CLOCK_CONFIG_LF_SRC
    #define CLOCK_CONFIG_LF_SRC 0
    #endif
    
    // <q> CLOCK_CONFIG_LF_CAL_ENABLED  - Calibration enable for LF Clock Source
     
    
    #ifndef CLOCK_CONFIG_LF_CAL_ENABLED
    #define CLOCK_CONFIG_LF_CAL_ENABLED 0
    #endif
    
    // <o> CLOCK_CONFIG_IRQ_PRIORITY  - Interrupt priority
     
    
    // <i> Priorities 0,2 (nRF51) and 0,1,4,5 (nRF52) are reserved for SoftDevice
    // <0=> 0 (highest) 
    // <1=> 1 
    // <2=> 2 
    // <3=> 3 
    // <4=> 4 
    // <5=> 5 
    // <6=> 6 
    // <7=> 7 
    
    #ifndef CLOCK_CONFIG_IRQ_PRIORITY
    #define CLOCK_CONFIG_IRQ_PRIORITY 6
    #endif

    I didn't see you mention this part, so maybe I need to remain these settings XTAL? Is it the cause of filter failure?

    Thanks

  • Hi

    The reason I didn't mention these defines is because the SoftDevice-defines will outprioritize the NRF_CLOCK defines. These are used to configure the LF clock in applications not using the SoftDevice.

    Then I guess it is something else. It seems very strange that the address filter won't work as intended on your custom board, and I don't have any guesses as to what might be causing this. Can you upload the schematics of your custom board so we can do a review to make sure that the HW is fine before we move to the SW, because as the SW works on the DK it indicates a HW issue on the custom board.

    Best regards,

    Simon

  • Hi Simonr,

    Thanks for your explanation!

    Here are some updates:

    I retried it today and the filter seems working. I've modified several places so I'm not quite sure which part cause the function failure.

    Perhaps I forgot to disable the UUID filter...

Related