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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
Duarte-Nunes opened this issue Jun 27, 2024 · 1 comment
Open

Running simple example #1

Duarte-Nunes opened this issue Jun 27, 2024 · 1 comment

Comments

@Duarte-Nunes
Copy link
Duarte-Nunes commented Jun 27, 2024

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.

@eabase
Copy link
eabase commented Oct 17, 2024

@Duarte-Nunes
Were you able to figure out what packages are needed here?
Did you manage to get this to run?

@fabio-busacca
BUMP

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants
0