DSPS host application can't receive other device names correctly

18 posts / 0 new
最后一篇
jackiechau
离线
Last seen:3 years 5 months ago
加入:2016-01-15 01:32
DSPS host application can't receive other device names correctly

I have 2 DA14580AK EVB and loaded DSPS device & host application into 2 different EVB. I set the break point in gapm_adv_report_ind_handler of host, and display the values of param->report.adv_addr.addr & param->report.data in watch view. The Dialog host can display the Dialog device name and BD address correctly. If the Dialog host receives another brand BLE's advertisement message, only BD address can be received correctly but received device name is garbage. However, DSPS android app can display those device names correctly, please kindly advise.

int gapm_adv_report_ind_handler(ke_msg_id_t const msgid,
const struct gapm_adv_report_ind *param,
ke_task_id_t const dest_id,
ke_task_id_t const src_id)
{
memset(gBdAddress, 0, sizeof(struct bd_addr));
memcpy(gBLEname, param->report.data, param->report.data_len);
memcpy(gBdAddress, param->report.adv_addr.addr, sizeof(struct bd_addr));
if(!memcmp(¶m->report.data[3], APP_DFLT_ADV_DATA, APP_DFLT_ADV_DATA_LEN))
{
//Save found bd_addr to global variable
memcpy(&connect_bdaddr,param-> eport.addr.addr,sizeof(struct bd_addr));

app_cancel_scanning();
}
return(ke_msg_consumed);
}

Device:
MT_dialog
离线
Last seen:2 months 2 weeks ago
职员
加入:2015-06-08 11:34
Hi jackiechau,

Hi jackiechau,

当你说“垃圾”时,你的意思是什么,当你得到广告指示时,十六进制价值是应该是的一个?也许您还看到了先前迹象的数据,因为您不会将您存储广告字符串存储的数组。

Thanks MT_dialog

jackiechau
离线
Last seen:3 years 5 months ago
加入:2016-01-15 01:32
Hi MT_dialog,

Hi MT_dialog,

"garbage" means correct device name can't be got although relevant BdAddress can be received. However, DSPS android app can display those device names correctly. Thanks.

MT_dialog
离线
Last seen:2 months 2 weeks ago
职员
加入:2015-06-08 11:34
Hi jackiechau,

Hi jackiechau,

What about the hex values that you are getting when you get an advertising indication, can you please check them and not the ascii characters ? Can you please check the param->report.data parameter and not the array that you are copying the data ? Or perhaps due to optization you cant check the actual data, can you please try to print the data instead of checking them in the debugger ? althougn i was able to see valid data when an advertising indication come on my setup.

Thanks MT_dialog

jackiechau
离线
Last seen:3 years 5 months ago
加入:2016-01-15 01:32
Hi MT_dialog,

Hi MT_dialog,

Please find the attachment. It's one the of device names showing incorrect HEX values. I tried to print param->report.data parameter via console and the results were the same. Dialog device name could be shown, I don't think that it's related to optimization issue, please kindly advise.

MT_dialog
离线
Last seen:2 months 2 weeks ago
职员
加入:2015-06-08 11:34
Hi jackiechau,

Hi jackiechau,

似乎有点奇怪,只要我从屏幕截图看,AD标志在调试器0x02,0x01和0x06中正确显示了,1A是广告字符串报告的数据的长度,FF是制造商特定的数据。如果580过滤出下一个字节,它有点奇怪。您确定要在广告字符串中放置的值吗?请您使用只解析像BlueLoupe这样的广告字符串的应用程序。也许在您使用的应用中看到的是您所使用的应用程序是由手机缓存而不是实际广告字符串的设备名称。

Thanks MT_dialog

jackiechau
离线
Last seen:3 years 5 months ago
加入:2016-01-15 01:32
Hi MT_dialog,

Hi MT_dialog,

Actually, the advertising strings are received via the air, they aren't transmitted by me. I just wondered why DSPS apk or my BLE monitor(PC app with USB BLE module) could receive those advertisements but it's not the case in my Dialog host.

Also, I have another question. In host DSPS project, sleep mode is disable. I put a printf_string("T") in the while loop of main_func. When the program was run by debugger, several hundred "T" was printed, then nothing. I stopped the debugger and ran again, one more "T" was printed. What's going on? I expected continuous "T" was printed, please kindly advise.

MT_dialog
离线
Last seen:2 months 2 weeks ago
职员
加入:2015-06-08 11:34
Hi jackiechau,

Hi jackiechau,

正如我在屏幕截图中提到的那样,我可以看到广告字符串的标志,主机(至少在我的侧面可以正确接收广告字符串,当我在广告字符串中放置名称我可以检查名称在额外的阵列变量中),现在考虑到您的其他设备能够检查每个用户的名称是因为这些设备可以缓存所连接的设备的名称或类似于该设备或设备可以从扫描响应数据字符串读取名称。为了确保您可以使用外设宣传,并通过中央捕获外设的广告,并检查您放置在设备的广告字符串中的名称。还有另一件事

As far as the printing the "T" try to use the function that directly uses the UART for example uart_write("T", 1, NULL);

Thanks MT_dialog

jackiechau
离线
Last seen:3 years 5 months ago
加入:2016-01-15 01:32
Hi MT_dialog,

Hi MT_dialog,

我发现,当调用app_cancel_scanning()或app_disconnect()时,未打印“t”。调用app_scanning()或app_connect()后,打印连续的“t”。在运行App_cancel_scanning()或app_disconnect()时,程序计数器似乎停止,直到收到中断。它通过添加Systick计时器证明。请诚挚建议。另外,是否有可能为您的HK员工提供帮助我,谢谢?

Also, many developers requested help on I2C slave issue, will your side plan to take a look on this?

MT_dialog
离线
Last seen:2 months 2 weeks ago
职员
加入:2015-06-08 11:34
Hi Jackiechau,

Hi Jackiechau,

A mail is sent to the registered email address.

Thanks MT_dialog

jackiechau
离线
Last seen:3 years 5 months ago
加入:2016-01-15 01:32
Hi MT_dialog,

Hi MT_dialog,

因为有时外围设备断开连接并无法永久连接Central,我尝试在断开按钮后发出App_reset_App()。此时,虽然中心可以接收广告并连接到外围设备,但外围设备无法接收中心的发送数据。调用app_reset_app()后,是否有任何状态更改,或者我应该需要初始一些代码,以便中央可以再次连接它?

Also, it seems the BLE timer stopped after issuing app_reset_app(), I observed that the handler of app_timer_set wasn't triggered. Thanks.

MT_dialog
离线
Last seen:2 months 2 weeks ago
职员
加入:2015-06-08 11:34
Hi jackiechau,

Hi jackiechau,

你不需要为了发送一个重置命令reconnect to a device, most probably something is wrong with the way you are issuing a connection request to the peripheral. Can you please paste the code that you are using in order to connect from the central ? Also on which SDK you are developing, you are using the DSPS on the SDK5 or on SDK3 as an example? What do you mean that The peripheral couldn't receive the centrals trasmited data (notifications/indications) ? After a GAPM_RESET your device should be set from the app_easy_gap_dev_configure() (in SDK5) function which will set the role, operation, etc of your device.

Thanks MT_dialog

jackiechau
离线
Last seen:3 years 5 months ago
加入:2016-01-15 01:32
I'm using DSPS on SDK5.

I'm using DSPS on SDK5.
在中心侧,I通过UART输入字符以手动扫描,取消扫描,连接和断开外围设备。我刚刚使用了所有的API。
static void uart_rx_callback(uint8_t res, uint32_t read_size)
{
struct bd_addr testDeviceAddr;
开关(rx_read_pointer [0]){
case 's':
app_scanning();
break;
case 'x':
app_cancel_scanning();
break;
case 'c':
if(ke_state_get(TASK_APP)==APP_CONNECTABLE){
printf_string(“connect \ r \ n”);
app_connect();
}
break;
case 'd':
if(ke_state_get(task_app)== app_connected){
app_disconnect();
printf_string(“disconnect \ r \ n”);
}
break;
案例'r':
printf_string("RESET stack\r\n");
app_reset_app();
break;
case 't':
printf_string(“set app_connectable \ r \ n”);
ke_state_set (TASK_APP APP_CONNECTABLE);
break;

default:
break;
}
#endif
//重新回调
uart_sps_read(rx_read_pointer, RX_CALLBACK_SIZE, &rx_state_ptr, &uart_rx_callback);
}

int gapc_disconnect_ind_handler(ke_msg_id_t const msgid,
struct gapc_disconnect_ind const *param,
ke_task_id_t const dest_id,
ke_task_id_t const src_id)
{
app_disconnect();
ke_state_set (TASK_APP APP_CONNECTABLE);
printf_string("BLE connection lost\r\n");
return(ke_msg_consumed);
}
At the peripheral side, debug message would be printed in gapc_connection_req_ind_handler and and gapc_disconnect_ind_handler such that I could know whether the connection of peripheral device was connected or not.
In the last post, what I would like to say was sometimes the peripheral device may disconnect because of remote disconnection. When central trys to connect the periheral device again, it can't connect it again. Then I tried to issue app_reset_app in periheral device. At this moment, although central could receive advertisemnet and connect to peripheral device, when central tried to send data by app_uart_push in connected mode, peripher device couldn't receive anything.
Also, at peripheral side, I have added a timer by calling app_timer_set() to print debug message per 1 second. However, when app_reset_app was issued, I observed that the debug message was stopped to be printed.

MT_dialog
离线
Last seen:2 months 2 weeks ago
职员
加入:2015-06-08 11:34
Hi Jackiechau,

Hi Jackiechau,

When you are connecting to the device (when using the app_connect() function) how do you allocate the gapm_start_connection_cmd message you are using the KE_MSG_ALLOC_DYN() or the KE_MSG_ALLOC() macro. For a proper connection the应使用ke_msg_alloc_dyn()。通过使用此缩小命令,不需要,外围设备应该能够重新连接。

Thanks MT_dialog

jackiechau
离线
Last seen:3 years 5 months ago
加入:2016-01-15 01:32
Hi MT_dialog,

Hi MT_dialog,

I'm using KE_MSG_ALLOC() as provided by the original source codes of SDK5. Why KE_MSG_ALLOC() isn't the best solution?
If I use KE_MSG_ALLOC_DYN() marco, how to define the parameter "length"?
Will the central side disconnect because of timeout?
Have you tried to test the connection of DSPS central and peripheral overnight?
实际上,无论扫描,停止扫描,连接或断开连接,中心都会通过外部事件手动操作。谢谢。

MT_dialog
离线
Last seen:2 months 2 weeks ago
职员
加入:2015-06-08 11:34
Hi jackiechau,

Hi jackiechau,

在SDK5中的DSP主机中,APP_CONNECT() - (是SDK3函数)函数未使用,而是使用API​​函数app_easy_gap_start_connection_to_msg_create()的API函数app_easy_gap_start_connection_to_msg_create(),这反过来调用app_connect_start_msg_create(),稍后的函数是使用ke_msg_alloc_dyn分配gapm_start_connection_cmd消息的函数。参数长度应为(sizeof(struct gap_bdaddr))。关于为什么要使用ke_msg_alloc_dyn,在附带的参数中的每一个消息/结构都具有一个名为空数组,必须与ke_msg_alloc_dyn分配。在SDK3中,使用KE_MSG_ALLOC,并且撰写为什么我们之后重置堆栈,但这不是启动或重新启动连接的正确方法。是的,由于超时,有一个断开连接。我不知道QA是否在DSP上进行了过夜测试,所以我无法肯定地告诉你,但我想那些测试的那种测试是标准的,所以我想他们有。

Thanks MT_dialog

jackiechau
离线
Last seen:3 years 5 months ago
加入:2016-01-15 01:32
实际上我检查了SDK3

I checked SDK3 should be used because DSPS project is only available for SDK3.

MT_dialog
离线
Last seen:2 months 2 weeks ago
职员
加入:2015-06-08 11:34
Hi jackiechau,

Hi jackiechau,

DSP也在SDK 5中实现,请在参考设计中检查对话框串行端口服务。最新版本基于5.0.3 SDK版本。

Thanks MT_dialog