查看SX126x的源代码
←
SX126x
跳转到:
导航
,
搜索
因为以下原因,你没有权限编辑本页:
您刚才请求的操作只有这个用户组中的用户才能使用:
用户
您可以查看并复制此页面的源代码:
== 命令接口 == === 查询接口 === * get_status() ** opcode = 0xC0, NOP ** return: RFU, Status * get_dev_errors() ** opcode = 0x17, NOP, NOP, NOP ** return: RFU, Status, OpError(15:8), OpError(7:0) * get_irq_status() ** opcode = 0x12, NOP, NOP, NOP ** return: RFU, Status, IrqStatus(15:8), IrqStatus(7:0) * get_rxbuf_status() * get_pkt_status() * get_packet_type() * get_stats() * get_rssi_inst() <br> === 设置接口 === * set_standby() * set_regulator_mode() * set_dio3_as_tcxo_ctrl() * set_dio2_as_rfswitch_ctrl() * set_buffer_base_addr() ** opc = 0x8F, tx_addr, rx_addr * set_packet_type() ** opc = 0x8A, pkt_type ** pkt_type: 0x1 lora, 0x0 gfsk * set_rf_frequency() ** opc = 0x86, rf_freq[31:24], rf_freq[23:16], rf_freq[15:8], rf_freq[7:0] ** rf_freq = Freq * Ftcxo / 2^25 * set_modulation_params() ** opc = 0x8B, param1, param2, ... param4 ** param1: SF5 (0x05) ~ SF12 (0xC) ** param2: BW7 (0x0), BW10 (0x8), BW20 (0x9), BW125 (0x4), BW250 (0x5), BW500 (0x6) ** param3: CR4/5 (0x1) CR4/6 (0x2) ... ** param4: Low Data Rate Optimize, 0x0: off; 0x1: on * set_packet_params() ** opc = 0x8C, param1, param2 ... param9 ** param1: Preamble_Len[15:8] ** param2: Preamble_Len[7:0] ** param3: Header_Type, 0x0: explicit header ** param4: Payload_Len, 0 ~ 0xFF ** param5: CRC_Type, 0x0: off; 0x1: on ** param6: Invert_IQ, 0x0: standard; 0x1: Inverted * set_pa_config() ** opc = 0x95, duty_cycle, hp_max, dev_sel, pa_lut ** * set_tx_params() ** opc = 0x8E, power, ramp_time ** power: -9 (0xF7) ~ +22 (0x16) dBm ** ramp_time: TCXO: 200us (0x4); XTAL: 20us (0x1) * set_tx() ** opc = 0x83, timeout[23:16], timeout[15:8], timeout[7:0] ** timeout = 0: Timeout disable, Tx single mode, the device will stay in TX mode utile the the packet is transmitted and returns in STBY_RC mode upon completion ** timeout = others: Timeout active, the device remains in Tx mode it returns automatically to STBY_RC mode on timer end-of-count or when a packet has been transmitted. The maximum timeout is then 262s. ** A TIMEOUT IRQ is triggered if the TX_DONE IRQ is not generated within the given timeout period ** The chip goes back to STBY_RC mode after a TIMEOUT IRQ or a TX_DONE IRQ <br> === IRQ === * set_dio_irq_params() ** opc = 0x08, irq_mask[15:8], irq_mask[7:0], dio1_mask[15:8], dio1_mask[7:0], dio2_mask[15:8], dio2_mask[7:0], dio3_mask[15:8], dio3_mask[7:0] ** irq_mask: By default, all IRQ are masked (all ‘0’) and the user can enable them one by one (or several at a time) by setting the corresponding mask to ‘1’ ** dioX_mask: The interrupt causes a DIO to be set if the corresponding bit in dioX_mask and the irq_mask are set. ** If DIO2 or DIO3 are used to control the RF Switch or the TCXO, the IRQ will not be generated even if it is mapped to the pins ** '''mask[7:0]''': CadDone, CrcErr, HeaderCrcErr, HeaderValid, SyncwordValid (FSK), PreambleDetected, RxDone, TxDone ** '''mask[9:8]''': Timeout (Rx or Tx), CadDetected * get_irq_status() ** opc = 0x12, NOP, NOP, NOP ** return: RFU, status, irq_status[15:8], irq_status[7:0] * clear_irq_status() ** opc = 0x02, param[15:8], param[7:0] ** Clears an IRQ flag in the IRQ register by setting to 1 the bit of Param corresponding to the same position. <br> === CAD === 相比 SX127x 系列只检测前导码,SX1262 可以同时检测前导码和数据部分。SX1262 通过配置 cadDetPeak 值调整检测灵敏度,cadDetPeak 越大则灵敏度越低,同时误检测也更低。 * set_cad_params() ** opc = 0x88, sym_num, det_peak, det_min, exit_mode, timeout[23:0] ** sym_num: 0x0 ~ 0x4 (1 ~ 16 Number of Symbols used for CAD) ** det_pek & det_min define the sensitivity of the LoRa modem when trying to correlate to actual LoRa preamble symbols. depend on the SF and BW, also depend on the number of symbols used to validate or not the detection. Refer to: [https://semtech.my.salesforce.com/sfc/p/E0000000JelG/a/2R000000Q1Ec/b29BFJzTZY420v0tql3kVC6nzHRQizIfWGjDfcC1Dyc?__hstc=212684107.e2bbd202caa046bc28ad87106203b771.1598594746117.1605512259450.1608889887757.3&__hssc=212684107.1.1608889887757&__hsfp=2436701568 SX126x CAD Settings] ** exit_mode: the action to be done after a CAD operation. 0x0: CAD Only; 0x1: CAD Rx (stays in RX until a packet is detected or the timer reaches the timeout defined by Timeout * 15.625 us) ** timeout: max value is 0xFFFFFF, x15.625us = 262.14s * set_cad() ** opc = 0xC5 ** After the search has completed, the device returns in STDBY_RC mode. The length of the search (CAD Timeout) is configured via the command SetCadParams(...). ** At the end of the search period, the device triggers the IRQ '''CADdone'''. If a valid signal has been detected it also generates the IRQ '''CadDetected'''. <br> === RX === * Continuous mode * Single mode * Single mode with timeout * Listen mode * set_rx() * set_rx_duty_cycle() ** opc = 0x94, rx_period[23:0], sleep_period[23:0] ** rx_window = rx_period * 15.625us, sleep_time = sleep_period * 15.625us ** Enter the RX listen mode * stop_timer_on_preamble() <br> === 读写接口 === * read_reg() ** opc = 0x1D, addr[15:8], addr[7:0], NOP, 0, 0 ... ** return: RFU, Status, Status, Status, data[0], data[1] ... ** 读多少字节,NOP 后就跟几个 0 * write_reg() ** opc = 0x0D, addr[15:8], addr[7:0], data[0], data[1] ... ** return: RFU, Status, Status, Status, Status ... ** 写多少字节,addr 后就跟几个字节 * read_buf() ** opc = 0x1E, Offset, NOP, 0, 0 ... ** return: RFU, Status, Status, data[0], data[1] ... ** 读多少字节,NOP 后就跟几个 0 * write_buf() ** opc = 0x0E, Offset, data[0], data[1] ... ** return: RFU, Status, Status, Status, Status ... ** 写多少字节,offset 后就跟几个字节 <br>
返回到
SX126x
。
个人工具
登录
名字空间
页面
讨论
变换
查看
阅读
查看源代码
查看历史
操作
搜索
导航
首页
社区专页
新闻动态
最近更改
随机页面
帮助
工具箱
链入页面
相关更改
特殊页面