GithubHelp home page GithubHelp logo

Comments (15)

ctday avatar ctday commented on June 19, 2024

Sorry about the strike-through.

from adafruit_circuitpython_tinylora.

ladyada avatar ladyada commented on June 19, 2024

first, make sure you have the most recent version of all python libraires - you can use
https://stackoverflow.com/questions/2720014/how-to-upgrade-all-python-packages-with-pip
or similar
then, run the default examples and post the output
third, check your soldering, and verify you have nothing else attached on SPI

from adafruit_circuitpython_tinylora.

jerryneedell avatar jerryneedell commented on June 19, 2024

FYI -- I just verified that TinyLora_simpletest.py works with a Pi ZeroW and rfm95 bonnet
Did you try the rfm9x_radio_check.py?
What pins are you using?
I use

cs = digitalio.DigitalInOut(board.CE1)
irq = digitalio.DigitalInOut(board.D25)
rst = digitalio.DigitalInOut(board.D17)

also - I removed the use of the D13 LED for the pi. code below.

Here are the installed libraries:

-------------------------------- ---------
Adafruit-Blinka                  4.1.0    
adafruit-circuitpython-busdevice 4.0.1    
adafruit-circuitpython-framebuf  1.2.1    
adafruit-circuitpython-rfm9x     1.2.2    
adafruit-circuitpython-ssd1306   2.7.0    
adafruit-circuitpython-tinylora  2.0.2    
adafruit-io                      2.4.0    
Adafruit-PlatformDetect          2.3.0    
Adafruit-PureIO                  1.0.4    
spidev                           3.4 

code run with keys REDACTED

import time
import busio
import digitalio
import board
from adafruit_tinylora.adafruit_tinylora import TTN, TinyLoRa

# Board LED
#led = digitalio.DigitalInOut(board.D13)
#led.direction = digitalio.Direction.OUTPUT

spi = busio.SPI(board.SCK, MOSI=board.MOSI, MISO=board.MISO)

cs = digitalio.DigitalInOut(board.CE1)
irq = digitalio.DigitalInOut(board.D25)
rst = digitalio.DigitalInOut(board.D17)

# TNN Configuration
# always 4b, msb
devaddr = bytearray([REDACTED])
# always 16b, msb 
app   = bytearray([REDACTED])
# always 16b, msb
nwkey = bytearray([REDACTED])


ttn_config = TTN(devaddr, nwkey, app, country='US')

lora = TinyLoRa(spi, cs, irq, rst, ttn_config)

while True:
    data = bytearray(b"\x43\x57\x54\x46")
    print('Sending packet...')
    lora.send_data(data, len(data), lora.frame_counter)
    print('Packet sent!')
#    led.value = True
    lora.frame_counter += 1
    time.sleep(1)
#    led.value = False

from adafruit_circuitpython_tinylora.

ctday avatar ctday commented on June 19, 2024

No soldering; ordered rmf9x with headers installed. Nothing but the bonnet on RPiZero W.

All installed Python modules:

pi@LoRa-Edge:~$ pip3 list
Package Version


Adafruit-Blinka 4.1.0
adafruit-circuitpython-bitmap-font 1.0.5
adafruit-circuitpython-busdevice 4.2.1
adafruit-circuitpython-framebuf 1.2.2
adafruit-circuitpython-rfm9x 1.2.2
adafruit-circuitpython-si7021 3.1.5
adafruit-circuitpython-ssd1306 2.7.3
adafruit-circuitpython-tinylora 2.0.2
Adafruit-PlatformDetect 2.3.0
Adafruit-PureIO 1.0.4
asn1crypto 0.24.0
certifi 2018.8.24
chardet 3.0.4
cryptography 2.6.1
entrypoints 0.3
idna 2.6
keyring 17.1.1
keyrings.alt 3.1.1
pip 18.1
pycrypto 2.6.1
pyftdi 0.44.2
PyGObject 3.30.4
pyserial 3.4
python-apt 1.8.4.1
pyusb 1.0.2
pyxdg 0.25
requests 2.21.0
rpi-ws281x 4.2.3
RPi.GPIO 0.7.0
SecretStorage 2.3.1
setuptools 40.8.0
six 1.12.0
spidev 3.4
ssh-import-id 5.7
sysv-ipc 1.0.1
urllib3 1.24.1
wheel 0.32.3
pi@LoRa-Edge:~$

I don’t know where rfm9x_radio_check.py is.

pi@LoRa-Edge:$ python3 tinylora_simpletest.py
Traceback (most recent call last):
File "tinylora_simpletest.py", line 36, in
lora = TinyLoRa(spi, cs, irq, rst, ttn_config)
File "/home/pi/.local/lib/python3.7/site-packages/adafruit_tinylora/adafruit_tinylora.py", line 161, in init
raise TypeError("Can not detect LoRa Module. Please check wiring!")
TypeError: Can not detect LoRa Module. Please check wiring!
pi@LoRa-Edge:
$

from adafruit_circuitpython_tinylora.

jerryneedell avatar jerryneedell commented on June 19, 2024

it is in the guide https://learn.adafruit.com/adafruit-radio-bonnets/rfm9x-raspberry-pi-setup

from adafruit_circuitpython_tinylora.

ctday avatar ctday commented on June 19, 2024

Oh, you gave it a different name last time. Ok, that test has no console output, but “RFM9x: Detected” appears on the rfm9x screen, and all the buttons work.

from adafruit_circuitpython_tinylora.

jerryneedell avatar jerryneedell commented on June 19, 2024

Sounds good. Can you post the code that is failing? Did you set the pins correctly in tinylora_simpletest?

from adafruit_circuitpython_tinylora.

ctday avatar ctday commented on June 19, 2024

I took the pins as set in the test program. Besides, those are supposed to be set by the rfm9x board module.

I have proper LoRaWAN keys, but that shouldn’t effect the failure which occurs earlier than any use of them.

pi@LoRa-Edge:~$ less tinylora_simpletest.py
import time
import busio
import digitalio
import board
from adafruit_tinylora.adafruit_tinylora import TTN, TinyLoRa

Board LED

led = digitalio.DigitalInOut(board.D13)
led.direction = digitalio.Direction.OUTPUT

spi = busio.SPI(board.SCK, MOSI=board.MOSI, MISO=board.MISO)

RFM9x Breakout Pinouts

cs = digitalio.DigitalInOut(board.D5)
irq = digitalio.DigitalInOut(board.D6)
rst = digitalio.DigitalInOut(board.D4)

Feather M0 RFM9x Pinouts

cs = digitalio.DigitalInOut(board.RFM9X_CS)

irq = digitalio.DigitalInOut(board.RFM9X_D0)

rst = digitalio.DigitalInOut(board.RFM9X_RST)

TTN Device Address, 4 Bytes, MSB

devaddr = bytearray([0x00, 0x00, 0x00, 0x00])

TTN Network Key, 16 Bytes, MSB

nwkey = bytearray([0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00])

TTN Application Key, 16 Bytess, MSB

app = bytearray([0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00])

ttn_config = TTN(devaddr, nwkey, app, country='US')

lora = TinyLoRa(spi, cs, irq, rst, ttn_config)

while True:
data = bytearray(b"\x43\x57\x54\x46")
print('Sending packet...')
lora.send_data(data, len(data), lora.frame_counter)
print('Packet sent!')
led.value = True
lora.frame_counter += 1
time.sleep(1)
led.value = False

from adafruit_circuitpython_tinylora.

jerryneedell avatar jerryneedell commented on June 19, 2024

Those are not correct for the bonnet on a Raspberry Pi. They are for a different MCU board.
Use the ones I posted above.

from adafruit_circuitpython_tinylora.

jerryneedell avatar jerryneedell commented on June 19, 2024

Compare the settings in the "rfm9x_check" program to the ones in tinytora_simpletest.py
The rfm9x_check works... those are the correct pins for the bonnet on a Raspberry Pi. tinylora_simpltest.py also uses the RST pin, not used in the rfm9x_check.py

and there is no D13 LED on a raspberry Pi.

from adafruit_circuitpython_tinylora.

ctday avatar ctday commented on June 19, 2024

Ok. Would be nice if examples worked.

from adafruit_circuitpython_tinylora.

jerryneedell avatar jerryneedell commented on June 19, 2024

Is it working for you now? Is it OK to close this issue?

from adafruit_circuitpython_tinylora.

ctday avatar ctday commented on June 19, 2024

Working. You can close.

from adafruit_circuitpython_tinylora.

jerryneedell avatar jerryneedell commented on June 19, 2024

Don't let this discourage you. The tinylora examples were not written for the bonnet/Raspberry Pi. I think that is why you have found them confusing. They were written for a more general case of using an RFM9x breakout board (or featherwing) with a microcontroller.

from adafruit_circuitpython_tinylora.

jerryneedell avatar jerryneedell commented on June 19, 2024

Glad it is working -- good luck with your projects.

from adafruit_circuitpython_tinylora.

Related Issues (17)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.