Not getting data in read command

⚠️
Hi there.. thanks for coming to the forums. Exciting news! we’re now in the process of moving to our new forum platform that will offer better functionality and is contained within the main Dialog website. All posts and accounts have been migrated. We’re now accepting traffic on the new forum only - please POST any new threads at//www.xmece.com/support. We’ll be fixing bugs / optimising the searching and tagging over the coming days.
10 posts / 0 new
Last post
rajan22
Offline
Last seen:1 year 4 months ago
加入:2017-12-29 05:09
Not getting data in read command

Hello Dialog,

Recently I started working with SDK 6.0.10, here I notice some issue.

In exampleble_app_peripheral,not getting data in read command whereas able to read data in notification command.

Thanks

Device:
PM_Dialog
Offline
Last seen:2 days 28 min ago
Staff
加入:2018-02-08 11:03
Hi rajan22,

Hi rajan22,

与我们的SKK高兴你开始工作6 and with DA14585 product, but can you please try to clarify your issue? It would be very helpful if you were able to provide more inputs about you issue.

Thanks, PM_Dialog

rajan22
Offline
Last seen:1 year 4 months ago
加入:2017-12-29 05:09
Hi,

Hi,

Testing ble_app_peripheral example by using SDK 6.0.10.511 with DA14586.

Step 1. Debug the ble_app_peripheral program

Step 2. Connected to BLG-PRPH

Step 3. In Primary service DEF_SVC1_UUID_128 written 0x01 form characteristic DEF_SVC1_CTRL_POINT_UUID_128

Step 4. Reading data by notification command form characteristic DEF_SVC1_ADC_VAL_1_UUID_128 and getting counter data (dummy ADC data) successfully, as default with the program.

Step 5. Trying to read data by reading command form characteristic DEF_SVC1_ADC_VAL_1_UUID_128 but not getting data as aspected as getting data in SDK 6.0.4.

我们开始我们的新产品和新的SDK with version 6.0.10.511.

Why we unable to get data in reading command.

In our application, using read command to get sensor info and using notify command for reading sensor data. This is why we need to read and notification both commands.

Thanks

rajan22
Offline
Last seen:1 year 4 months ago
加入:2017-12-29 05:09
Some more details,

Some more details,

As per the application implemented

First, we need to enable from the control point then user_custs1_ctrl_wr_ind_handler will be called and it will start the timer and timer event app_adcval1_timer_cb_handler will keep sending data to the kernel whether we are reading data or not and continuing until disabled by the control point.

void app_adcval1_timer_cb_handler() { struct custs1_val_ntf_ind_req *req = KE_MSG_ALLOC_DYN(CUSTS1_VAL_NTF_REQ, prf_get_task_from_id(TASK_ID_CUSTS1), TASK_APP, custs1_val_ntf_ind_req, DEF_CUST1_ADC_VAL_1_CHAR_LEN); // ADC value to be sampled static uint16_t sample; sample = (sample <= 0xffff) ? (sample + 1) : 0; //req->conhdl = app_env->conhdl; req->handle = CUST1_IDX_ADC_VAL_1_VAL; req->length = DEF_CUST1_ADC_VAL_1_CHAR_LEN; req->notification = true; memcpy(req->value, &sample, DEF_CUST1_ADC_VAL_1_CHAR_LEN); ke_msg_send(req); if (ke_state_get(TASK_APP) == APP_CONNECTED) { // Set it once again until Stop command is received in Control Characteristic timer_used = app_easy_timer(APP_PERIPHERAL_CTRL_TIMER_DELAY, app_adcval1_timer_cb_handler); } }

A similar question askedhereand I am sure they using 6.0.6 and above.

PM_Dialog
Offline
Last seen:2 days 28 min ago
Staff
加入:2018-02-08 11:03
Hi rajan22,

Hi rajan22,

The ADC 1 characteristic in the ble_app_peripheral example of SDK6.0.10 has both read and notify permissions enabled. Please check the custs1_att_db in user_custs1_def.c. When trying to read the characteristic form the peer device, what you are expecting to get? When having enabled the notification in the peer device, are you able to see the ADC 1 updating?

Thanks, PM_Dialog

rajan22
Offline
Last seen:1 year 4 months ago
加入:2017-12-29 05:09
Hi,

Hi,

When having enabled the notification in the peer device, are you able to see the ADC 1 updating?Yes,I am able to get dummy ADC data (a counter value).

When trying to read the characteristic form the peer device, what you are expecting to get?I am expecting to get ongoing counter data whenreadingcommand.

Thanks

PM_Dialog
Offline
Last seen:2 days 28 min ago
Staff
加入:2018-02-08 11:03
Hi rajan22,

Hi rajan22,

Let me check it and i will get back to you.

Thanks, PM_Dialog

PM_Dialog
Offline
Last seen:2 days 28 min ago
Staff
加入:2018-02-08 11:03
Hi rajan22,

Hi rajan22,

The reason why you cannot read the ADC data is because when sending data over notifications, the CUST1_IDX_ADC_VAL_1_VAL is not updated in the data base. This is not a SKD bug! In order to update the data base, except from the CUSTS1_VAL_NTF_REQ, you should send a CUSTS1_VAL_SET_REQ as well in order to trigger the custs1_val_set_req_handler(). If you check the source code of this handler, you will find that the attmdb_att_set_value() is executed. Please try the below code snippet:

void app_adcval1_timer_cb_handler() { struct custs1_val_ntf_ind_req *req = KE_MSG_ALLOC_DYN(CUSTS1_VAL_NTF_REQ, prf_get_task_from_id(TASK_ID_CUSTS1), TASK_APP, custs1_val_ntf_ind_req, DEF_SVC1_ADC_VAL_1_CHAR_LEN); struct custs1_val_set_req *req_set = KE_MSG_ALLOC_DYN(CUSTS1_VAL_SET_REQ, prf_get_task_from_id(TASK_ID_CUSTS1), TASK_APP, custs1_val_set_req, DEF_SVC1_ADC_VAL_1_CHAR_LEN); // ADC value to be sampled static uint16_t sample __attribute__((section("retention_mem_area0"), zero_init)); sample = (sample <= 0xffff) ? (sample + 1) : 0; //req->conhdl = app_env->conhdl; req->handle = SVC1_IDX_ADC_VAL_1_VAL; req->length = DEF_SVC1_ADC_VAL_1_CHAR_LEN; req->notification = true; memcpy(req->value, &sample, DEF_SVC1_ADC_VAL_1_CHAR_LEN); req_set->handle = SVC1_IDX_ADC_VAL_1_VAL; req_set->length = DEF_SVC1_ADC_VAL_1_CHAR_LEN; memcpy(req_set->value, &sample, DEF_SVC1_ADC_VAL_1_CHAR_LEN); ke_msg_send(req); ke_msg_send(req_set); if (ke_state_get(TASK_APP) == APP_CONNECTED) { // Set it once again until Stop command is received in Control Characteristic timer_used = app_easy_timer(APP_PERIPHERAL_CTRL_TIMER_DELAY, app_adcval1_timer_cb_handler); } }

Thanks, PM_Dialog

bojanpotocnik
Offline
Last seen:3 months 2 weeks ago
加入:2019-11-26 11:41
Dear Dialog team,

Dear Dialog team,

when using struct custs1_val_set_req, the req_set->conidx parameter is not relevant? If it is, then how to set the value "for all connections" - using GAP_INVALID_CONIDX triggers hard fault.

PM_Dialog
Offline
Last seen:2 days 28 min ago
Staff
加入:2018-02-08 11:03
Hi bojanpotocnik,

Hi bojanpotocnik,

Thanks for your comment. Could you please raise a new forum ticket with your question as this one is old and closed? Additionally it would be very helpful if you could clarify your question.

Thanks, PM_Dialog