Skip to main content

DA14585 rssi convert to dbm

1 year ago

DA14585 rssi convert to dbm

Posted bymoiify0 points 3 replies
0 upvotes

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

Attachment Size
DA14585信号强度测试.pdf 267.64 KB

1 year ago

PM_Dialog

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

1 year ago

moiify 0 points
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!

1 year ago

PM_Dialog

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,你应该转换it to signed 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