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

Rebond to reconnected device will not communicate

Default startup:

Using ble_multi_lesc as my default project

Log of original connection is in attached logLOTest.txt file

Currently only 1 nrfConnect is connected and 1 peripheral is connected.

After the first power on and bring up state I can pair/bond and communicate with the peripheral device.

I power cycle the peripheral device

That attached file is the LOcommandNoWork.txt file

The sd_ble_gatts_hvx send function is in testSend.txt attachment

Although the peripheral rebonds and sends the service changed indication the device will not communicate

The log shows that the

app: PERIPHERAL : C PM_EVT_BONDED_PEER_CONNECTED: peer_id=0
app: PM_EVT_SERVICE_CHANGED_IND_SENT

Since LESC is working I can not sniff the packets to see what may be missing

Please advise me as to what I may be missing.

Thanks in advance.

<warning> app: adv_scan_start:261 SCAN
<info> app: Scanning
<error> app: Fast advertising.
<info> app: Advertising
<error> app: NAME_FOUND
<error> app: UUID_FOUND
<warning> app: on_adv_report LK_CON_ACTIVE 1
<warning> app: gdo_set_conn_handle:768
<info> app: PERIPHERAL : C PM_EVT_BONDED_PEER_CONNECTED: peer_id=0
<error> app: PM_EVT_SERVICE_CHANGED_IND_SENT
<warning> app: Hdl 0 5438
<warning> app: GATT ATT MTU on connection 0x0 changed to 247.
<warning> app: GATT ATT MTU on connection 0x0 changed to 247.
<warning> app: Hdl 3 7289
<info> app: PERIPHERAL: Connected, handle 3.
<warning> app: on_ble_peripheral_evt:901 SCAN
<warning> app: adv_scan_start:261 SCAN
<info> app: Scanning
<error> app: Fast advertising.
<info> app: Advertising
<warning> app: GATT ATT MTU on connection 0x3 changed to 251.
<info> app: NEW MTU 248
<warning> app: K2 3A

Light on command

warning> app: aC 0x2000C1D8 I 0x2000C1D8
<warning> app: PHONE RX MSG 1 0 0
<warning> app: 0 LKIDX CHDL 0
<info> app: 43
<info> app: 4D
<info> app: 0
<info> app: 4C
<info> app: 4F
<info> app: 44
<info> app: 4D
<info> app: 64
<info> app: svc_2000_send:489
<info> app: pop m_tx_phone_queue 81 pbuf 0x2000C1D8
<info> app: svc_2000_send:497 idx 0
<info> app: svc_2000_send:507
<info> app: MTU OUT 248
<info> app: svc_2000_actual_send:417
<info> app: svc_2000_actual_send:426
<error> app: S 0
<warning> app: fC 0x2000C1D8 I 0x00000000
<info> app: svc_2000_send:516
<warning> app: PHONE TX CMP
<warning> app: WR RSP
ret_code_t svc_2000_actual_send(sUartBufDesc_t * p_bd)
{
	ret_code_t		err_code = NRF_ERROR_INVALID_STATE;
	int32_t index = get_svc_2000_connection_index(p_bd->conn_handle);
	if (-1 != index)
	{
		NRF_LOG_INFO("MTU OUT %d", p_svc_2000->conn_index[index].max_svc_len);
		/*	--------------------------------------------------------------
		 **	At this point the all info for the msg is loaded
		 **	If the msg length is greater than the MTU then we just load up
		 **	the size of the mtu and keep track of the offset.
		 **	we continue to load bytes and call the send again until we get
		 ** 	NRF_ERROR_RESOURCES:	The internal send queue is full
		 **	then wait for the BLE_GATTS_EVT_HVN_TX_COMPLETE to send the
		 **	next round until the msg is completely sent
		 **	--------------------------------------------------------------
		 */
		uint16_t    msg_offset      = 0;
		uint16_t    total_length    = p_bd->length;

		memset(p_encoded_buffer, 0, JS_APP_SCRATCH_BUFFER_SIZE);

		ble_gatts_hvx_params_t	write_params =
		{
				.type 	= BLE_GATT_HVX_NOTIFICATION,
				.handle	= p_svc_2000->control_handle.value_handle,
				.offset	= msg_offset,
				.p_len	= (uint16_t *)&total_length
		};

		jackshaft_encode(p_bd->p_buffer, p_encoded_buffer, total_length);
		write_params.p_data = p_encoded_buffer;

		do
		{
// line 417			NRF_LOG_INFO("%s:%d", __FUNCTION__, __LINE__);
			if (true == svc2000_tx_complete)
			{
#if 0
				for (int32_t loop_counter = 0; loop_counter < total_length; loop_counter++)
				{
					NRF_LOG_ERROR("%X", write_params.p_data[loop_counter])
				}
#endif
// line 426					NRF_LOG_INFO("%s:%d", __FUNCTION__, __LINE__);
				err_code = sd_ble_gatts_hvx(p_svc_2000->conn_index[index].conn_handle, &write_params);
// line 428					NRF_LOG_ERROR("S %d", err_code);
				if (0 == err_code)
				{
					msg_offset		+= 20;
					err_code = NRF_SUCCESS;
				}
				else if (NRF_ERROR_RESOURCES == err_code)
				{
					svc2000_tx_complete = false;
					err_code = NRF_ERROR_INVALID_PARAM;
					break;
				}
			}
			else
			{
				break;
			}
			//					NRF_LOG_ERROR("PHONE TX %d %d %d", err_code, msg_offset, total_length);
		}
		while ((msg_offset <= total_length)
				&& ((NRF_ERROR_RESOURCES == err_code)
						|| (NRF_SUCCESS)));
	}

	if (IPC_RSP_BIT & p_bd->msg_type)
	{
//		NRF_LOG_WARNING("%s:%d JS_FREE", __FUNCTION__, __LINE__);
		js_free(p_bd);
	}

	return err_code;
}

<warning> app: adv_scan_start:261 SCAN
<info> app: Scanning
<error> app: Fast advertising.
<info> app: Advertising
<error> app: NAME_FOUND
<error> app: UUID_FOUND
<warning> app: on_adv_report LK_CON_ACTIVE 1
<warning> app: gdo_set_conn_handle:768
<warning> app: gdo_set_conn_handle:779 LK-5438ø
<warning> app: Hdl 0 5438
<info> app: CENTRAL: Searching for LK on conn_handle 0x0
<info> ble_db_disc: Starting discovery of service with UUID 0x7000 on connection handle 0x0.
<warning> app: GATT ATT MTU on connection 0x0 changed to 247.
<info> ble_db_disc: Starting discovery of service with UUID 0x7000 on connection handle 0x0.
<info> ble_db_disc: Found service UUID 0x7000.
<info> ble_db_disc: Found service UUID 0x0.
<info> ble_db_disc: Found service UUID 0x0.
<info> ble_db_disc: Discovery of service with UUID 0x7000 completed with success on connection handle 0x0.
<info> app: LK CON 0 CCCD 17 LK HNDL 16
<info> app: CENTRAL: initiate security
<info> app: cccd_configure:194 CCCD Enable
<info> app: type 1
<info> app: tx_buffer_process:141 1
<info> app: tx_buffer_process:141 1
<info> app: TXP 1
<info> ble_db_disc: Discovery of service with UUID 0x7000 completed with success on connection handle 0x0.
<info> app: LK CON 0 CCCD 17 LK HNDL 16
<info> app: CENTRAL: initiate security
<info> app: cccd_configure:194 CCCD Enable
<info> app: type 1
<info> app: tx_buffer_process:141 1
<info> app: tx_buffer_process:141 1
<info> app: TXP 2
<info> ble_db_disc: Discovery of service with UUID 0x7000 completed with success on connection handle 0x0.
<info> app: LK CON 0 CCCD 17 LK HNDL 16
<info> app: CENTRAL: initiate security
<info> app: cccd_configure:194 CCCD Enable
<info> app: type 1
<info> app: tx_buffer_process:141 1
<info> app: tx_buffer_process:141 1
<info> app: TXP 3
<info> app: PERIPHERAL: BLE_GAP_EVT_SEC_PARAMS_REQUEST
<warning> app: WR RSP
<info> app: type 1
<info> app: tx_buffer_process:141 1
<info> app: tx_buffer_process:141 1
<info> app: TXP 4
<info> app: PERIPHERAL: BLE_GAP_EVT_LESC_DHKEY_REQUEST
<warning> app: WR RSP
<info> app: type 1
<info> app: tx_buffer_process:141 1
<info> app: tx_buffer_process:141 1
<info> app: TXP 5
<warning> app: WR RSP
<info> app: type 0
<info> app: writeOp 1len 0
<info> app: PERIPHERAL : PM_EVT_CONN_SEC_SUCCEEDED conn_handle: 0, Procedure: 1
<warning> app: pm_evt_handler LK_CON_ACTIVE c 0 0
<info> app: gdo.c:832 LK 0 is SECURED
<warning> app: LK BOND HDL 0
<warning> app: BLE_GAP_EVT_AUTH_STATUS
<info> app: PERIPHERAL: BLE_GAP_EVT_AUTH_STATUS: status=0x0 bond=0x1 lv4: 0 kdist_own:0x3 kdist_peer:0x2
<info> app: PERIPHERAL: PM_EVT_PEER_DATA_UPDATE_SUCCEEDED: peer_id=0 data_id=0x7 action=0x0
<warning> app: pm_evt_handler LK_CON_ACTIVE 0
<info> app: gdo.c:832 LK 0 is SECURED
<warning> app: LK BOND HDL 0
<info> app: PERIPHERAL: PM_EVT_PEER_DATA_UPDATE_SUCCEEDED: peer_id=0 data_id=0x8 action=0x0
<warning> app: pm_evt_handler LK_CON_ACTIVE 0
<info> app: gdo.c:832 LK 0 is SECURED
<warning> app: LK BOND HDL 0

Light On command

<warning> app: aC 0x2000C1D8 I 0x2000C1D8
<warning> app: PHONE RX MSG 1 0 0
<warning> app: 0 LKIDX CHDL 0
<info> app: 43
<info> app: 4D
<info> app: 0
<info> app: 4C
<info> app: 4F
<info> app: 44
<info> app: 4D
<info> app: 64
<info> app: svc_2000_send:489
<info> app: pop m_tx_phone_queue 81 pbuf 0x2000C1D8
<info> app: svc_2000_send:497 idx 0
<info> app: svc_2000_send:507
<info> app: MTU OUT 248
<info> app: svc_2000_actual_send:417
<info> app: svc_2000_actual_send:426
<error> app: S 0
<warning> app: fC 0x2000C1D8 I 0x00000000
<info> app: svc_2000_send:516
<warning> app: PHONE TX CMP
<warning> app: TX CMPL
<warning> app: WR RSP

Parents Reply Children
No Data
Related