def probe_sx1262(): sys.path.append('/lib/micropySX126X') from sx1262 import SX1262 sx = SX1262(cs=SOC_GPIO_PIN_SS, irq=SOC_GPIO_PIN_DIO1, rst=SOC_GPIO_PIN_RST,\ gpio=SOC_GPIO_PIN_BUSY,clk=board.SCK, mosi=board.MOSI, miso=board.MISO) sx.reset() data = bytearray(1) data_mv = memoryview(data) SX126X_REG_LORA_SYNC_WORD_LSB = const(0x0741) SX126X_DEF_LORASYNCWORDLSB = const(0x24) state = sx.readRegister(SX126X_REG_LORA_SYNC_WORD_LSB, data_mv, 1) sx.sleep() return True if state == 0 and data[ 0] == SX126X_DEF_LORASYNCWORDLSB else False
from sx1262 import SX1262 import time sx = SX1262(cs='P5', irq='P6', rst='P7', gpio='P8') # LoRa sx.begin(freq=923, bw=500.0, sf=12, cr=8, syncWord=0x12, power=-5, currentLimit=60.0, preambleLength=8, implicit=False, implicitLen=0xFF, crcOn=True, txIq=False, rxIq=False, tcxoVoltage=1.7, useRegulatorLDO=False, blocking=True) # FSK ##sx.beginFSK(freq=923, br=48.0, freqDev=50.0, rxBw=156.2, power=-5, currentLimit=60.0, ## preambleLength=16, dataShaping=0.5, syncWord=[0x2D, 0x01], syncBitsLength=16, ## addrFilter=SX126X_GFSK_ADDRESS_FILT_OFF, addr=0x00, crcLength=2, crcInitial=0x1D0F, crcPolynomial=0x1021, ## crcInverted=True, whiteningOn=True, whiteningInitial=0x0100, ## fixedPacketLength=False, packetLength=0xFF, preambleDetectorLength=SX126X_GFSK_PREAMBLE_DETECT_16, ## tcxoVoltage=1.6, useRegulatorLDO=False, ## blocking=True)
boardID = machine.unique_id() from sx1262 import SX1262 import time import utime ################################################################################ print("This is the ", boardName, "board.") print("Unique board ID: ") for i in boardID: print(hex(i), " ", end='') print(" ") print("Initializing SX1262 radio module") sx = SX1262(cs=CS, irq=DIO1, rst=RESET, gpio=BUSY) # LoRa # freq = 867.1, 867.3, 867.5, 867.7, 867.9, 868.1, (868.3), 868.5 # bw = 125.0, 250.0 # sf = 5 - 12 # cr = 5 - 8 # power = -9 - (-5) - +22 # preambleLength = 8 sx.begin(freq=868.3, bw=250.0, sf=7, cr=8, syncWord=0x12, power=5, currentLimit=60.0,