Skip to content

Commit

Permalink
[lora] add lora from https://github.com/starnight/LoRa
Browse files Browse the repository at this point in the history
  • Loading branch information
frank-w committed Feb 8, 2019
1 parent ac6c384 commit 7ff678e
Show file tree
Hide file tree
Showing 6 changed files with 1,777 additions and 0 deletions.
28 changes: 28 additions & 0 deletions utils/lora/Makefile
@@ -0,0 +1,28 @@
PROJ=sx1278
obj-m := $(PROJ).o

#KERNEL_LOCATION=/lib/modules/$(shell uname -r)
KERNEL_LOCATION=../..
BUILDDIR=$(KERNEL_LOCATION)

all:
make -C $(BUILDDIR) M=$(PWD) modules

install:
sudo make -C $(BUILDDIR) M=$(PWD) modules_install
# Rebuild the kernel module dependencies for modprobe
sudo depmod -a

uninstall:
sudo modprobe -r $(PROJ)
sudo rm $(KERNEL_LOCATION)/extra/$(PROJ).ko.gz
# Rebuild the kernel module dependencies for modprobe
sudo depmod -a

test:
make install; echo
ls -l /dev/$(PROJ)*
make uninstall

clean:
make -C $(BUILDDIR) M=$(PWD) clean
3 changes: 3 additions & 0 deletions utils/lora/build.sh
@@ -0,0 +1,3 @@
#!/bin/bash
make CROSS_COMPILE=arm-linux-gnueabihf- ARCH=arm CFLAGS="-D__LINUX_ARM_ARCH__=7"
#make
9 changes: 9 additions & 0 deletions utils/lora/overlay/Makefile
@@ -0,0 +1,9 @@
OVERLAY_SRC=rpi-lora-spi-overlay.dts
OVERLAY_DST=rpi-lora-spi.dtbo

all:
dtc -I dts -O dtb -@ -o $(OVERLAY_DST) $(OVERLAY_SRC)

test:
dtc -I fs /proc/device-tree

32 changes: 32 additions & 0 deletions utils/lora/overlay/README.md
@@ -0,0 +1,32 @@
# SX1278 Compatible Radio Device Tree

## Required properties:
- compatible: should be "semtech,sx1276", "semtech,sx1277",
"semtech,sx1277" or "semtech,sx1279" depends on your
transceiver board
- spi-max-frequency: maximal bus speed, should be set something under or
equal 10000000 Hz
- reg: the chipselect index
- clock-frequency: the external crystal oscillator frequency in Hz of the
transceiver
- center-carrier-frq: the RF center carrier frequency in Hz

## Optional properties:
- rf-bandwidth: the RF bandwidth in Hz
- minimal-RF-channel: the minimal RF channel number and the value must be with
prefix "/bits/ 8" because of being a byte datatype
- maximum-RF-channel: the maximum RF channel number and the value must be with
prefix "/bits/ 8" because of being a byte datatype
- spreading-factor: the spreading factor of Chirp Spread Spectrum modulation

## Example:

sx1278@0 {
compatible = "semtech,sx1278";
spi-max-frequency = <15200>;
reg = <0>;
clock-frequency = <32000000>;
center-carrier-frq = <434000000>;
minimal-RF-channel = /bits/ 8 <11>;
maximum-RF-channel = /bits/ 8 <11>;
};
42 changes: 42 additions & 0 deletions utils/lora/overlay/rpi-lora-spi-overlay.dts
@@ -0,0 +1,42 @@
/dts-v1/;
/plugin/;

/ {
fragment@0 {
target = <&spi>;
__overlay__ {
#address-cells = <1>;
#size-cells = <0>;

spidev@0 {
status = "disabled";
};

spidev@1 {
status = "disabled";
};

sx1278@0 {
compatible = "sx1278";
reg = <0>;
status = "okay";
spi-max-frequency = <0x3b60>;
center-carrier-frq = <434000000>;
clock-frequency = <32000000>;
minimal-RF-channel = /bits/ 8 <11>;
maximum-RF-channel = /bits/ 8 <11>;
};

sx1278@1 {
compatible = "sx1278";
reg = <1>;
status = "okay";
spi-max-frequency = <0x3b60>;
center-carrier-frq = <434000000>;
clock-frequency = <32000000>;
minimal-RF-channel = /bits/ 8 <11>;
maximum-RF-channel = /bits/ 8 <11>;
};
};
};
};

0 comments on commit 7ff678e

Please sign in to comment.