查看LoRa的源代码
←
LoRa
跳转到:
导航
,
搜索
因为以下原因,你没有权限编辑本页:
您刚才请求的操作只有这个用户组中的用户才能使用:
用户
您可以查看并复制此页面的源代码:
== Key Concepts == === Spreading Factor === [[文件:Sx1278-spreading-factor.png]] '''Note:''' The Spreading Factor must be known in advance on both transmit and receive sides of the link as different spreading factors are orthogonal to each other Spreading Factor 6: * Set Spreading Factor = 6 in Reg_ModemConfig2 * The head must be set to Implicit mode (Reg_ModemConfig1[0] := 1) * Set the DetectionOptimize of Reg_LoRaDetectOptimize to value '0b101' * Write 0x0C in the RegDetectionThreshold <source lang=cpp> void sx1278_set_spread_fact(uint8_t factor) { uint8_t d; d = sx1278_read_reg(REG_MODEMCONFIG2); d = (d & MODEMCONFIG2_SF_MASK) | (factor << 4); sx1278_write_reg(REG_MODEMCONFIG2, d); if (factor == 6) { sx1278_write_reg(REG_DETECTIONOPTIMIZE, 0x5); sx1278_write_reg(REG_DETECTIONTHRESHOLD, 0xC); } else { sx1278_write_reg(REG_DETECTIONOPTIMIZE, 0x3); sx1278_write_reg(REG_DETECTIONTHRESHOLD, 0xA); } } /* Reg_ModemConfig1[0] */ void sx1278_set_head_on(bool enable) { uint8_t rxd; rxd = sx1278_read_reg(REG_MODEMCONFIG1); rxd = (rxd & MODEMCONFIG1_IMPLICITHEADER_MASK) | (enable); sx1278_write_reg(REG_MODEMCONFIG1, rxd); } </source> <br> === Signal Bandwidth === [[文件:Sx1278-signal-bandwidth.png]] * Reg_ModemConfig[7:4] * In the lower band (169MHz), signal bandwidths 8 & 9 are not supported '''Note:''' The Spreading Factor must be known in advance on both transmit and receive sides of the link <source lang=cpp> /* * Lora band width * 0: 7.8 kHz, 1: 10.4 kHz, 2: 15.6 kHz, 3: 20.8 kHz, * 4: 31.2 kHz,5: 41.6 kHz, 6: 62.5 kHz, 7: 125 kHz, * 8: 250 kHz, 9: 500 kHz, other: Reserved */ void sx1278_set_bandwidth(uint8_t bw) { uint8_t d; d = sx1278_read_reg(REG_MODEMCONFIG1); d = (d & MODEMCONFIG1_BW_MASK) | (bw << 4); sx1278_write_reg(REG_MODEMCONFIG1, d); } </source> <br> === Coding Rate === [[文件:Sx1278-coding-rate.png]] * Reg_ModemConfig[3:1] * 1 --- > 4/5 * 2 ---> 4/6 * 3 ---> 4/7 * 4 ---> 4/8 <source lang=cpp> /* * Lora Error Coding: * * 1: 4/5, 2: 4/6, 3: 4/7, 4: 4/8 */ void sx1278_set_error_coding(uint8_t value) { uint8_t d; d = sx1278_read_reg(REG_MODEMCONFIG1); d = (d & MODEMCONFIG1_CODINGRATE_MASK) | (value << 1); sx1278_write_reg(REG_MODEMCONFIG1, d); } /* Reg_ModemConfig2[2] */ void sx1278_set_crc_on(bool enable) { uint8_t d; d = sx1278_read_reg(REG_MODEMCONFIG2); d = (d & MODEMCONFIG2_RXPAYLOADCRC_MASK) | (enable << 2); sx1278_write_reg(REG_MODEMCONFIG2, d); } </source> <br><br> == LoRaWAN Settings == === Uplink TX === [[文件:LoRaWAN-uplink-settins.png]] <br><br> == TX == * Static configuration registers can only be accessed in Sleep, Standby or FSTX mode * The LoRa FIFO can only be filled in Standby mode * Data TX is initiated by sending TX mode request * Upon completion the TxDone interrupt is issued and the radio returns to Standby mode * Following transmission the radio can be manually placed in Sleep mode or the FIFO refilled for subsequent TX operation LoRa TX data FIFO filling: * Set Reg_FifoAddrPtr to Reg_FifoTxBaseAddr * Write PayloadLength bytes to the FIFO (Reg_Fifo) Reg_Fifo 是 FIFO 的统一读写口,SPI 读写 Reg_Fifo,就会去 FIFO 内部地址为 Reg_FifoAddrPtr 的位置取放数据 TX_Modem 直接去 FIFO 地址为 Reg_FifoTxBaseAddr 的位置,取 PayloadLength 字节的数据 <br><br> == TX Power == 1. Set Reg_PaConfig[7:7] to select PA output pin * 0 to select RFO pin, Output power is limited to +14 dBm (25mW) * 1 to select PA_BOOST pin, Output power is limited to +20 dBm (100mW) 2. Set Reg_PaConfig[6:4] to select max output power * Pmax = 10.8 + 0.6 * MaxPower [dBm], valide when user select the RFO pin as the output 3. Set Reg_PaConfig[3:0] to select OutputPower * Pout = Pmax - (15 - OutputPower) if PaSelect = 1 (RFO pin) * Pout = 17 - (15 - OutputPower) if PaSelect = 1 (PA_BOOST pin) <source lang=cpp> void sx1278_set_rf_maxpower() { sx1278_write_reg(REG_PACONFIG, 0x8F); } </source> <br><br> == Schematics == === inair4 === [[文件:Sx1276-sch.png]] http://modtronix.com/prod/imod/inair4/inair4_r1_sch.pdf <br><br> == MCU Spec == [[文件:LoRaWAN-MCU-spec.png]] <br><br> == Chip == [[文件:SX1276-77-78-79 .png]] === SX1278 === [http://www.semtech.com/images/datasheet/sx1276_77_78_79.pdf SX1278 Datasheet] * http://www.semtech.com/wireless-rf/rf-transceivers/sx1278/ * http://www.semtech.com/images/datasheet/LoraLowEnergyDesign_STD.pdf * http://www.semtech.com/images/datasheet/LoraDesignGuide_STD.pdf * http://www.semtech.com/images/datasheet/AN1200.19_SX127x_RefDesign_STD.pdf * http://www.semtech.com/images/datasheet/an120014-xo-guidance-lora-modulation.pdf * [http://www.semtech.com/images/datasheet/SX1272_settings_for_LoRaWAN_v2.0.pdf Recommended SX1272 Settings for EU868 LoRaWAN Network Operation] <br><br> == Reference == * http://www.semtech.com/wireless-rf/rf-transceivers/ * http://cpham.perso.univ-pau.fr/LORA/RPIgateway.html <br><br> <br><br> <br><br> <br><br> <br><br> <br><br> <br><br> <br><br> <br><br> <br><br> <br><br>
返回到
LoRa
。
个人工具
登录
名字空间
页面
讨论
变换
查看
阅读
查看源代码
查看历史
操作
搜索
导航
首页
社区专页
新闻动态
最近更改
随机页面
帮助
工具箱
链入页面
相关更改
特殊页面