当前位置:网站首页>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
边栏推荐
- GPS from getting started to giving up (19), precise ephemeris (SP3 format)
- Problems in the process of opencv300 cmake generating project
- Aggregate function with key in spark
- Why rdd/dataset is needed in spark
- Set status bar style demo
- 414. The third largest digital buckle
- GPS從入門到放弃(十三)、接收機自主完好性監測(RAIM)
- Mysql相关术语
- Checkpoint of RDD in spark
- Kohana database
猜你喜欢

Persistence / caching of RDD in spark

Why is the cluster mode of spark on Yan better than the client mode
![[Digital IC manual tearing code] Verilog automatic beverage machine | topic | principle | design | simulation](/img/75/c0656c4890795bd65874b4f2b16462.jpg)
[Digital IC manual tearing code] Verilog automatic beverage machine | topic | principle | design | simulation

数字化转型挂帅复产复工,线上线下全融合重建商业逻辑

GPS from entry to abandonment (XIV), ionospheric delay

Unity3D学习笔记6——GPU实例化(1)

Enhance network security of kubernetes with cilium

What can one line of code do?

GPS從入門到放弃(十三)、接收機自主完好性監測(RAIM)

嵌入式常用计算神器EXCEL,欢迎各位推荐技巧,以保持文档持续更新,为其他人提供便利
随机推荐
bat脚本学习(一)
Digital transformation takes the lead to resume production and work, and online and offline full integration rebuilds business logic
GPS从入门到放弃(十七) 、对流层延时
Enhance network security of kubernetes with cilium
High precision face recognition based on insightface, which can directly benchmark hongruan
Sql: stored procedures and triggers - Notes
Explain ESM module and commonjs module in simple terms
What is the RDD operator in spark
Vit paper details
JS method to stop foreach
GPS from getting started to giving up (XVIII), multipath effect
C language char, wchar_ t, char16_ t, char32_ Relationship between T and character set
GPS from getting started to giving up (19), precise ephemeris (SP3 format)
414. The third largest digital buckle
GPS从入门到放弃(十六)、卫星时钟误差和卫星星历误差
GPS从入门到放弃(十三)、接收机自主完好性监测(RAIM)
Force buckle 575 Divide candy
GPS从入门到放弃(十四)、电离层延时
Persistence / caching of RDD in spark
Five wars of Chinese Baijiu