当前位置:网站首页>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 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设置同步字 0x34
false 0x12
边栏推荐
- 1292_FreeROS中vTaskResume()以及xTaskResumeFromISR()的实现分析
- 【sciter】: 基于 sciter 封装通知栏组件
- 强化学习-学习笔记5 | AlphaGo
- Guava: three ways to create immutablexxx objects
- ViT论文详解
- Tiktok will push the independent grass planting app "praiseworthy". Can't bytes forget the little red book?
- GPS from entry to abandonment (XVII), tropospheric delay
- Kohana database
- OpenCV300 CMake生成project在项目过程中的问题
- LeetCode学习记录(从新手村出发之杀不出新手村)----1
猜你喜欢
Leetcode learning records (starting from the novice village, you can't kill out of the novice Village) ---1
ViT论文详解
数字化转型挂帅复产复工,线上线下全融合重建商业逻辑
GNN, please deepen your network layer~
Adjustable DC power supply based on LM317
Powerful domestic API management tool
C how to set two columns comboboxcolumn in DataGridView to bind a secondary linkage effect of cascading events
1292_FreeROS中vTaskResume()以及xTaskResumeFromISR()的实现分析
make menuconfig出现recipe for target ‘menuconfig‘ failed错误
2020 Bioinformatics | GraphDTA: predicting drug target binding affinity with graph neural networks
随机推荐
C language char, wchar_ t, char16_ t, char32_ Relationship between T and character set
Why rdd/dataset is needed in spark
MariaDB database management system learning (I) installation diagram
搜素专题(DFS )
C language: comprehensive application of if, def and ifndef
GPS从入门到放弃(十一)、差分GPS
[Digital IC manual tearing code] Verilog automatic beverage machine | topic | principle | design | simulation
2020 Bioinformatics | GraphDTA: predicting drug target binding affinity with graph neural networks
From campus to Tencent work for a year of those stumbles!
PostgreSQL modifies the password of the database user
PostgreSQL 安装gis插件 CREATE EXTENSION postgis_topology
Method return value considerations
JS method to stop foreach
HDU 2008 数字统计
Make menuconfig has a recipe for target 'menuconfig' failed error
GNN,请你的网络层数再深一点~
Happy sound 2[sing.2]
MariaDb数据库管理系统的学习(一)安装示意图
Broadcast variables and accumulators in spark
Mongodb (III) - CRUD