当前位置:网站首页>Lora sync word settings
Lora sync word settings
2022-07-06 22:14:00 【zterrorblade】
According to the sx1302 Is it 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;
}
Where the setting code is
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 Set the synchronization word related code
sx126x.h
/*!
* Syncword for Private LoRa networks
*/
#define LORA_MAC_PRIVATE_SYNCWORD 0x1424
/*!
* Syncword for Public LoRa networks
*/
#define LORA_MAC_PUBLIC_SYNCWORD 0x3444
radio.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 Set sync word 0x34
false 0x12
边栏推荐
- What is the difference between animators and animators- What is the difference between an Animator and an Animation?
- Write a rotation verification code annotation gadget with aardio
- MySQL related terms
- 二叉(搜索)树的最近公共祖先 ●●
- 关于char[]数组通过scanf赋值使用上的一些问题。。
- HDU 2008 数字统计
- GNN, please deepen your network layer~
- 小程序系统更新提示,并强制小程序重启并使用新版本
- About the professional ethics of programmers, let's talk about it from the way of craftsmanship and neatness
- Powerful domestic API management tool
猜你喜欢
数据处理技巧(7):MATLAB 读取数字字符串混杂的文本文件txt中的数据
Management background --1 Create classification
Earned value management EVM detailed explanation and application, example explanation
UNI-Admin基础框架怎么关闭创建超级管理员入口?
关于程序员的职业操守,从《匠艺整洁之道》谈起
CCNA-思科网络 EIGRP协议
[sciter]: encapsulate the notification bar component based on sciter
第4章:再谈类的加载器
【10点公开课】:视频质量评价基础与实践
Management background --3, modify classification
随机推荐
Write a rotation verification code annotation gadget with aardio
Solve project cross domain problems
BarcodeX(ActiveX打印控件) v5.3.0.80 免费版使用
GPS从入门到放弃(十三)、接收机自主完好性监测(RAIM)
Unity3d Learning Notes 6 - GPU instantiation (1)
Codeforces Round #274 (Div. 2) –A Expression
解决项目跨域问题
bat脚本学习(一)
HDR image reconstruction from a single exposure using deep CNNs阅读札记
GNN,请你的网络层数再深一点~
Bat script learning (I)
[Chongqing Guangdong education] Tianjin urban construction university concrete structure design principle a reference
i.mx6ull搭建boa服务器详解及其中遇到的一些问题
GPS from getting started to giving up (XV), DCB differential code deviation
Kohana 数据库
AI 企业多云存储架构实践 | 深势科技分享
Seata aggregates at, TCC, Saga and XA transaction modes to create a one-stop distributed transaction solution
Wechat red envelope cover applet source code - background independent version - source code with evaluation points function
GPS從入門到放弃(十三)、接收機自主完好性監測(RAIM)
GPS from getting started to giving up (XIII), receiver autonomous integrity monitoring (RAIM)