8000 Running simple example · Issue #1 · fabio-busacca/sdr-lora · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Running simple example #1
Open
Open
@Duarte-Nunes

Description

@Duarte-Nunes

Hello, recently i've taken an interest in researching Lora and i'm on the beginning steps. Let me start by congratulating you on this repository it goes a long way to push open source Lora research forward.

I came up with a simple example that excludes the radio and simply tries to generate Lora samples:


import lora
import lora_utils
import numpy as np

bandwidth = 125000
center_freq = 868e6
sample_rate = 1e6

srcID = 0
dstID = 1

SF = 7

data_array = np.random.randint(255, size=(500), dtype=np.uint8)


packet_size = 250

CR = 1

data = lora_utils.pack_lora_data(
    data_array, SF, bandwidth, packet_size, srcID, dstID, extended_sqn=False, CR=CR)

for pkt in data:
    samples = lora.encode(center_freq, pkt.SF, pkt.BW, pkt.payload, sample_rate, pkt.src, pkt.dst, pkt.seqn, 1, 1, 0, 8)

However when running this code i come across this error:

/home/duarte.nunes/PlutoSDR/code/sdr-lora/lora.py:176: RuntimeWarning: overflow encountered in scalar multiply
  int(n_bits_hdr + n_blk_tot * n_bits_blk), dtype=np.uint8)
Traceback (most recent call last):
  File "/home/duarte.nunes/PlutoSDR/code/sdr-lora/tx_rx_no_radio.py", line 25, in <module>
    samples = lora.encode(center_freq, pkt.SF, pkt.BW, pkt.payload, sample_rate, pkt.src, pkt.dst, pkt.seqn, 1, 1, 0, 8)

  File "/home/duarte.nunes/PlutoSDR/code/sdr-lora/lora.py", line 926, in encode
    complex_samples = complex_lora_packet(K, preamble_bits, implicit_header, cr, enable_crc, src, dst, seqn, BW, OSF, SF, Trise, N,

  File "/home/duarte.nunes/PlutoSDR/code/sdr-lora/lora.py", line 891, in complex_lora_packet
    p = lora_packet(BW, OSF, SF, k1, k2, n_pr, IH, CR, MAC_CRC,

  File "/home/duarte.nunes/PlutoSDR/code/sdr-lora/lora.py", line 28, in lora_packet
    [PAYLOAD, n_sym_payload] = lora_payload_init(

  File "/home/duarte.nunes/PlutoSDR/code/sdr-lora/lora.py", line 180, in lora_payload_init
    PAYLOAD[8 * 3 + byte_range] = num2binary(LENGTH, 8)

IndexError: index 31 is out of bounds for axis 0 with size 24

I've tried tinkering with the parameters but it seems that there is always a missmatch in array sizes.

Do you have any insights on what might be causing this? Thank you for your time.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0