当前位置:网站首页>lora同步字设置
lora同步字设置
2022-07-06 14:09:00 【zterrorblade】
据sx1302是否为public network,loragw_sx1302.c
int sx1302_lora_syncword(bool public, uint8_t lora_service_sf) {
/* Multi-SF modem configuration */
DEBUG_MSG("INFO: configuring LoRa (Multi-SF) SF5->SF6 with syncword PRIVATE (0x12)\n");
lgw_reg_w(SX1302_REG_RX_TOP_FRAME_SYNCH0_SF5_PEAK1_POS_SF5, 2);
lgw_reg_w(SX1302_REG_RX_TOP_FRAME_SYNCH1_SF5_PEAK2_POS_SF5, 4);
lgw_reg_w(SX1302_REG_RX_TOP_FRAME_SYNCH0_SF6_PEAK1_POS_SF6, 2);
lgw_reg_w(SX1302_REG_RX_TOP_FRAME_SYNCH1_SF6_PEAK2_POS_SF6, 4);
if (public == true) {
DEBUG_MSG("INFO: configuring LoRa (Multi-SF) SF7->SF12 with syncword PUBLIC (0x34)\n");
lgw_reg_w(SX1302_REG_RX_TOP_FRAME_SYNCH0_SF7TO12_PEAK1_POS_SF7TO12, 6);
lgw_reg_w(SX1302_REG_RX_TOP_FRAME_SYNCH1_SF7TO12_PEAK2_POS_SF7TO12, 8);
} else {
DEBUG_MSG("INFO: configuring LoRa (Multi-SF) SF7->SF12 with syncword PRIVATE (0x12)\n");
lgw_reg_w(SX1302_REG_RX_TOP_FRAME_SYNCH0_SF7TO12_PEAK1_POS_SF7TO12, 2);
lgw_reg_w(SX1302_REG_RX_TOP_FRAME_SYNCH1_SF7TO12_PEAK2_POS_SF7TO12, 4);
}
/* LoRa Service modem configuration */
if ((public == false) || (lora_service_sf == DR_LORA_SF5) || (lora_service_sf == DR_LORA_SF6)) {
DEBUG_PRINTF("INFO: configuring LoRa (Service) SF%u with syncword PRIVATE (0x12)\n", lora_service_sf);
lgw_reg_w(SX1302_REG_RX_TOP_LORA_SERVICE_FSK_FRAME_SYNCH0_PEAK1_POS, 2);
lgw_reg_w(SX1302_REG_RX_TOP_LORA_SERVICE_FSK_FRAME_SYNCH1_PEAK2_POS, 4);
} else {
DEBUG_PRINTF("INFO: configuring LoRa (Service) SF%u with syncword PUBLIC (0x34)\n", lora_service_sf);
lgw_reg_w(SX1302_REG_RX_TOP_LORA_SERVICE_FSK_FRAME_SYNCH0_PEAK1_POS, 6);
lgw_reg_w(SX1302_REG_RX_TOP_LORA_SERVICE_FSK_FRAME_SYNCH1_PEAK2_POS, 8);
}
return LGW_REG_SUCCESS;
}其中设置代码为
if (public == true) {
DEBUG_MSG("INFO: configuring LoRa (Multi-SF) SF7->SF12 with syncword PUBLIC (0x34)\n");
lgw_reg_w(SX1302_REG_RX_TOP_FRAME_SYNCH0_SF7TO12_PEAK1_POS_SF7TO12, 6);
lgw_reg_w(SX1302_REG_RX_TOP_FRAME_SYNCH1_SF7TO12_PEAK2_POS_SF7TO12, 8);
} else {
DEBUG_MSG("INFO: configuring LoRa (Multi-SF) SF7->SF12 with syncword PRIVATE (0x12)\n");
lgw_reg_w(SX1302_REG_RX_TOP_FRAME_SYNCH0_SF7TO12_PEAK1_POS_SF7TO12, 2);
lgw_reg_w(SX1302_REG_RX_TOP_FRAME_SYNCH1_SF7TO12_PEAK2_POS_SF7TO12, 4);
}sx126x设置同步字相关代码
sx126x.h
/*!
* Syncword for Private LoRa networks
*/
#define LORA_MAC_PRIVATE_SYNCWORD 0x1424
/*!
* Syncword for Public LoRa networks
*/
#define LORA_MAC_PUBLIC_SYNCWORD 0x3444radio.c
void RadioSetPublicNetwork( bool enable )
{
RadioPublicNetwork.Current = RadioPublicNetwork.Previous = enable;
RadioSetModem( MODEM_LORA );
if( enable == true )
{
// Change LoRa modem SyncWord
SX126xWriteRegister( REG_LR_SYNCWORD, ( LORA_MAC_PUBLIC_SYNCWORD >> 8 ) & 0xFF );
SX126xWriteRegister( REG_LR_SYNCWORD + 1, LORA_MAC_PUBLIC_SYNCWORD & 0xFF );
}
else
{
// Change LoRa modem SyncWord
SX126xWriteRegister( REG_LR_SYNCWORD, ( LORA_MAC_PRIVATE_SYNCWORD >> 8 ) & 0xFF );
SX126xWriteRegister( REG_LR_SYNCWORD + 1, LORA_MAC_PRIVATE_SYNCWORD & 0xFF );
}
}public network true设置同步字 0x34
false 0x12
边栏推荐
- 功能强大的国产Api管理工具
- MariaDb数据库管理系统的学习(一)安装示意图
- 【MySQL】Online DDL详解
- Embedded common computing artifact excel, welcome to recommend skills to keep the document constantly updated and provide convenience for others
- PostgreSQL 安装gis插件 CREATE EXTENSION postgis_topology
- C language char, wchar_ t, char16_ t, char32_ Relationship between T and character set
- LeetCode学习记录(从新手村出发之杀不出新手村)----1
- 【sciter】: 基于 sciter 封装通知栏组件
- 嵌入式常用计算神器EXCEL,欢迎各位推荐技巧,以保持文档持续更新,为其他人提供便利
- Wechat red envelope cover applet source code - background independent version - source code with evaluation points function
猜你喜欢

【MySQL】Online DDL详解

Checkpoint of RDD in spark

MPLS experiment

How does the uni admin basic framework close the creation of super administrator entries?
![Leetcode topic [array] -118 Yang Hui triangle](/img/77/d8a7085968cc443260b4c0910bd04b.jpg)
Leetcode topic [array] -118 Yang Hui triangle

小满网络模型&http1-http2 &浏览器缓存

Microsoft technology empowerment position - February course Preview

JS method to stop foreach

GPS from getting started to giving up (XV), DCB differential code deviation

Adjustable DC power supply based on LM317
随机推荐
GPS从入门到放弃(十三)、接收机自主完好性监测(RAIM)
GPS from getting started to giving up (XVIII), multipath effect
50 commonly used numpy function explanations, parameters and usage examples
Univariate cubic equation - relationship between root and coefficient
AI 企业多云存储架构实践 | 深势科技分享
Bat script learning (I)
PostgreSQL install GIS plug-in create extension PostGIS_ topology
Force buckle 575 Divide candy
Oracle Performance Analysis 3: introduction to tkprof
How does the uni admin basic framework close the creation of super administrator entries?
C language: comprehensive application of if, def and ifndef
基于InsightFace的高精度人脸识别,可直接对标虹软
用aardio写一个旋转验证码标注小工具
Yyds dry goods inventory C language recursive implementation of Hanoi Tower
From campus to Tencent work for a year of those stumbles!
GPS从入门到放弃(十五)、DCB差分码偏差
Adjustable DC power supply based on LM317
【10点公开课】:视频质量评价基础与实践
微信红包封面小程序源码-后台独立版-带测评积分功能源码
保存和检索字符串