我有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,
请找到附件。它是显示不正确的十六进制值的设备名称。我试图通过控制台打印Param-> Report.Data参数,结果是相同的。对话设备名称可以显示,我不认为它与优化问题有关,请诚挚建议。
嗨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应用程序)可以收到这些广告,但在我的对话框主机中并非如此。
此外,我还有另一个问题。在主机DSP项目中,睡眠模式是禁用。我在main_func的while循环中放了一个printf_string(“t”)。当程序由调试器运行时,打印几百个“T”,然后没有。我停止了调试器并再次运行,再打印一个“T”。这是怎么回事?我预计持续的“T”被印在印刷,请诚挚建议。
嗨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
就打印“t”尝试使用直接使用UART的函数,例如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,
邮件被发送到已注册的电子邮件地址。
谢谢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,
您不必发送重置命令才能重新连接到设备,大多数可能是向外设发出连接请求的方式出现问题。您能否粘贴所使用的代码以便从中央连接?您正在开发哪些SDK,您正在使用SDK5或SDK3上的DSP作为示例?您是介于什么意思,外围设备无法接收居民的语气数据(通知/指示)?在GAPM_RESET后,您的设备应从APP_EASY_GAP_DEV_CONFIGURE()(在SDK5)函数中设置,该函数将设置设备的角色,操作等。
谢谢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.
静态void UART_RX_CALLBALL(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设备无法接收任何内容。
此外,在外围侧,我通过调用app_timer_set()来添加计时器以每1秒打印调试消息。但是,当发出APP_RESET_APP时,我观察到打印调试消息被停止。
嗨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,如何定义参数“长度”?
中央边由于超时而断开连接吗?
您是否尝试过测试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.