Dear support,
I want to get the value of the rssi every 10 ms when the da14580 device is connected .At present ,i write a function below.
void app_easy_gap_get_con_rssi(uint8_t connection_idx)
{
ASSERT_WARNING(connection_idx < APP_EASY_MAX_ACTIVE_CONNECTION);
struct gapc_get_info_cmd *cmd = KE_MSG_ALLOC(GAPC_GET_INFO_CMD,
KE_BUILD_ID(TASK_GAPC, connection_idx),
TASK_APP,
gapc_get_info_cmd);
cmd->operation = GAPC_GET_CON_RSSI;
ke_msg_send(cmd);
}
int gagc_con_rssi_ind_handler(ke_msg_id_t const msgid,
struct gapc_con_rssi_ind const *param,
ke_task_id_t const dest_id,
ke_task_id_t const src_id)
{
rssi_buf[i]=param->rssi;
i++;
if(i==16)
i=0;
return (KE_MSG_CONSUMED)
}
I open timer 0,and use app_easy_gap_get_con_rssi() function in the timer 0 interrupt.In gagc_con_rssi_ind_handler() function ,l can get the value of rssi.
please tell me whether this method is correct or not .
Hi There,
In order to get the RSSI values, you should send a GAPC_GET_INFO_CMD with a GAPC_GET_CON_RSSI as the operation of the command. After that the stack will respond with a GAPC_CON_RSSI_IND and the application can retrieve the rssi value from the application. As I am able to see from the app_easy_gap_get_con_rssi() you send a GAPC_GET_INFO_CMD command to the stack with the GAPC_GET_CON_RSSI operation. However, I need some clarifications – information about your code architecture. If I understand correctly, your application executes the app_easy_gap_get_con_rssi() upon the app_easy_timer expiration, which is 10ms? Can you please share how you handle the timer 0 in order to get the rssi values every 10ms? Could you please let me know if you are able to get the rssi values every 10 ms? The gagc_con_rssi_ind_handler() is executed when you get the GAPC_CON_RSSI_IND? Your code seems to be correct. Please provide me these clarifications and then I will try to test it from my side and I will let you know.
谢谢, PM_Dialog
Hi,
In fact ,i use app_easy_gap_get_con_rssi() function in the timer 0 interrupt.I send a GAPC_GET_INFO_CMD with a GAPC_GET_CON_RSSI as the operation of the command every 10ms ,but not get the value of rssi .
Hi There,
The RSSI value of the advertising message is included in the packet you receive when you get an advertising indication. When the central gets the advertising packet a GAP_ADV_REPORT_IND is triggered and should be handled in order to extract the rssi. In case of a connection you should explicitly send a message to the stack (GAPC_GET_INFO_CMD) in order to get the rssi (check the RW_BLE_GAP_IS pdf). Could you please clarify which is your issue?
谢谢, PM_Dialog
In case of a connection ,i send GAPC_GET_INFO_CMD to the stack every 10ms inorder to get the rssi.However,i find it that the value of rssi is very unstable in the same distance.Could you please give me a Code routines?
谢谢.
Hi,
As it has already been mentioned in this thread, you can obtain the RSSI while in connection by using the GAPC_GET_INFO_CMD with the GAPC_CON_RSSI_IND operation, as you have already implemented in you application and you can get the rssi values. Please check the RW-BLE-GAP-IS.pdf). Also, please check the FAQ in the Software Implementation section "How to read and convert the RSSI value to dBm?". The most possible reason why you get unstable values is that a noise is added into your signal. Can you please clarify how much unstable are the rssi values? Are you using a custom board or any of our development boards?
Also, you can refer to the SDK 5.0.4\5.0.4\projects\host_apps\windows\proximity\monitor\src\app_task.c file, the implementation of the gapc_con_rssi_ind_handler function. You can port the gapc_con_rssi_ind_handler function into your code.
If you found any of the above answers useful please mark one of them as accepted.
谢谢, PM_Dialog
Hello, how do you call function "gapc_con_rssi_ind_handler" ?
谢谢
Hi azimin,
I would recommend you to have a look into the gapc_con_rssi_ind_handler() from proximity Monitor application from SDK Host Apps.
谢谢, PM_Dialog