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

Writing to peripheral ( 0 packets sent)

Hi,

i'm using s130 central/peripheral. I want to send data from my central nrf51822 to my peripheral nrf51822.

I declare write function like this:

static void writeChar (uint16_t peripheral_id,uint8_t *zelVrednost)
{
    uint32_t                 error_code   = NRF_ERROR_NOT_FOUND;
    ble_gattc_write_params_t write_params = {0};


	LOG_INFO("CHAR HANDLE WRITE: 0x%04x",gs_peripheral2[peripheral_id2].value_handle);
	LOG_INFO("VREDNOST: 0x%04x",*zelVrednost);

	write_params.write_op = BLE_GATT_OP_WRITE_CMD;
	write_params.handle = gs_peripheral2[peripheral_id2].value_handle;
	write_params.offset = 0x0000;
	write_params.len = sizeof(zelVrednost);
	write_params.p_value = zelVrednost;
	LOG_DEBUG("Length: 0x%02x\r\n", sizeof(write_params));
	LOG_DEBUG("vrednost: 0x%02x\r\n", *write_params.p_value);
	if ((error_code = sd_ble_gattc_write(gs_peripheral2[peripheral_id2].conn_handle, &write_params)) != NRF_SUCCESS)
	{
		LOG_DEBUG("(Peripheral %i) Napaka karakteristike:: 0x%x", peripheral_id, error_code);
	}
	else
	{
		LOG_DEBUG("Success");
	}
}

Using BLE_GATT_OP_WRITE_CMD calls for event BLE_EVT_TX_COMPLETE. After checking the number of packets sent in this event, i get 0. Note that i can write on my peripheral with my smartphone just fine, but not using central nrf51822. Why doesn't my central send any packets?

Parents Reply Children
No Data
Related