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,
任务id常量目标id,
Keu任务\u id \u t const src \u 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->report.adv_addr.addr,sizeof(struct bd_addr));
app_cancel_scanning();
}
返回(已消耗的消息);
}
Hi jackiechau,
你说“垃圾”是什么意思,当你得到广告指示时,十六进制值就是应该的值?也许您还可以看到来自前面指示的数据,因为您没有设置存储广告字符串的数组。
Thanks 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.
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
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.
Hi jackiechau,
似乎有点奇怪,据我所知,从你的截图广告标志是正确地显示在调试器0x02,0x01和0x06,1A是你的数据长度报告的广告字符串和FF是特定于制造商的数据。如果580过滤掉下一个字节,那就有点奇怪了。您确定要放入广告字符串中的值吗?你能用一个只解析像BlueLoupe这样的广告字符串的应用程序检查一下吗。也许你在使用的应用程序中看到的是手机缓存的设备名称,而不是实际的广告字符串。
Thanks 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.
Hi jackiechau,
正如我在您所附的屏幕截图中提到的,我可以看到广告字符串的标志和主机(至少在我这边可以正确接收广告字符串,当我在广告字符串中放置名称时,我可以检查额外数组变量中的名称),现在,关于其他设备能够检查名称perphaps是因为这些设备可以缓存连接设备的名称或类似的东西,或者设备可以从扫描响应数据字符串读取名称。为了确保您可以用外围设备进行广告,并用中央设备捕捉外围设备的广告,并检查您在设备广告字符串中放置的名称。还有一件事
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
Hi MT_dialog,
我发现在调用app\u cancel\u scanning()或app\u disconnect()时,没有打印“T”。调用app\u scanning()或app\u connect()后,会打印连续的“T”。似乎程序计数器在运行app\u cancel\u scanning()或app\u disconnect()时停止,直到收到中断。通过添加systick定时器证明了这一点。请告知。另外,有没有可能派你们香港的员工来帮我,谢谢?
Also, many developers requested help on I2C slave issue, will your side plan to take a look on this?
Hi Jackiechau,
A mail is sent to the registered email address.
Thanks MT_dialog
Hi MT_dialog,
因为有时外围设备会断开连接,无法永远连接到中心,所以我尝试在断开连接后按一个按钮发出app\u reset\u app()。此时,虽然中央可以接收广告并连接到外围设备,但外围设备不能接收中央传输的数据。调用app\u reset\u app()后,是否有任何状态更改,或者我是否需要初始化一些代码,以便central可以再次连接它?
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.
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
I'm using DSPS on SDK5.
在中央,我通过UART输入字符来扫描、取消扫描、手动连接和断开外围设备。我刚用了你方提供的所有api。
static void uart_rx_callback(uint8_t res, uint32_t read_size)
{
struct bd_addr testDeviceAddr;
开关(rx\u read\u指针[0]){
case 's':
app_scanning();
break;
case 'x':
app_cancel_scanning();
break;
case 'c':
if(ke_state_get(TASK_APP)==APP_CONNECTABLE){
printf_字符串(“CONNECT\r\n”);
app_connect();
}
break;
case 'd':
if(ke\u state\u get(TASK\u APP)==APP\u CONNECTED){
app_disconnect();
printf_string(“断开连接\r\n”);
}
break;
案例“r”:
printf_string("RESET stack\r\n");
app_reset_app();
break;
case 't':
printf_string(“set APP_CONNECTABLE\r\n”);
ke\ u state\ u set(任务\应用程序,应用程序\可连接);
break;
default:
break;
}
#endif
//重新初始化回调
uart_sps_read(rx_read_pointer, RX_CALLBACK_SIZE, &rx_state_ptr, &uart_rx_callback);
}
int gapc\u disconnect\u ind\u处理程序(ke\u msg\u id\u t const msgid,
struct gapc_disconnect_ind const *param,
任务id常量目标id,
Keu任务\u id \u t const src \u id)
{
app_disconnect();
ke\ u state\ u set(任务\应用程序,应用程序\可连接);
printf_string("BLE connection lost\r\n");
返回(已消耗的消息);
}
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.
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应该使用keu MSG\u ALLOC\u DYN()。通过使用这个GAPM\u复位命令是不需要的,外设应该能够重新连接。
Thanks 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?
实际上,无论扫描、停止扫描、连接或断开连接,central都是通过外部事件手动完成的。谢谢。
Hi jackiechau,
在SDK5的DSPS主机中,不使用app\u connect()-(是SDK3函数)函数,而是使用api函数app\u easy\u gap\u start\u connection\u to\u set()函数,该函数使用api函数app\u easy\u gap\u start\u connection\u to\u msg\u create(),该函数依次调用app\u connect\u start\u msg\u create(),后面的函数是通过使用KE\u MSG\u ALLOC\u DYN来分配gapm\u start\u connection\u cmd消息的函数。参数长度应为(sizeof(struct gap\u bdaddr))。关于为什么应该使用keu MSG\u ALLOC\u DYN,包含的参数中的每个消息/结构都有一个空数组的参数成员,必须使用keu MSG\u ALLOC\u DYN进行分配。在SDK3中,使用了keu MSG\u ALLOC,这就是为什么我们随后重置堆栈,但这不是启动或重新启动连接的正确方法。是的,会因为超时而断开连接。我不知道QA是否在dsp上进行了一夜测试,所以我不能肯定地告诉你,但是我认为这些测试是标准的,所以我认为他们已经做了。
Thanks MT_dialog
I checked SDK3 should be used because DSPS project is only available for SDK3.
Hi jackiechau,
DSPS也是在SDK 5中实现的,请检查参考设计中的Dialog串行端口服务。最新版本基于5.0.3 SDK版本。
Thanks MT_dialog