This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
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

Sending notification every 100msec in s130

Hi, i am trying to send my notify characteristic every 100 msec, i am using timer for this and when i am connecting to the nrf app, my nordic device is sending the data but after 25-30 sec it is stop transmitting data and disconnect with the "Error8:GATT CONN TIMEOUT". I tried to use the BLE_EVT_TX_COMPLETE event but it still the same. Here some parts of my code:

static void timer_timeout_handler(void * p_context)
{
	uint32_t err_code;
	if (m_conn_handle != BLE_CONN_HANDLE_INVALID)
	{
		if(*flag == 1)
		{
			err_code = char_update(&m_service,(uint8_t *)&acc);
			if(err_code == BLE_ERROR_NO_TX_PACKETS)
			{
				*flag = 0;
			}
		}
	}
}

uint32_t char_update(ble_os_t *p_service, uint8_t *data)
{
	ble_gatts_hvx_params_t params;    
	memset(&params, 0, sizeof(params));
	params.type = BLE_GATT_HVX_NOTIFICATION;
	params.handle = p_seebo->characteristics[seebo_char].char_handle.value_handle;
	params.type   = BLE_GATT_HVX_NOTIFICATION;
	params.offset = 0;
	params.p_len = &length;	
	params.p_data = data;
	sd_ble_gatts_hvx(p_seebo->conn_handle, &params);
}


static void on_ble_evt(ble_evt_t * p_ble_evt)
{
	uint32_t err_code;

	switch (p_ble_evt->header.evt_id)
	{
		.
		.
		.
		case BLE_EVT_TX_COMPLETE:	
			*flag = 1;
		break;
		default:
			// No implementation needed.
			break;
	}
}

Can you please advise me what to do. Thank you.

  • can you please tell me the disconnect reason you got when you got the disconnected event. You will get it in the event like this

    p_ble_evt->evt.gap_evt.params.disconnected.reason.
    

    I do not think that the connections gets disconnected because of no tx buffers being there to transmit. And the way you are handling TX buffers is acceptable.

  • The problem is there is no disconnected event at all, the app is disconnected and the device still think that it is connected, so i do not get the disconnected event. I've noticed it's disconnected randomly and have nothing to have with the transmitting.

  • which nrf app are you talking about? If you see that the app thinks it is disconnected, then it must have initiated the disconnect procedure. Is your working environment RF noisy? if so then the disconnect request might have got lost and the device is getting timeout. But it must be GAP timeout not GATT.

  • Thanks for your response, i have found my stupid mistake.

Related