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

SD120 fails assertion while scanning

I have an application that uses the nRF51822 with SD110 version s110_nrf51822_7.0.0 as peripheral and the nRF51822 with SD120 version s120_nrf51822_1.0.0 as central.

I've run into an issue where the central device soft device calls the following asserting handler

/**@brief       Callback function for asserts in the SoftDevice.
 *
 * @details     A pointer to this function will be passed to the SoftDevice. This function will be
 *              called if an ASSERT statement in the SoftDevice fails.
 *
 * @param[in]   pc         The value of the program counter when the ASSERT call failed.
 * @param[in]   line_num   Line number of the failing ASSERT call.
 * @param[in]   file_name  File name of the failing ASSERT call.
 */
void softdevice_assertion_handler(uint32_t pc, uint16_t line_num, const uint8_t * file_name)
{
    UNUSED_PARAMETER(pc);
    assert_nrf_callback(line_num, file_name);
}

with parameters: pc: 73736, line_num: 1159, file_name: src\ll_dd_scan.c

This happens after a successful connection to the peer and after the central has been power-cycled. After a power cycle the central attempts to scan for a known peer using a whitelist with this function:

static void scan_start(void)
{
    uint32_t            err_code;
    ble_gap_whitelist_t whitelist;
    uint32_t            count;
    
    // Verify if there is any flash access pending, if yes delay starting scanning until 
    // it's complete.
    err_code = pstorage_access_status_get(&count);
    APP_ERROR_CHECK(err_code);
    if (count != 0)
    {
        m_memory_access_in_progress = true;
        return;
    }
        
    // Was Bond button pressed? 
    if (m_bond_button_pressed)
    {
        app_trace_log("Scanning for new peer\r\n");         
        m_bond_button_pressed = false;
        m_scan_param.selective = 0;
        m_scan_param.p_whitelist = NULL;
        m_scan_param.timeout = UNBONDED_SCAN_TIMEOUT;
    }
    else
    {
        // Attempt to create whitelist
        ble_gap_addr_t       *p_whitelist_addr[BLE_GAP_WHITELIST_ADDR_MAX_COUNT];
        ble_gap_irk_t        *p_whitelist_irk[BLE_GAP_WHITELIST_IRK_MAX_COUNT];
        
        whitelist.addr_count = BLE_GAP_WHITELIST_ADDR_MAX_COUNT;
        whitelist.irk_count  = BLE_GAP_WHITELIST_IRK_MAX_COUNT;
        whitelist.pp_addrs   = p_whitelist_addr;
        whitelist.pp_irks    = p_whitelist_irk;
        
        err_code = dm_whitelist_create(&m_dm_app_id, &whitelist);
        APP_ERROR_CHECK(err_code);

        if ((whitelist.addr_count != 0) || (whitelist.irk_count != 0))
        {
            app_trace_log("Scanning for bonded peer\r\n");       
            m_scan_param.selective = 1;            
            m_scan_param.p_whitelist = &whitelist;
            m_scan_param.timeout = BONDED_SCAN_TIMEOUT;
        }
        else
        {
            // No bond info available, we have no peer to advertise to so
            // we go into standby mode until we get power cycled or
            // the bond button press wake us up into a reset
            app_trace_log("Whitelist does not exist.  Waiting for button press\r\n");
            return;
        }
    }
    
    err_code = sd_ble_gap_scan_start(&m_scan_param);
    APP_ERROR_CHECK(err_code);
    
    nrf_gpio_pin_set(SCAN_LED_PIN_NO);
}

All softdevice calls are successful and after a seemingly random interval between 6-30 seconds later I get an assertion.

I'm looking for some help debugging this since I don't have source for the line failing assertion.

One interesting note, this does not happen when running this code on the PCA10001. It only happens on the module that I'm using.

Edit: 8/8/2014: This does not happen if the peripheral is not advertising. The value of addr_count = 0x01, irk_count=0x01 after the softdevice_assertion_handler() is called and hits a breakpoint.

m_scan_param:
active = 0x0,
selective = 0x1,
p_whitelist = 0x200028BC
interval = 0x0004,
window = 0x0004,
timeout = 0

Also possibly interesting is that the central app works fine on the PCA10001 that I have which uses an nRF51822-QFAAFA

I have the problem on my RFD22302 module which uses an nRF51822-QFAAC0.

Is this relevant?

Edit 8/10/2014: I just read the nWP-018_v1.3 document which includes an nRF51822 compatibility matrix. If I understand the matrix correctly, it appears that the QFAAC0 device is not compatible with the S120 softdevice. Is this correct?

  • Are you sure all members of m_scan_params are initialized?

    Would it be possible to read out the addr_count and irk_count variables when this happens?

    Which module are you using? Would it be possible to test this on other modules as well?

    Edit 2014-08-11:

    From your edits, it looks like you are trying to run the S120 SoftDevice on older hardware for which it is not supported. From the error that you see, it looks like the assert is due to this incompatibility. We highly recommend following the compatibility matrix in nWP-018.

Related