DA14585 rssi convert to dbm

Learn MoreFAQsTutorials

4 posts / 0 new
Last post
moiify
Offline
Last seen:4 days 12 hours ago
加入:2020-03-12 07:26
DA14585 rssi convert to dbm

hi dialog

i have made a distance test ,use da14585 and one beacon. It seems that the API provided by the SDK does not match the reality。

i use

uint8_t ble_rf_rssi_convert(uint8_t rssi_reg) { // NOTE: Approximate conversion corresponding to the following formula: // dBm = (0.474f * rssi) - 112.4f. return ((rssi_reg >> 1U) - 112U); }

I put the test results in the following pdf,Please pay attention to the form。thank you very much

Device:
PM_Dialog
Offline
Last seen:1 day 11 hours ago
Staff
加入:2018-02-08 11:03
Hi moiify,

Hi moiify,

Can you please share the procedure you are following in order to get the RSSI and convert to dBm? Any code snippets to replicate it would be very helpful.

Thanks, PM_Dialog

moiify
Offline
Last seen:4 days 12 hours ago
加入:2020-03-12 07:26
typedef struct {
typedef struct { uint8_t evt_type; ///Advertising address type: public/random uint8_t adv_addr_type; ///Advertising address value struct bd_addr adv_addr; ///Data length in advertising packet uint8_t data_len; ///Data of advertising packet uint8_t data[ADV_DATA_LEN]; ///RSSI value for advertising packet uint8_t rssi; }ST_SCAN_INFO; void default_app_adv_report_ind(struct gapm_adv_report_ind const *param) { ble_scan_cb((ST_SCAN_INFO *)param); } int8_t ble_rf_rssi_convert(uint8_t rssi_reg) { // NOTE: Approximate conversion corresponding to the following formula: // dBm = (0.474f * rssi) - 112.4f. return ((rssi_reg >> 1U) - 112U); } void ble_scan_cb(ST_SCAN_INFO *param) { ST_BLE_SCAN_RESULT scan_result = {NULL, 0, NULL, 0}; TBEACON_INFO_STR *tBeaconInfoStr = NULL; int8_t dbm = 0; dbm = ble_rf_rssi_convert(param->rssi); }

I use the above code for development and test. Please have a look. Thank you very much!

PM_Dialog
Offline
Last seen:1 day 11 hours ago
Staff
加入:2018-02-08 11:03
Hi moiify,

Hi moiify,

In order to convert the RSSI to real dBm, you will just need to read the rssi value as a signed value. The RSSI is reported by the stack in the advertising structure (gapm_adv_report_ind) that comes as a parameter in the app_on_adv_report_ind. To do so, in the advertising report callback you should get the RSSI value (param->report.rssi) and converted to signed value.

For example :

uint8_t rssi = param->report.rssi ;

如果rssi = 0 xcd,你应该把它转换成igned value which is -51dBm.

The value is automatically converted in dbm when you get it from the advertising report via the rf_rssi_convert() in rf_585.c file. That function is passed on the stack and the stack performs the conversion for you. You will not need to recall this function in order to convert the rssi to dbm.

Thanks, PM_Dialog