前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >LoRa笔记01 sx1276 sx1278信号强度RSSI研究

LoRa笔记01 sx1276 sx1278信号强度RSSI研究

作者头像
twowinter
发布2020-04-17 12:04:10
2.7K0
发布2020-04-17 12:04:10
举报
文章被收录于专栏:twowintertwowinter

1 前言

RSSI信号强度是无线网络中特别被人关注的一个点,尤其是工程部署中。今天在了解LoRa SX1276的RSSI展示,搜寻了一些资料,做如下笔记留念。(留念。。。真没词用了吗。。。)

本文作者twowinter,转载请注明作者:http://blog.csdn.net/iotisan/

2 官方资料

涉及寄存器

官方英文说明

代码语言:javascript
复制
5.5.5. RSSI and SNR in LoRaTM Mode

The RSSI values reported by the LoRaTM modem differ from those expressed by the FSK/OOK modem. The following
formula shows the method used to interpret the LoRaTM RSSI values:
		RSSI (dBm) = -157 + Rssi, (when using the High Frequency (HF) port)
	or
		RSSI (dBm) = -164 + Rssi, (when using the Low Frequency (LF) port)
		
The same formula can be re-used to evaluate the signal strength of the received packet:
		Packet Strength (dBm) = -157 + Rssi, (when using the High Frequency (HF) port)
	or
		Packet Strength (dBm) = -164 + Rssi, (when using the Low Frequency (LF) port)
		
Due to the nature of the LoRa modulation, it is possible to receive packets below the noise floor. In this situation, the SNR
is used in conjunction of the PacketRssi to compute the signal strength of the received packet:
		Packet Strength (dBm) = -157 + PacketRssi + PacketSnr * 0.25 (when using the HF port and SNR < 0)
	or
		Packet Strength (dBm) = -164 + PacketRssi + PacketSnr * 0.25 (when using the LF port and SNR < 0)

Note:
1. PacketRssi (in RegPktRssiValue), is an averaged version of Rssi (in RegRssiValue). Rssi can be read at any time
(during packet reception or not), and should be averaged to give more precise results.

2. The constants, -157 and -164, may vary with the front-end setup of the SX1276/77/78/79 (LnaBoost =1 or 0,
presence of an external LNA, mismatch at the LNA input…). It is recommended to adjust these values with a single-point
calibration procedure to increase RSSI accuracy.

3. As signal strength increases (RSSI>-100dBm), the linearity of PacketRssi is not guaranteed and results will diverge
from the ideal 1dB/dB ideal curve. When very good RSSI precision is required over the whole dynamic range of the
receiver, two options are proposed:

	- Rssi in RegRssiValue offers better linearity. Rssi can be sampled during the reception of the payload (between
ValidHeader and RxDone IRQ), and used to extract a more high-signal RSSI measurement
	- When SNR>=0, the standard formula can be adjusted to correct the slope:
RSSI = -157+16/15 * PacketRssi (or RSSI = -164+16/15 * PacketRssi)

中文解读

常规情况下,公式是这样: RSSI (dBm) = -157 + Rssi, (高频口) RSSI (dBm) = -164 + Rssi, (低频口) 另外在SNR<0的噪声环境下,要按照Packet Strength (dBm) = -157 + PacketRssi + PacketSnr * 0.25 (或者低频时,Packet Strength (dBm) = -164 + PacketRssi + PacketSnr * 0.25)这样的公式。

1.PktRssiValue指单个包的信号强度,是收包这段时间内的RSSI的平均值。RssiValue指当前的信号强度。 2.数值-157以及-164会根据实际射频前端情况有差异(比如 LnaBoost 表示是否有外部LNA 这个数值与实际LNA的输入不匹配)。建议对RSSI数值做单点校准,让RSSI显示更准确。 3.当信号强度超过-100dBm之后,PacketRssi就不能保证线性,结果会偏离 1dB/dB 的曲线。因此需要做一定的校正。当SNR>0时,可以参考如下公式:RSSI = -157+16/15 * PacketRssi (or RSSI = -164+16/15 * PacketRssi)。当然SNR<0时,还要注意同样做噪声干扰的校正,在公式后面 + PacketSnr * 0.25 。

3 代码分析

代码中处理信号强度是这样,判断频段是否大于550MHz,据此来进行高频和低频的不同偏移量的处理。

代码语言:javascript
复制
int16_t SX1276ReadRssi( RadioModems_t modem )
{
	int16_t rssi = 0;

	switch( modem )
	{
	case MODEM_FSK:
		rssi = -( SX1276Read( REG_RSSIVALUE ) >> 1 );
		break;
	case MODEM_LORA:
		if( SX1276.Settings.Channel > RF_MID_BAND_THRESH )
		{
			rssi = RSSI_OFFSET_HF + SX1276Read( REG_LR_RSSIVALUE );
		}
		else
		{
			rssi = RSSI_OFFSET_LF + SX1276Read( REG_LR_RSSIVALUE );
		}
		break;
	default:
		rssi = -1;
		break;
	}
	return rssi;
}

4 范例

假如我们收到这样的信号值:

代码语言:javascript
复制
rssi cur: 61,snr: 35 
pkt rssi:113

因为测试频段是433MHz,且SNR>0,因此使用如下公式: RSSI = -164+16/15 * PacketRssi = -164 + 16/15 * 113 = -43.467

End


本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 1 前言
  • 2 官方资料
    • 涉及寄存器
      • 官方英文说明
        • 中文解读
        • 3 代码分析
        • 4 范例
        • End
        相关产品与服务
        腾讯云代码分析
        腾讯云代码分析(内部代号CodeDog)是集众多代码分析工具的云原生、分布式、高性能的代码综合分析跟踪管理平台,其主要功能是持续跟踪分析代码,观测项目代码质量,支撑团队传承代码文化。
        领券
        问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档