Code Monkey home page Code Monkey logo

lora's Introduction

LoRa

This is a LoRa device driver as a Linux kernel module with IEEE 802.15.4 MAC interfaces.

The driver with file operation interfaces could be found at the file-ops branch.

Compatible Chips

  • Semtech SX1276/77/78/79

Folders

  • LoRa: The LoRa source and build files.
  • dts-overlay: The device tree overlayers with the boards and operating systems.
  • test-application: The user space applications for testing or demo.

Build and Install

  1. Build
cd LoRa
make
  1. Install
make install
  1. Load module
modprobe sx1278

If the target uses Device Tree mechanism like some embedded systems, Raspberry Pi for example. Its device tree may need to be updated first. There is a device tree overlay for Raspberry Pi in the dts-overlay folder for example. Just make in the folder, than it will compile and install the device tree overlay, and reboot is needed.

  1. Check the installed module
dmesg

License

Under Dual BSD/GPL

Contributors

  • Jian-Hong, Pan
  • Dmitry Shmidt

lora's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

lora's Issues

Can't make module on raspberry pi3

when i type "make"...
make -C /lib/modules/4.9.59+/build M=/tmp/LoRa/LoRa modules
make[1]: Entering directory '/lib/modules/4.9.59+/build'
make[1]: *** No rule to make target 'modules'. Stop.
make[1]: Leaving directory '/lib/modules/4.9.59+/build'
Makefile:8: recipe for target 'all' failed
make: *** [all] Error 2

G5 maybe -36 db more than -26 db in LnaGain of RegLna

In SX1276/77/78/79 DATASHEET , page 86 said G5 is -26 db, page 95 said G5 is -36 db, page 109 didn't describe G5.

this repository use -25 db

some repository on github.com use -36 db , e.g.

https://github.com/TomasTT7/LoRa_SSDV/blob/d969fdca6e8de65e5127c9729db4a3cb64190ca3/Station/ProMini_LoRa_Station.ino#L576

and

https://github.com/chisl/SX1272-py2/blob/5ab7fa581c40376bd5e2a3406b13c8bb47b2c014/SX1272_FSK.py#L226

Could you take some time to ensure if it's necessary to use -36 db instead of -26 db in this repository?

6LoWPAN Communications Using Global Addresses

I would like to communicate with 6LoWPAN using 2 raspberry pies and 2 sx1278 modules.
Do you know how to communicate using global addresses?
I look forward to your reply.
Thank you!!

dts compile warnings

uploaded my staging here:
https://github.com/frank-w/BPI-R2-4.14/tree/4.19-lora_new

created a separate dts for bpi-r2 where only spi0 is defined (no spidev), so only the top-node (fragment 0) brings this warning

make CROSS_COMPILE=arm-linux-gnueabihf- ARCH=arm
dtc -I dts -O dtb -@ -o bpi-r2-lora-spi.dtbo bpi-r2-lora-spi-overlay.dts
bpi-r2-lora-spi.dtbo: Warning (unit_address_vs_reg): Node /fragment@0 has a unit name, but no reg property

I. got same warnings if i try compiling rpi dts

Use regmap rather than SPI directly

"regmap" is a proportion of I2C and SPI device drivers in the kernel contain some very similar code for accessing the register maps of hardware connected to those buses.
Use regmap can make the driver more portable.

Unable to make

Hello,

I'm trying to install the drivers on a Raspberry Pi (Linux LoraPi 6.1.21-v7+ #1642 SMP Mon Apr 3 17:20:52 BST 2023 armv7l GNU/Linux) and I'm having the following error while trying to make. This is the current error:

make -C /lib/modules/6.1.21-v7+/build M=/home/lora/LoRa/LoRa modules
make[1]: *** /lib/modules/6.1.21-v7+/build: No such file or directory.  Stop.
make: *** [Makefile:8: all] Error 2

Any advice?

Thanks!

Victor

How can I test the lora driver?

Hi, I just cross compile the driver and install successful, if I type "ifconfig" cmd I can found the wpan0 site like this
`[root@TW-G01] /mnt/sda1/twiot/ko/lora# ifconfig
eth0 Link encap:Ethernet HWaddr EE:58:73:D1:B7:C3
inet addr:192.168.1.108 Bcast:192.168.1.255 Mask:255.255.255.0
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)

eth1 Link encap:Ethernet HWaddr BA:93:D3:5D:F4:F0
inet addr:192.168.0.108 Bcast:192.168.0.255 Mask:255.255.255.0
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)

wpan0 Link encap:UNSPEC HWaddr E0-BB-B3-C3-DF-CA-88-87-00-00-00-00-00-00-00-00
UP BROADCAST RUNNING NOARP MTU:127 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:300
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
`
How can I test the communication between two devices? Can anyone tell me the steps to use the test application? Thanks!

observing an issue with reading the data

Hi,

I am trying to bring up sx1278 with the file-ops branch and observing an issue with data reception. we are not able to read data from the device. I am observing data on MOSI. Please find the below capture. could you please help me to resolve the issue?

logs:
[ 729.421470] sx1278: init SX1278 compatible kernel module
[ 729.421476] lora: register sx1278
[ 729.421485] lora: sx1278 driver(major 240) installed
[ 729.421523] lora: sx1278 class created
[ 729.421740] lora: probe a LoRa SPI device
[ 729.421790] sx1278 spi0.0: init sx127X
[ 729.424079] sx1278 spi0.0: chip version 1.2
[ 729.425304] sx1278 spi0.0: the original OP mode is 0xF
[ 729.426516] sx1278 spi0.0: before setting state to sleepmode to 0x8
[ 729.429436] sx1278 spi0.0: after setting state to sleepmode to 0xF
[ 729.430653] sx1278 spi0.0: op mode before change: 8f
[ 729.433075] sx1278 spi0.0: after write current OP mode is 0xF
[ 729.434288] sx1278 spi0.0: before setting state to sleepmode to 0x9
[ 729.436708] sx1278 spi0.0: after setting state to sleepmode to 0xF
[ 729.437931] sx1278 spi0.0:the current OP mode is 0xF
[ 729.440351] sx1278 spi0.0: going to set RX base address
[ 729.446376] sx1278 spi0.0: before setting state to sleepmode to 0xD
[ 729.448802] sx1278 spi0.0: after setting state to sleepmode to 0xF
[ 729.448807] lora: probe a LoRa SPI device with chip ver. 1.2

test.txt

image

Prepare for send patch to Linux mainline

Merge the lora_spi header and source to sx1278 header and source.
Move the lora header and source to LoRa-SPI folder, than modify Makefile.

Finally the patch will be new files lora.h, lora.c, sx1278.h, sx1278.c, Makefile.

make file not working

make
make -C /lib/modules/5.4.51-v7l+/build M=/home/pi/sahilsoni/lora/LoRa/LoRa modules
make[1]: *** /lib/modules/5.4.51-v7l+/build: No such file or directory. Stop.
make: *** [Makefile:8: all] Error 2

Not detecting RF output

I've got a Hoperf RF95 ( SX1276 compatible module ) connected to a Beaglebone SPI port , Driver loads, wpan0 and lowpan0 is created.
dmesg output shows

sx1278 spi2.0: add an IEEE 802.15.4 over LoRa SX1278 compatible device

but when client is run ( or ping6 ) I do not see ant RF on the spectrum analyser.

iwpan phy phy0 set tx_power also reports as
"command failed: Not supported (-95)"

Devicetree

sx1278@0{
compatible = "semtech,sx1276";
spi-max-frequency = <2000000>;
reg = <0>;
clock-frequency = <32000000>;
center-carrier-frq = <868000000>;
rf-bandwidth = <125000>;
spreading-factor = <7>;
minimal-RF-channel = /bits/ 8 <0>; // 0 : 868.3 MHz
maximum-RF-channel = /bits/ 8 <10>; // 1-10 :902 - 928 MHz
};

iwpan phy0 info output :

wpan_phy phy0
supported channels:
page 0: 0,1,2,3,4,5,6,7,8,9,10
current_page: 0
current_channel: 0, 868.3 MHz
capabilities:
iftypes: node,monitor
channels:
page 0:
[ 0] 868.3 MHz, [ 1] 906 MHz, [ 2] 908 MHz,
[ 3] 910 MHz, [ 4] 912 MHz, [ 5] 914 MHz,
[ 6] 916 MHz, [ 7] 918 MHz, [ 8] 920 MHz,
[ 9] 922 MHz, [10] 924 MHz
min_be: 3
max_be: 5
csma_backoffs: 4
frame_retries: 3
lbt: false

iwpan dev wpan0 info

Interface wpan0
ifindex 3
wpan_dev 0x1
extended_addr 0x8adb36432912159c
short_addr 0xffff
pan_id 0xbeef
type node
max_frame_retries 3
min_be 3
max_be 5
max_csma_backoffs 4
lbt 0

When I run client and expect to see RF emissions but none are seen on spectrum analyser I do not see any

client fe80::88db:3643:2912:159c%lowpan0 fe80::88db:3643:2912:1
69d 200 test
Send test with in 4 bytes

Do you know why this could be or how I could track down the issue ?

Is it compatible with Dragino LoRa / GPS HAT?

I'm using Dragino LoRa / GPS HAT which includes sx1276/8.

I installed and loaded the device driver according to the manual posted by the author.

But the LoRa module does not work properly.

Are there any settings other than the manual posted by the author?

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.