我有2个DA14580AK eVB和将DSP设备和主机应用程序加载到2个不同的EVB中。我在主机的GAPM_ADV_REPORT_IND_HANDLER中设置了断点,并显示了监视视图中的PARAM-> REPORT.ADD.ADDR.ADDR&param-> report.data的值。对话框主机可以正确显示对话设备名称和BD地址。如果对话框主机收到另一个品牌BLE的广告消息,则只能正确接收BD地址,但收到的设备名称是垃圾。但是,DSPS Android应用程序可以正确显示这些设备名称,请诚挚建议。
msgid,lapm_adv_report_ind_handler(ke_msg_id_t const,
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-> eport.adddr.addr,sizeof(struct bd_addr));
if(!memcmp(&param-> report.data [3],app_dflt_addata,app_dflt_add_data_len)))
{
//将找到的bd_addr保存到全局变量
memcpy(&connect_bdaddr, param->report.adv_addr.addr, sizeof(struct bd_addr));
app_cancel_scanning();
}
return (KE_MSG_CONSUMED);
}
嗨Jackiechau,
What do you mean when you say "garbage", when you get the advertising indication the hexadecimal value are the one that should be ? Perhaps you also see data from previous indications since you dont memset the array that you are storing the advertising string.
谢谢mt_dialog.
嗨mt_dialog,
“垃圾”表示可以收到相关的bdddress,因此无法得到正确的设备名称。但是,DSPS Android应用程序可以正确显示这些设备名称。谢谢。
嗨Jackiechau,
当您获得广告指示时,您正在获得的十六进制值呢,可以查看它们而不是ASCII字符吗?您能否请检查Param-> Report.data参数,而不是您复制数据的数组吗?或者可能是由于选择选择无法检查实际数据,可以尝试打印数据而不是在调试器中检查它们吗?当广告指示出现在我的设置时,我能够看到有效数据。
谢谢mt_dialog.
嗨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.
嗨Jackiechau,
Seems a bit weird, as far as i can see from your screenshot the AD flags are properly shown in the debugger 0x02, 0x01 and 0x06, the 1A is the length of your data as reported by the advertising string and the FF is the manufacturer specific data. Its a bit weird if the 580 filters out the next bytes. Are you sure about the values that you are placing in the advertising string ? Can you please check with an application that only parses the advertising string like BlueLoupe. Perhaps what you are seeing in the app you are using is device names that have been cached by your phone and not the actual advertising string.
谢谢mt_dialog.
嗨mt_dialog,
实际上,通过空气接收广告字符串,它们不会被我传输。我只是想知道为什么DSPS APK或我的BLE监视器(带USB BLE模块的PC应用程序)可以收到这些广告,但在我的对话框主机中并非如此。
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.
嗨Jackiechau,
As i have mentioned in the screenshot you ve attached i can see the flags of an advertising string, and the host (at least on my side can receive the advertsing string properly, when i place a name in the advertising string i can check the name in the extra array variables), now regarding that your other devices are able to check names perphaps is because those devices can cache the names of connected devices or something like that or the devices can read names from the scan response data string. In order to be sure you can advertise with a peripheral and catch the advertising of your peripheral with your central and check the name that you ve placed in your device's advertising string. Also another thing that
As far as the printing the "T" try to use the function that directly uses the UART for example uart_write("T", 1, NULL);
谢谢mt_dialog.
嗨mt_dialog,
我发现当app_cancel_scanning()或app_disconnect() was called, "T" wasn't printed. After app_scanning() or app_connect() was called, continuous "T" was printed. It seems the program counter stops when app_cancel_scanning() or app_disconnect() was run, until interrupt is received. It's proved by adding systick timer. Please kindly advise. Also, is it possible to assign your HK staff to help me, thanks?
此外,许多开发人员要求帮助I2C从事问题,您的一方面会拍摄这方面吗?
嗨Jackiechau,
A mail is sent to the registered email address.
谢谢mt_dialog.
嗨mt_dialog,
Because sometimes peripheral device disconnects and are unable to connect central forever, I tried to issue app_reset_app() after disconnection by pressing a button. At this moment, although central could receive advertisement and connect to peripheral device, peripheral device couldn't receive central's transmitted data. After calling app_reset_app(), is there any state change or should I need to initial some codes in order that central can connect it again?
此外,似乎发出App_reset_App()后的BLE定时器停止,我观察到未触发app_timer_set的处理程序。谢谢。
嗨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.
谢谢mt_dialog.
我在SDK5上使用DSP。
At the central side, I input character via UART to scan, cancel scan, connect and disconnect peripheral device manually. I just used all the api your side provided.
static void uart_rx_callback(uint8_t res, uint32_t read_size)
{
struct bd_addr testDeviceAddr;
switch(rx_read_pointer[0]){
案例's':
app_scanning();
休息;
案例'x':
app_cancel_scanning();
休息;
案例'c':
if(ke_state_get(TASK_APP)==APP_CONNECTABLE){
printf_string("CONNECT\r\n");
app_connect();
}
休息;
案例'd':
if(ke_state_get(TASK_APP)==APP_CONNECTED){
app_disconnect();
printf_string("DISCONNECT\r\n");
}
休息;
case 'r':
printf_string(“重置堆栈\ r \ n”);
app_reset_app();
休息;
案例't':
printf_string("set APP_CONNECTABLE\r\n");
ke_state_set(TASK_APP, APP_CONNECTABLE);
休息;
默认:
休息;
}
#万一
//reinitiate callback
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连接丢失\ r \ n”);
return (KE_MSG_CONSUMED);
}
在外设方面,调试消息将在GAPC_CONNECTION_REQ_IND_HANDLLER中打印和GAPC_DISCONNECT_IND_HANDLLER,使得我可以知道是否连接了外围设备的连接。
在最后一个帖子中,我想说的是,由于远程断开,外围设备可能会断开连接。当中央行程再次连接膜组器设备时,它无法再次连接。然后我尝试在秘书处发出app_reset_app。此时,虽然中心可以接收广告消息并连接到外围设备,但是当中央试图通过连接模式下的App_uart_push发送数据时,Peripher设备无法接收任何内容。
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.
嗨Jackiechau,
连接到设备时(使用app_connect()函数时)如何分配使用ke_msg_alloc_dyn()或ke_msg_alloc()宏的GAPM_START_CONNECTION_CMD消息。正确连接KE_MSG_ALLOC_DYN() should be used. By using this a GAPM_RESET command isn't required and the peripheral should be able to re-connect.
谢谢mt_dialog.
嗨mt_dialog,
我正在使用SDK5的原始源代码提供的KE_MSG_ALLOC()。为什么KE_MSG_ALLOC()不是最好的解决方案?
如果我使用ke_msg_alloc_dyn()marco,如何定义参数“长度”?
Will the central side disconnect because of timeout?
您是否尝试过测试DSP中央和外围的连接过夜?
Actually, whatever scanning, stop scanning, connect or disconnect, central does it manually by external event. Thanks.
嗨Jackiechau,
In the DSPS host in the SDK5 the app_connect() - (is an SDK3 function) function is not used, instead the api function app_easy_gap_start_connection_to_set() function is used which uses the api function app_easy_gap_start_connection_to_msg_create() which in turns it calls the app_connect_start_msg_create(), the later function is the one that allocates the gapm_start_connection_cmd message by using the KE_MSG_ALLOC_DYN. The parameter length should be (sizeof(struct gap_bdaddr)). Regarding why you should use the KE_MSG_ALLOC_DYN, every message/struct that within the included parameters has a parameter member which is an empty array has to be allocated with the KE_MSG_ALLOC_DYN. In the SDK3 the KE_MSG_ALLOC is used and thats why we reset the stack afterwards, but this isn't the proper way to start or restart a connection. Yes the there is going to be a disconnection because of a timeout. I am not aware if the QA has performed an overnight test on the DSPS so i cant tell you for sure, but i suppose that those kind of tests are standard so i suppose that they have.
谢谢mt_dialog.
我检查了SDK3应该使用,因为DSPS项目仅适用于SDK3。
嗨Jackiechau,
The DSPS is implemented in SDK 5 as well, please check the Dialog Serial Port Service in the reference designs. The most recent version is based on 5.0.3 SDK version.
谢谢mt_dialog.