是用于获得RSSI正确的方式吗?

⚠️
Hi there.. thanks for coming to the forums. Exciting news! we’re now in the process of moving to our new forum platform that will offer better functionality and is contained within the main Dialog website. All posts and accounts have been migrated. We’re now accepting traffic on the new forum only - please POST any new threads at//www.xmece.com/support. We’ll be fixing bugs / optimising the searching and tagging over the coming days.
8 posts / 0 new
Last post
2228266166
Offline
Last seen:2 years 2 months ago
加入:2018-08-07 07:43
是用于获得RSSI正确的方式吗?

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)
}

我打开计时器0,并在计时器0中断中使用app_easy_gap_get_con_rssi()函数中断。在gagc_con_rssi_ind_handler()函数中,l可以获得rssi的值。
please tell me whether this method is correct or not .

Device:
PM_Dialog
Offline
Last seen:7小时4分钟前
工作人员
加入:2018-02-08 11:03
你好呀,

你好呀,

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

2228266166
Offline
Last seen:2 years 2 months ago
加入:2018-08-07 07:43
Hi,

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 .

PM_Dialog
Offline
Last seen:7小时4分钟前
工作人员
加入:2018-02-08 11:03
你好呀,

你好呀,

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

2228266166
Offline
Last seen:2 years 2 months ago
加入:2018-08-07 07:43
In case of a connection ,i

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?
谢谢。

PM_Dialog
Offline
Last seen:7小时4分钟前
工作人员
加入:2018-02-08 11:03
Hi,

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

azimin
Offline
Last seen:6 months 5 hours ago
加入:2018-12-12十二11
Hello, how do you call

Hello, how do you call function "gapc_con_rssi_ind_handler" ?
谢谢

PM_Dialog
Offline
Last seen:7小时4分钟前
工作人员
加入:2018-02-08 11:03
Hi azimin,

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