This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

FIRST_CONN_PARAMS_UPDATE_DELAY error

Hello, 

I crated a custom peripheral for my application, I took the code from the Blinky example and i changed the service.

I set the FIRST_CONN_PARAMS_UPDATE_DELAY parameter like this : 

#define FIRST_CONN_PARAMS_UPDATE_DELAY	APP_TIMER_TICKS(20000)					/**< Time from initiating event (connect or start of notification) to first time sd_ble_gap_conn_param_update is called (20 seconds). */

And the MIN_CONN_INTERVAL and MIN_CONN_INTERVAL like this : 

#define MIN_CONN_INTERVAL				MSEC_TO_UNITS(200, UNIT_1_25_MS)			/**< Minimum acceptable connection interval (100 = 100 ms). */
#define MAX_CONN_INTERVAL				MSEC_TO_UNITS(300, UNIT_1_25_MS)		/**< Maximum acceptable connection interval (300 = 300 ms). */

After 20s i Expect the Conn interval to be around 300ms afer 20s in order to save power, unfortunately after 20s the code crash and i have no idea where, i put logs to where i belive is the crash but i don't see anything.

			case BLE_GAP_EVT_PHY_UPDATE_REQUEST:
			{
				NRF_LOG_INFO("BLE_GAP_EVT_PHY_UPDATE_REQUEST");
				ble_gap_phys_t const phys =
				{
					.rx_phys = BLE_GAP_PHY_AUTO,
					.tx_phys = BLE_GAP_PHY_AUTO,
				};
				err_code = sd_ble_gap_phy_update(p_ble_evt->evt.gap_evt.conn_handle, &phys);
				APP_ERROR_CHECK(err_code);
			} break;

static void on_conn_params_evt(ble_conn_params_evt_t * p_evt)
{
    ret_code_t err_code;

    if (p_evt->evt_type == BLE_CONN_PARAMS_EVT_FAILED)
    {
				NRF_LOG_INFO("ble conn params failed");
        err_code = sd_ble_gap_disconnect(p_evt->conn_handle, BLE_HCI_CONN_INTERVAL_UNACCEPTABLE);
        //APP_ERROR_CHECK(err_code);
    }
		else
		{
			NRF_LOG_INFO("BLE_CONN_PARAMS_EVT_SUCCESS");
		}
}

I tried with those parameters : 

#define MIN_CONN_INTERVAL				MSEC_TO_UNITS(200, UNIT_1_25_MS)			/**< Minimum acceptable connection interval (8 = 100 ms). */
#define MAX_CONN_INTERVAL				MSEC_TO_UNITS(300, UNIT_1_25_MS)		/**< Maximum acceptable connection interval (150 = 200 ms). */

And it works fine but i don't belive there is an PHY update.

On the other hand the bliky example works fine.

What did i do wrong ? For the central i used NRF connect on my phone and with the PC connected to a dev bloard.

Thank you

  • Hello, while cleaning the project and leaving just the BLE part everything if working fine... i'll reassemble everything step by step to see what I did wrong. I'll keep you posted, thank you again for all your help

  • Hello,

    I found the issue : 

    When i change the clock to use the external cristal i cqn't change the connection interval parameters : 

    here is my configuration

    // <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
    
    // </e>

    //==========================================================
    
    // <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 32
    #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
    
    // </h> 
    //==========================================================

    Maybe this messes up the softdevice and it reaches some kind of timeout

  • Hello,

    I can't see how this could be related to the original issue. Did you get the same hardfault in send_update_request() when you selected the crystal oscillator?

    And please note that NRF_SDH_CLOCK_LF_RC_CTIV should be equal or less than 16 when using the RC oscillator. Otherwise, the +/-500 ppm clock stability is not guaranteed.

  • Hello, i changed the NRF_SDH_CLOCK_LF_RC_CTIV 16 and on my custom hardware i still hardfault on send_update_request() but if I select the XTAL on the demo board it works fine. unfortunately i only have a external quartz on my hardware

  • conn_interval_clean.rar

    I sent you the modified BLE project with the error

Related