Comments (5)
The problem looks like to be related in the continuous open and close of spi port for every operation.
If I do not close it on Init() and modify every read/write like for example :
def spi_read(self, reg):
#self.spi.open(self.port,self.cs)
data = self.spi.xfer2([reg & ~SPI_WRITE_MASK, 0])
#self.spi.close()
return data[1]
xfer2 works fine.
Now the problem left is related to functions like lora.available() or lora.wait_packet_sent() that never exit.
Tony
from pyrf95.
This code was just tested with the RFM95 modules so it's nice to see the code been tested with other chips.
I don't know why the SX1276 behaves badly with the opening and closing of the spi port, but well, perhaps I need to get one of those modules to test it and for now I can leave that opening and closing as an option of the library.
That functions rely on the interrupts being generated by the LoRa module, how are you connecting the Gpio25 pin to the module? usually you need to connect DIO0, DIO1 and DIO2 pins from the LoRa module to the interrupt pin, and to do so, you'll need to put diodes to form an OR (and prevent current to flow to the other pins), like I did in my board:
Tell me if this works.
from pyrf95.
Thanks David ,
As matter of fact the problem is the interrupt feature. Looking at RadioHead examples with RaspberryPI it uses an interrupt less approach. I just added some code to also have interrupt less in your library
Constructor is now :
__init__(self,port=0,cs=0,int_pin=25,reset_pin=None):
and if int_pin = None
register reading is used instead of interrupt as in RadioHead
My branch is on : master...ToninoTarsi:master
But not yet tested.
Tony
PS. I only connected DI0 to GPIO25
from pyrf95.
This version (https://github.com/ToninoTarsi/pyRF95) works with my SX1276 in interrupt less mode.
It would be interesting to know if it works also on your device
Tony
from pyrf95.
Hello!, I'll test the code ASAP and perhaps we can merge both codebases.
I don't know why your interrupts aren't working, I've reading the SX1276 datasheet and the interrupts are the same ones than the rf95. They should be all enabled by default, but perhaps you can try to unmask all interrupts using self.spi_write(REG_11_IRQ_FLAGS_MASK, 0) at the init method. The DIO0 pin carries RX and TX interrupts, and DIO1 RX timeout interrupt, they respond to the configuration of the RegDIOMapping1 register, and the configuration is the same in the SX1276 and the rf95, so this should be ok. Do you have any means of looking at the interrupt pin (DIO0) to see if it's triggering (logic analyzer, oscilloscope in trigger mode...) ?
Anyway, good work!
David.
from pyrf95.
Related Issues (4)
- SPI port 1 HOT 2
- SPI speed HOT 1
- Error in Example Code (?)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pyrf95.