cancel
Showing results for 
Search instead for 
Did you mean: 

BLueNRG-MS LE stack: Cannot set properly connection interval MIN/MAX values

romain.herouard
Associate II

Hello,

I am using the BlueNRG LE stack to set my BLueNRG-MS device discoverable to Android app on smartphone/tablet.

I am using the aci_gap_set_discoverable function from LE stack with following parameter:

#ifdef _DEBUG
	USART_printf("*** Setting discoverable mode ***");
	USART_printf("Adv MIN = %d ms", (CONFIG_global_configuration.min_advertising_interval*625)/1000);
	USART_printf("Adv MAX = %d ms", (CONFIG_global_configuration.max_advertising_interval*625)/1000);
	USART_printf("Conn MIN = %d ms", (CONFIG_global_configuration.min_connection_interval*1250)/1000);
	USART_printf("Conn MAX = %d ms", (CONFIG_global_configuration.max_connection_interval*1250)/1000);
#endif
 
	/* set the device in general discoverable mode */
	ret = aci_gap_set_discoverable(
			ADV_IND,
			CONFIG_global_configuration.min_advertising_interval,
			CONFIG_global_configuration.max_advertising_interval,
			PUBLIC_ADDR,
			NO_WHITE_LIST_USE,
			strlen(bluetooth_device_name) + 1,
			local_name,
			0,
			NULL,
			CONFIG_global_configuration.min_connection_interval,
			CONFIG_global_configuration.max_connection_interval
			);

where:

	Adv MIN = 500 ms
	Adv MAX = 1000 ms
	Conn MIN = 12 ms
	Conn MAX = 25 ms

I have also instrumented the EVT_LE_CONN_COMPLETE and EVT_LE_CONN_UPDATE_COMPLETE events to get more information at connection establishment:

	case EVT_LE_CONN_COMPLETE:	/* BlueNRG connection event */
	{
		/* connection complete event: get the related data */
		evt_le_connection_complete *cc = (void *)evt->data;
		connection_handle = cc->handle;
 
#ifdef _DEBUG
		USART_printf("*** Connection complete ***");
		USART_printf("Connection status = %d", cc->status);
		USART_printf("Connection handle = %d", cc->handle);
		USART_printf("Connection interval = %d", cc->interval);
		USART_printf("Connection latency = %d", cc->latency);
#endif
	}
	break;
 
case EVT_LE_CONN_UPDATE_COMPLETE:	/* BlueNRG connection update event */
	{
		/* connection complete event: get the related data */
		evt_le_connection_update_complete *cuc = (void *)evt->data;
		connection_handle = cuc->handle;
 
#ifdef _DEBUG
		USART_printf("*** Connection update complete ***");
		USART_printf("Connection status = %d", cuc->status);
		USART_printf("Connection handle = %d", cuc->handle);
		USART_printf("Connection interval = %d", cuc->interval);
		USART_printf("Connection latency = %d", cuc->latency);
#endif
	}
	break;

Then while connecting to device with application, I get the following log:

14:28:00: *** Connection complete ***
Connection status = 0
Connection handle = 2049
Connection interval = 39
Connection latency = 0
*** Connection update complete ***
Connection status = 0
Connection handle = 2049
Connection interval = 6
Connection latency = 0
14:28:01: *** Connection update complete ***
Connection status = 0
Connection handle = 2049
Connection interval = 39
Connection latency = 0

I am not trying to update the connection at startup, so can you indicate me if there is a reason 3 events are logged, with the connection interval parameters out of specified MIN/MAX range ??

Thank you in advance,

Regards

R

0 REPLIES 0