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

NRF51 error, the processor is reset after a time with ble

Hello,

I'll explain my code:

NRF51 takes samples of a sensor every 10 minutes. In addition, softdevice S110 is used... An user can connect at any time, so advertising is used all the time.

When I leave the device for hours, i can't connect to device, an error occurs and NRF51 is reset.

Any help?

My configuration:

#define APP_ADV_INTERVAL                        180  
#define APP_ADV_TIMEOUT_IN_SECONDS      0

#define APP_TIMER_PRESCALER             0
#define APP_TIMER_MAX_TIMERS           (16 + BSP_APP_TIMERS_NUMBER)
#define APP_TIMER_OP_QUEUE_SIZE      8                                           

#define MIN_CONN_INTERVAL               MSEC_TO_UNITS(20, UNIT_1_25_MS)
#define MAX_CONN_INTERVAL              MSEC_TO_UNITS(75, UNIT_1_25_MS)

#define SLAVE_LATENCY                   0                                          
#define CONN_SUP_TIMEOUT            MSEC_TO_UNITS(6000, UNIT_10_MS)
#define FIRST_CONN_PARAMS_UPDATE_DELAY  APP_TIMER_TICKS(5000, APP_TIMER_PRESCALER)  
#define NEXT_CONN_PARAMS_UPDATE_DELAY  APP_TIMER_TICKS(30000, APP_TIMER_PRESCALER)
#define MAX_CONN_PARAMS_UPDATE_COUNT    3

And mi advertising_init function:

static void advertising_init(void){
uint32_t      err_code;
ble_advdata_t advdata;
ble_advdata_t scanrsp;

// Build advertising data struct to pass into @ref ble_advertising_init.
memset(&advdata, 0, sizeof(advdata));
advdata.name_type          = BLE_ADVDATA_FULL_NAME;
advdata.include_appearance = false;
advdata.flags              = BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE;

memset(&scanrsp, 0, sizeof(scanrsp));
scanrsp.uuids_complete.uuid_cnt = sizeof(m_adv_uuids) / sizeof(m_adv_uuids[0]);
scanrsp.uuids_complete.p_uuids  = m_adv_uuids;

ble_adv_modes_config_t options = {0};
options.ble_adv_fast_enabled  = BLE_ADV_FAST_ENABLED;
options.ble_adv_fast_interval = APP_ADV_INTERVAL;
options.ble_adv_fast_timeout  = APP_ADV_TIMEOUT_IN_SECONDS;

err_code = ble_advertising_init(&advdata, &scanrsp, &options, NULL, NULL);
APP_ERROR_CHECK(err_code);
}

Thanks in advance.

Parents
  • I think yes, look at that:

    __WEAK void app_error_handler(uint32_t error_code, uint32_t line_num, const uint8_t * p_file_name)
    {
        // On assert, the system can only recover with a reset.
    #ifndef DEBUG
        NVIC_SystemReset();
    #else
    
    #ifdef BSP_DEFINES_ONLY 
        LEDS_ON(LEDS_MASK);
    #else
        UNUSED_VARIABLE(bsp_indication_set(BSP_INDICATE_FATAL_ERROR));
        // This call can be used for debug purposes during application development.
        // @note CAUTION: Activating this code will write the stack to flash on an error.
        //                This function should NOT be used in a final product.
        //                It is intended STRICTLY for development/debugging purposes.
        //                The flash write will happen EVEN if the radio is active, thus interrupting
        //                any communication.
        //                Use with care. Uncomment the line below to use.
        //ble_debug_assert_handler(error_code, line_num, p_file_name);
    #endif // BSP_DEFINES_ONLY
    
        // The following variable helps Keil keep the call stack visible, in addition, it can be set to
        // 0 in the debugger to continue executing code after the error check.
        volatile bool loop = true;
        UNUSED_VARIABLE(loop);
    
        m_error_code = error_code;
        m_line_num = line_num;
        m_p_file_name = p_file_name;
    
        UNUSED_VARIABLE(m_error_code);
        UNUSED_VARIABLE(m_line_num);
        UNUSED_VARIABLE(m_p_file_name);
        __disable_irq();
    
        while(loop);
    #endif // DEBUG
    }
    /*lint -restore */
    

    APP_ADV_TIMEOUT_IN_SECONDS = 0, unlimited, because I need connect at any time. This device should be works several months.

Reply
  • I think yes, look at that:

    __WEAK void app_error_handler(uint32_t error_code, uint32_t line_num, const uint8_t * p_file_name)
    {
        // On assert, the system can only recover with a reset.
    #ifndef DEBUG
        NVIC_SystemReset();
    #else
    
    #ifdef BSP_DEFINES_ONLY 
        LEDS_ON(LEDS_MASK);
    #else
        UNUSED_VARIABLE(bsp_indication_set(BSP_INDICATE_FATAL_ERROR));
        // This call can be used for debug purposes during application development.
        // @note CAUTION: Activating this code will write the stack to flash on an error.
        //                This function should NOT be used in a final product.
        //                It is intended STRICTLY for development/debugging purposes.
        //                The flash write will happen EVEN if the radio is active, thus interrupting
        //                any communication.
        //                Use with care. Uncomment the line below to use.
        //ble_debug_assert_handler(error_code, line_num, p_file_name);
    #endif // BSP_DEFINES_ONLY
    
        // The following variable helps Keil keep the call stack visible, in addition, it can be set to
        // 0 in the debugger to continue executing code after the error check.
        volatile bool loop = true;
        UNUSED_VARIABLE(loop);
    
        m_error_code = error_code;
        m_line_num = line_num;
        m_p_file_name = p_file_name;
    
        UNUSED_VARIABLE(m_error_code);
        UNUSED_VARIABLE(m_line_num);
        UNUSED_VARIABLE(m_p_file_name);
        __disable_irq();
    
        while(loop);
    #endif // DEBUG
    }
    /*lint -restore */
    

    APP_ADV_TIMEOUT_IN_SECONDS = 0, unlimited, because I need connect at any time. This device should be works several months.

Children
No Data
Related