⚠️
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.wsdof.com/support. We’ll be fixing bugs / optimising the searching and tagging over the coming days.
15个职位/0个新职位
Last post
hdr公司
Offline
Last seen:4 months 3 weeks ago
Joined:2019-06-11 14:08
BLE中心写入

你好,团队对话,

I have written a program based on the ble_central project, which finds BLE devices with a special name or MAC address.
If a device is found, I connect to it and then I write into a characteristic.
我的问题是:
Every time I try to write to the peripheral, the status is 3 (ATT_ERROR_WRITE_NOT_PERMITTED) at the Write-Completed-Event.
When I try to do it with my mobile phone via nRF Connect App, I can read and write without any problems.
Tried out as a peripheral a Raspberry Pi, my mobile phone and also a Dialog 14680.
Every time the status is 3.

printf("start write\r\n"); uint16_t * mtu = 0; ble_gattc_get_mtu(evt->conn_idx, mtu); printf("MTU Rate: %u\r\n", *mtu); uint8_t test = 0x00; printf("uuid: %s\r\n",format_uuid(&charact[0].uuid)); printf("write\r\n"); ble_gattc_write(evt->conn_idx, charact[0].handle ,false , sizeof(test) ,&test);

charact[0] contains the handler from the Characteristic.

Many thanks for the effort in advance.

致以最诚挚的问候

HDR公司

关键词:
设备:
PM_Dialog
Offline
Last seen:19 hours 45 min ago
Staff
Joined:2018-02-08 11:03
Hi hdr,

Hi hdr,

Thanks for your question on our public BLE forums. Could you please indicate what is the peripheral? Is another DA14682?

Thanks, PM_Dialog

hdr公司
Offline
Last seen:4 months 3 weeks ago
Joined:2019-06-11 14:08
I used a Raspberry Pi with

I used a Raspberry Pi with PyBluez as peripheral, my mobile phone with the above mentioned app and a Dialog 14680. I'm now trying a DA 14682 as I can't access the 14680 because the device is potted.

alex.jian
Offline
Last seen:4 months 4 weeks ago
Joined:2019-08-28 10:14
高hdr

高hdr

i have same request

can you tell me what is Write-Completed-Event and how to use??

thanks

hdr公司
Offline
Last seen:4 months 3 weeks ago
Joined:2019-06-11 14:08
如果我明白的话

如果我明白的话correctly, the Write_Completed_Event is called when I call a ble_gattc_write and it has been executed. In the event I get back the conn_idx, the handler and a status code. In my case the status code is 3, which stands for ATT_ERROR_WRITE_NOT_PERMITTED.

为了描述如何使用事件,我将参考bleèu中心示例项目。

alex.jian
Offline
Last seen:4 months 4 weeks ago
Joined:2019-08-28 10:14
高hdr

高hdr

i also use ble_gattc_write and i add Write_Completed_Event to app_task.c as below , Is this right when ble_gattc_write Completed??

静态常量结构ke\u msg\u处理程序app\u gap\u进程\u处理程序[]=
{
{GAPM_DEVICE_READY_IND, (ke_msg_func_t)gapm_device_ready_ind_handler},
{GAPM_CMP_EVT, (ke_msg_func_t)gapm_cmp_evt_handler},
{GAPC_CMP_EVT, (ke_msg_func_t)gapc_cmp_evt_handler},
{GAPC_CONNECTION_REQ_IND, (ke_msg_func_t)gapc_connection_req_ind_handler},
{GAPC_DISCONNECT_IND, (ke_msg_func_t)gapc_disconnect_ind_handler},
{GAPC\ u GET\ u DEV\ u INFO\ u REQ\ u IND,(ke\ u msg\ u func\ t)GAPC\ u GET\ u DEV\ u INFO\ u REQ\ u IND\ u handler},
{GAPC_SET_DEV_INFO_REQ_IND, (ke_msg_func_t)gapc_set_dev_info_req_ind_handler},
{GAPM_PROFILE_ADDED_IND, (ke_msg_func_t)gapm_profile_added_ind_handler},
{GAPM\u ADV\u REPORT\u IND,(ke\u msg\u func\t)GAPM\u ADV\u REPORT\u IND\u handler},
{GAPC_PARAM_UPDATE_REQ_IND,(ke_msg_func_t)GAPC_PARAM_UPDATE_REQ_IND_handler},
{GAPC\u LE\u PKT\u SIZE\u IND,(ke\u msg\u func\t)GAPC\u LE\u PKT\u SIZE\u IND\u handler},
{GAPC\u CON\u RSSI\u IND,(ke\u msg\u func\u t)GAPC\u get\u CON\u RSSI\u IND\u handler},//Alex Add 20191030
{GATTC_READ_IND, (ke_msg_func_t)app_read_ind_handler}, //alex test 2020 0710
{GATTC_SDP_SVC_IND, (ke_msg_func_t)app_disc_all_svc }, //alex test 2020 0710
{GATTC\u CMP\u EVT,(ke\u msg\u func\t)alex\u GATTC\u CMP\u EVT\u handler},//alex test 2020 0716
//{GAPC_PEER_ATT_INFO_IND, (ke_msg_func_t)app_read_dev_ver_ind_handler}, //alex test 2020 0710

#if (BLE_APP_SEC)
{GAPC_SECURITY_IND, (ke_msg_func_t)gapc_security_ind_handler},
#endif
};

hdr公司
Offline
Last seen:4 months 3 weeks ago
Joined:2019-06-11 14:08
I think you use another SDK

我想你用的是另一个SDK和对话芯片。

PM_Dialog
Offline
Last seen:19 hours 45 min ago
Staff
Joined:2018-02-08 11:03
Hi hdr,

Hi hdr,

感谢您的详细回复。根据蓝牙LE规范:

“如果由于权限原因无法写入属性值,则应发送错误响应,错误代码为«写入不允许»。“

Could you please check if the characteristic ( in the Peripheral side ) has write permission? If yes, then I would suggest to double check if the Central (DA14682) writes to the correct handler (charact[0].handle).

此外,这将是非常有用的BLE sniffer log, so that we can understand what is happening over the air.

Thanks, PM_Dialog

hdr公司
Offline
Last seen:4 months 3 weeks ago
Joined:2019-06-11 14:08
Hello,

Hello,

外设中的特性具有写权限,处理程序应该是正确的。

静态空句柄\u evt\u gattc\u discover\u char(ble\u evt\u gattc\u discover\u char\u t*evt){。。。如果(ble|uuid|equal(&evt->uuid,&list| uuid|equal(&evt->uuid,&list|uuid|nb)){charact[0].handle=evt->handle;charact[0].uuid=evt->uuid;}。。。}

Here is my Code from the Dialog 14682 Peripheral(same result status is 3):

ble_uuid_from_string("6e400002-b5a3-f393-e0a9-e50e24dcca9f", &uuid); ble_gatts_add_characteristic(&uuid,GATT_PROP_WRITE, ATT_PERM_RW, 1, 0, NULL, NULL);

With my mobile phone I can write in the characteristic.

PM_Dialog
Offline
Last seen:19 hours 45 min ago
Staff
Joined:2018-02-08 11:03
嗨,亚历克斯,

嗨,亚历克斯,

谢谢你的评论,但请提出另一个论坛线程。具体论坛主题与DA14682和SDK1.0.14相关。据我所知,您正在使用DA14585和SDK6在您的设计,所以请创建另一张票与您的问题。

Thanks, PM_Dialog

PM_Dialog
Offline
Last seen:19 hours 45 min ago
Staff
Joined:2018-02-08 11:03
Hi hdr,

Hi hdr,

Thansk fro gettign back. Could you please provide a BLE sniffer capture/

Thanks, PM_Dialog

hdr公司
Offline
Last seen:4 months 3 weeks ago
Joined:2019-06-11 14:08
Hello,

Hello,
不幸的是,我们不可能嗅探。
We will continue to search for the error and contact you if we find any new information.

PM_Dialog
Offline
Last seen:19 hours 45 min ago
Staff
Joined:2018-02-08 11:03
Hi hdr,

Hi hdr,

Yes please, any further input would be very helpful.

Thanks, PM_Dialog

hdr公司
Offline
Last seen:4 months 3 weeks ago
Joined:2019-06-11 14:08
Hello,

Hello,
Thanks very much for the help. I found my mistake.
我的把柄确实错了。我应该把evt->value\u handle分配给handle\u evt\u gattc\u discover\u char方法中的句柄。

Thank you very much

hdr公司

PM_Dialog
Offline
Last seen:19 hours 45 min ago
Staff
Joined:2018-02-08 11:03
Hi hdr,

Hi hdr,

Glad that you figured this out and thanks for your indication.

Thanks, PM_Dialog