Coder Social home page Coder Social logo

Can't get test.py to work about dragino HOT 6 CLOSED

MelBadura avatar MelBadura commented on August 16, 2024
Can't get test.py to work

from dragino.

Comments (6)

MelBadura avatar MelBadura commented on August 16, 2024 1

I just installed Raspian new and enabled SPI again and now it's working fine.
Thank you very much for your help.

from dragino.

pjb304 avatar pjb304 commented on August 16, 2024

Hi Mel,

That's not an error I've seen before. From where it appears in the code it's before it attempts to do anything with the credentials given in the dragino.ini file. I suspect the problem is that the code is failing to speak to the loRa module, but the error it's given is not particularly helpful.

Have you enabled SPI on the pi and added the extra overlay file needed for the extra CS pins?

Phil

from dragino.

MelBadura avatar MelBadura commented on August 16, 2024

Hi Phil,

yes I've done that. I also know that LoRa works on that raspi with the LMIC library. I justed wanted something in python.

from dragino.

pjb304 avatar pjb304 commented on August 16, 2024

Curious,

I'm afraid my next step for debugging would be to attach a logic analyser and check that the data flowing back and forth matches what I'd expect. To me it looks like the op_mode_bkup = self.get_mode() line (834 LoRa.py) is giving an invalid response, which then causes grief when the python tries to send the value back to the LoRa device.

from dragino.

BNNorman avatar BNNorman commented on August 16, 2024

This message:-

sys.stderr.write("Mode <- %s\n" % MODE.lookup[mode])
KeyError: 0

Tells me that the value of mode is zero and that it is not a value currently in the list of modes (key error)

If you look at dragino/SX127x/LoRa.py line 837 the rx_chain_calibration() method uses get_mode() to save a copy of the current mode which is then used on line 837 and throws an error there because get_mode() returned zero. Now, get_mode() uses SPI to read a transciever register. So as pjb304 suggested, your SPI isn't working. Well, not returning a value.

Do any LEDs on the Dragino HAT light up? If not the power is missing.
Try reseating the Dragino HAT. You may have a bad connection on the SPI bus pins.

I must say that my HAT is alive and well and never suffered this problem. I'm also using a Pi4.

Note: The dragino code , as it stands, does not support downlinks (if you are using it with TTN). I have modified my dragino.py to pass downlink messages into my code and it works just fine. If you want to know how to do that just ask, once you've gotten test.py working.

from dragino.

MelBadura avatar MelBadura commented on August 16, 2024

Thanks for your answers,
The LED is on, I will try to reset the Dragino HAT and check the SPI aswell.

from dragino.

Related Issues (19)

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.