ehong-tl / micropySX126X

Semtech SX126X LoRa driver for Micropython and CircuitPython.
MIT License
98 stars 22 forks source link

Can't seem to get it to work with Waveshare RP2040-Lora LF board #26

Open nwgat opened 4 months ago

nwgat commented 4 months ago

had to change to tcxoVoltage=0 because the example code one just fails to run

Send

import time

sx = SX1262(spi_bus=1, clk=14, mosi=15, miso=24, cs=13, irq=16, rst=23, gpio=18)

# LoRa
sx.begin(freq=433, sf=12, cr=8, syncWord=0x12,
         power=1, currentLimit=60.0, preambleLength=8,
         implicit=False, implicitLen=0xFF,
         crcOn=True, txIq=False, rxIq=False,
         tcxoVoltage=0, useRegulatorLDO=False, blocking=True)

while True:
    sx.send('Hello World!')
    time.sleep(10)

Receive

import time

sx = SX1262(spi_bus=1, clk=14, mosi=15, miso=24, cs=13, irq=16, rst=23, gpio=18)

# LoRa
sx.begin(freq=433, sf=12, cr=8, syncWord=0x12,
         power=1, currentLimit=60.0, preambleLength=8,
         implicit=False, implicitLen=0xFF,
         crcOn=True, txIq=False, rxIq=False,
         tcxoVoltage=0, useRegulatorLDO=False, blocking=True)
while True:
    msg, err = sx.recv()
    if len(msg) > 0:
        error = SX1262.STATUS[err]
        print(msg)
        print(error)

image

the board pinout RP2040-LoRa-HF-details-11 rp2040-lora-lf-1_1 rp2040-lora-lf-kit-5

ehong-tl commented 4 months ago

Hi,

You need to manually switch pin 17 to TX or RX mode before you TX or RX as this is not implemented in the library.

image