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->report.adv_addr.addr, sizeof(struct bd_addr));
app_cancel_scanning();
}
return (KE_MSG_CONSUMED);
}
Hi 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.
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,
请找到附件。它是显示不正确的十六进制值的设备名称。我试图通过控制台打印Param-> Report.Data参数,结果是相同的。对话设备名称可以显示,我不认为它与优化问题有关,请诚挚建议。
Hi 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.
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.
此外,我还有另一个问题。在主机DSP项目中,睡眠模式是禁用。我在main_func的while循环中放了一个printf_string(“t”)。当程序由调试器运行时,打印几百个“T”,然后没有。我停止了调试器并再次运行,再打印一个“T”。这是怎么回事?我预计持续的“T”被印在印刷,请诚挚建议。
Hi 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);
Thanks MT_dialog
Hi 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?
Also, many developers requested help on I2C slave issue, will your side plan to take a look on this?
Hi Jackiechau,
邮件被发送到已注册的电子邮件地址。
Thanks MT_dialog
Hi 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?
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,
您不必发送重置命令才能重新连接到设备,大多数可能是向外设发出连接请求的方式出现问题。您能否粘贴所使用的代码以便从中央连接?您正在开发哪些SDK,您正在使用SDK5或SDK3上的DSP作为示例?您是介于什么意思,外围设备无法接收居民的语气数据(通知/指示)?在GAPM_RESET后,您的设备应从APP_EASY_GAP_DEV_CONFIGURE()(在SDK5)函数中设置,该函数将设置设备的角色,操作等。
Thanks MT_dialog
I'm using DSPS on SDK5.
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]){
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;
case '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
//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 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.
此外,在外围侧,我通过调用app_timer_set()来添加计时器以每1秒打印调试消息。但是,当发出APP_RESET_APP时,我观察到打印调试消息被停止。
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 theKE_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.
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"?
中央边由于超时而断开连接吗?
Have you tried to test the connection of DSPS central and peripheral overnight?
Actually, whatever scanning, stop scanning, connect or disconnect, central does it manually by external event. Thanks.
Hi 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.
Thanks MT_dialog
I checked SDK3 should be used because DSPS project is only available for SDK3.
Hi 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.
Thanks MT_dialog