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

How could Nordic received large byte from phone

Hi there,

How could I receive a large data from phone, example 120 bytes from a characteristic. So far I was able to receive 20 bytes.

From the working code of 20 bytes, I modified it so that it would receive a maximum data of sizeof(uint8_t) and change the location from stack to user(BLE_GATTS_VLOC_USER) but its not working. It seems that i haven't receive anything from the BLE GATT WRITE EVENT.

If Characteristic wont able to received a large amount of data, will you please tell me on how to transfer a large amount of data to Nordic.

I am using S310 softdevice and nRF51422 chip. Thanks

below is my code.

static uint32_t add_char_command_type(ble_myplbs * p_lbs, const ble_lbs_init_t * p_lbs_init) { ble_gatts_char_md_t char_md; ble_gatts_attr_t attr_char_value; ble_uuid_t ble_uuid; ble_gatts_attr_md_t attr_md;

memset(&char_md, 0, sizeof(char_md));

char_md.p_char_user_desc = (uint8_t *)CHAR_NAME_COMMAND_TYPE;
char_md.char_user_desc_max_size = 12;
char_md.char_user_desc_size = 12;
	
char_md.char_props.read   = 1; 
char_md.char_props.write  = 1;
//char_md.p_char_user_desc  = NULL;
char_md.p_char_pf         = NULL;
char_md.p_user_desc_md    = NULL;
char_md.p_cccd_md         = NULL;
char_md.p_sccd_md         = NULL;

ble_uuid.type = p_lbs->uuid_type;
ble_uuid.uuid = SAL_UUID_CHAR_COMMAND_TYPE;

memset(&attr_md, 0, sizeof(attr_md));

BLE_GAP_CONN_SEC_MODE_SET_OPEN(&attr_md.read_perm);
BLE_GAP_CONN_SEC_MODE_SET_OPEN(&attr_md.write_perm);
attr_md.vloc       = BLE_GATTS_VLOC_USER; 
attr_md.rd_auth    = 0;
attr_md.wr_auth    = 0;
attr_md.vlen       = 0;

memset(&attr_char_value, 0, sizeof(attr_char_value));

attr_char_value.p_uuid       = &ble_uuid;
attr_char_value.p_attr_md    = &attr_md;
attr_char_value.init_len     = sizeof(uint8_t); 
attr_char_value.init_offs    = 0;
attr_char_value.max_len      = sizeof(uint8_t); 
attr_char_value.p_value      = ble_buffer_write; 

return sd_ble_gatts_characteristic_add(p_lbs->service_handle, &char_md,
                                           &attr_char_value,
                                           &p_lbs->command_type_char_handle);
Parents Reply
  • Hi Bjorn,

    Thanks for the reply.

    My problem now is on how to get the data from phone to nordic app. I am bit confused on the the message sequence chart.

    If I choose the BLE_GATTS_VLOC_USER, I can see any data on attr_char_value.p_value (I guest it would be there?), and if I choose the BLE_GATTS_VLOC_STACK where could I find the handle, offset and peer values. infocenter.nordicsemi.com/index.jsp

    I also tried to set the NULL and user memory block of sd_ble_user_mem_reply but still I am empty handed.

    Sorry for the confusion, I am still new on BLE development.

    Regards, -mc

Children
No Data
Related