WMC v2.3 wiki
Product Overview
Using
OSS API*
Advanced
Resources
Product Overview
Using
OSS API*
Advanced
Resources
This is an old revision of the document!
SEMTECH company gives access to its LoRa libraries and tools across a Github.
# cd ~/workdir/ # git clone https://github.com/Lora-net/lora_gateway.git # git clone https://github.com/Lora-net/packet_forwarder.gitAll the help you need is in the README file.
The package configuration must be adapted to the platform.
- Patch the Github HAL v2.0.0 :
27dBm capable gateways
- Patch the Github HAL v2.0.0 - loraMAC config - 27dBm capable gateways:
Download the following patch files to configure Lora-net/lora_gateway and Lora-net/packet_forwarder source code:kerlink_patch_hal_v2.0.0_loramac_27dbm.tar.gz
# tar -xzvf kerlink_patch_hal_v2.0.0_loramac_27dbm.tar.gz # cd lora_gateway # git reset --hard 45be5ff # git apply lora_gateway_v2.0.0_kerlink_lora_iot_station_27dbm.patch # cd ../packet_forwarder # git reset --hard v1.4.1 # git apply packet_forwarder_v1.4.1_kerlink_lora_iot_station_27dbm.patch
For different configuration and debug activation, modify the file lora_gateway/libloragw/library.cfg and rebuild the HAL (lora_gateway directory) and test binaries (packet_forwarder directory)
20dBm capable gateways
- With previous LoRa Station hardware revision (20dBm capable):
Follow the instructions above and only modify the value of CFG_BRD in libloragw/library.cfg. (validated on HAL v2.0.0, not yet on v3.0.1).
# kerlink_868 Kerlink LoRa 868MHz gateway # kerlink_868_27dbm Kerlink LoRa 868MHz gateway with 27dBm capability CFG_BRD=kerlink_868
cd lora_gateway sed -i -e '/CFG_BRD/ s/kerlink_868_27dbm/kerlink_868/' libloragw/library.cfg
- Patch the Github HAL v1.6.0:
# tar -xzvf kerlink_patch_hal_v1.6.0.tar.gz # cd lora_gateway # git reset --hard v1.6.0 # git apply lora_gateway_v1.6.0_kerlink_lora_iot_868MHz.patch # cd ../packet_forwarder # git reset --hard v1.4.1 # git apply packet_forwarder_v1.4.1_kerlink_lora_iot.patch
- Patch the Github HAL v1.5.0:
# cd lora_gateway # git reset --hard v1.5.0 # git apply kerlink_LoRaIoTStationV1_custo_HAL_v1.5.0_lora_gateway.patch # cd ../packet_forwarder # git reset --hard v1.3.0 # git apply kerlink_LoRaIoTStationV1_custo_HAL_v1.3.0_packet_forwarder.patch
- Patch the Github HAL v1.4.0:
# cd lora_gateway # git apply kerlink_LoRaIoTStationV1_custo_HALv1.4_lora_gateway.patch # cd ../packet_forwarder # git apply kerlink_LoRaIoTStationV1_custo_HALv1.4_packet_forwarder.patch
diff --git a/Makefile b/Makefile index 5afee5d..ac97c2d 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ ### Environment constants -CROSS_COMPILE := +CROSS_COMPILE :=/opt/toolchains/arm-2011.03-wirma2/bin/arm-none-linux-gnueabi- export ### general build targets @@ -19,4 +19,4 @@ clean: $(MAKE) clean -e -C util_spi_stress $(MAKE) clean -e -C util_tx_test -### EOF \ No newline at end of file +### EOF diff --git a/libloragw/Makefile b/libloragw/Makefile index 9d5660b..2aed6fc 100644 --- a/libloragw/Makefile +++ b/libloragw/Makefile @@ -14,7 +14,7 @@ CFLAGS := -O2 -Wall -Wextra -std=c99 -Iinc -I. ### library.cfg configuration file processing ifeq ($(CFG_SPI),native) - CFG_SPI_MSG := Linux native SPI driver (/dev/spidev0.0) + CFG_SPI_MSG := Linux native SPI driver (/dev/spidev32766.0) CFG_SPI_OPT := CFG_SPI_NATIVE else ifeq ($(CFG_SPI),ftdi) CFG_SPI_MSG := FTDI SPI-over-USB bridge using libmpsse/libftdi/libusb @@ -187,4 +187,4 @@ test_loragw_hal: tst/test_loragw_hal.c libloragw.a test_loragw_gps: tst/test_loragw_gps.c libloragw.a $(CC) $(CFLAGS) -L. $< -o $@ $(LIBS) -### EOF \ No newline at end of file +### EOF diff --git a/libloragw/library.cfg b/libloragw/library.cfg index 5751cb5..3630e4c 100644 --- a/libloragw/library.cfg +++ b/libloragw/library.cfg @@ -2,10 +2,11 @@ ### SPI interface to the concentrator ### # Accepted values: -# native Linux native SPI driver (/dev/spidev0.0) +# native Linux native SPI driver (/dev/spidev32766.0) # ftdi FTDI SPI-over-USB bridge using libmpsse/libftdi/libusb -CFG_SPI= ftdi +CFG_SPI= native ### Concentrator chip ### # Accepted values: diff --git a/libloragw/src/loragw_spi.native.c b/libloragw/src/loragw_spi.native.c index 6a9b64d..96beaef 100644 --- a/libloragw/src/loragw_spi.native.c +++ b/libloragw/src/loragw_spi.native.c @@ -53,7 +53,7 @@ Maintainer: Sylvain Miermont #define READ_ACCESS 0x00 #define WRITE_ACCESS 0x80 #define SPI_SPEED 8000000 -#define SPI_DEV_PATH "/dev/spidev0.0" +#define SPI_DEV_PATH "/dev/spidev32766.0" /* -------------------------------------------------------------------------- */ /* --- PUBLIC FUNCTIONS DEFINITION ------------------------------------------ */
Lora-net/lora_gateway before v1.3.0
diff --git a/libloragw/Makefile b/libloragw/Makefile index 2b91fa8..31a533b 100644 --- a/libloragw/Makefile +++ b/libloragw/Makefile @@ -2,7 +2,7 @@ include library.cfg # constant symbols -CROSS_COMPILE= +CROSS_COMPILE=/opt/toolchains/arm-2011.03-wirma2/bin/arm-none-linux-gnueabi- CC=gcc CFLAGS=-O2 -Wall -Wextra -Iinc -I. C99FLAGS=-O2 -Wall -Wextra -std=c99 -Iinc -I. diff --git a/libloragw/library.cfg b/libloragw/library.cfg index 0e8c742..0787e91 100644 --- a/libloragw/library.cfg +++ b/libloragw/library.cfg @@ -21,7 +21,7 @@ FLAG_GPS= -D DEBUG_GPS=0 # Pick one and comment the other(s) # FTDI SPI-over-USB bridge -LGW_PHY= ftdi +#LGW_PHY= ftdi # Pcduino native SPI (Linux device in /dev) -#LGW_PHY= native +LGW_PHY= native diff --git a/libloragw/src/loragw_spi.native.c b/libloragw/src/loragw_spi.native.c index cf8aa9d..6cde430 100644 --- a/libloragw/src/loragw_spi.native.c +++ b/libloragw/src/loragw_spi.native.c @@ -53,7 +53,7 @@ Maintainer: Sylvain Miermont #define READ_ACCESS 0x00 #define WRITE_ACCESS 0x80 #define SPI_SPEED 8000000 -#define SPI_DEV_PATH "/dev/spidev0.0" +#define SPI_DEV_PATH "/dev/spidev32766.0" /* -------------------------------------------------------------------------- */ /* --- PUBLIC FUNCTIONS DEFINITION ------------------------------------------ */
# cd ~/lora_gateway/libloragw # make /opt/toolchains/arm-2011.03-wirma2/bin/arm-none-linux-gnueabi-gcc -c -O2 -Wall -Wextra -std=c99 -Iinc -I. src/loragw_hal.c -o obj/loragw_hal.o -D LGW_PHY="\"native\"" -D DEBUG_HAL=0 /opt/toolchains/arm-2011.03-wirma2/bin/arm-none-linux-gnueabi-gcc -c -O2 -Wall -Wextra -std=c99 -Iinc -I. src/loragw_gps.c -o obj/loragw_gps.o -D DEBUG_GPS=0 /opt/toolchains/arm-2011.03-wirma2/bin/arm-none-linux-gnueabi-gcc -c -O2 -Wall -Wextra -std=c99 -Iinc -I. src/loragw_reg.c -o obj/loragw_reg.o -D DEBUG_REG=0 /opt/toolchains/arm-2011.03-wirma2/bin/arm-none-linux-gnueabi-gcc -c -O2 -Wall -Wextra -std=c99 -Iinc -I. src/loragw_spi.native.c -o obj/loragw_spi.o -D DEBUG_SPI=0 /opt/toolchains/arm-2011.03-wirma2/bin/arm-none-linux-gnueabi-gcc -c -O2 -Wall -Wextra -Iinc -I. src/loragw_aux.c -o obj/loragw_aux.o -D DEBUG_AUX=0 /opt/toolchains/arm-2011.03-wirma2/bin/arm-none-linux-gnueabi-ar rcs libloragw.a obj/loragw_hal.o obj/loragw_gps.o obj/loragw_reg.o obj/loragw_spi.o obj/loragw_aux.o /opt/toolchains/arm-2011.03-wirma2/bin/arm-none-linux-gnueabi-gcc -O2 -Wall -Wextra -std=c99 -Iinc -I. tst/test_loragw_spi.c obj/loragw_spi.o -o test_loragw_spi -lrt /opt/toolchains/arm-2011.03-wirma2/bin/arm-none-linux-gnueabi-gcc -O2 -Wall -Wextra -std=c99 -Iinc -I. tst/test_loragw_reg.c obj/loragw_reg.o obj/loragw_spi.o -o test_loragw_reg -lrt /opt/toolchains/arm-2011.03-wirma2/bin/arm-none-linux-gnueabi-gcc -O2 -Wall -Wextra -std=c99 -Iinc -I. tst/test_loragw_hal.c obj/loragw_hal.o obj/loragw_reg.o obj/loragw_spi.o obj/loragw_aux.o -o test_loragw_hal -lrt /opt/toolchains/arm-2011.03-wirma2/bin/arm-none-linux-gnueabi-gcc -O2 -Wall -Wextra -std=c99 -Iinc -I. tst/test_loragw_gps.c obj/loragw_gps.o obj/loragw_hal.o obj/loragw_reg.o obj/loragw_spi.o obj/loragw_aux.o -o test_loragw_gps -lrt
Pre-compiled binaries are ready to install to the LoRa Stations, using the Kerlink “dota” mechanism: software updates
LoRa 27dBm dota file : dota_test_hal_semtech_v2.0.0_loramac_27dbm_pktfwd_868mhz_wirgrid.tar.gz
LoRa 20dBm dota file : dota_test_hal_semtech_v2.0.0_loramac_20dbm_pktfwd_868mhz_wirgrid.tar.gz
Use the Windows tool WinSCP or scp linux command to copy the dota file into /mnt/fsuser-1/dota/. Reboot the system with the reboot command. The LoRa Station will enter in update mode (several reboots will occur). The applicative binaries will be installed to mnt/fsuser-1/. The upgrade is over when the session Login is accessible (you can follow the upgrade with the debug probe).
You can have a quick overview of the full LoRa chain with the following binaries and LoRa Mote end-points: LoRaMote_demonstration_user_guide_v1.2.pdf
For firmware v2.x (LoRa 27dBm or previous hardware 20 dBm)
LoRa Motes (end point)
LoRa Motes are programmed with the binary LoRaMacApp.hex available on semtech's web page: LoRamac_test_app_page
LoRa Motes configuration can be modified thanks to a PC application tool, connected via USB to the mote.
LoRaMacConfigSetup-v0.3.RC24.4.exe
LoRa IoT Station applicative software update (dota file)
Install the packet forwarder started automaticaly by the LoRa Station at boot time:
The command “ps ww” will show that /bin/sh /mnt/fsuser-1/demo_gps_loramote/gps-pkt-fwd.sh and ./gps_pkt_fwd are running.
- Dota demo_gps_loramote HAL v2.0.0:
Binary version can be checked:
launch manualy /mnt/fsuser-1/demo_gps_loramote/gps_pkt_fwd
and check the version Version: 2.0.0 and compilation options
[root@Wirgrid_0806xxxx demo_gps_loramote]# /mnt/fsuser-1/demo_gps_loramote/gps_p kt_fwd *** GPS Packet Forwarder for Lora Gateway *** Version: 1.4.1 *** Lora concentrator HAL library version info *** Version: 2.0.0; Options: native sx1301 sx1257 eu868 kerlink_868_27dbm lora_mac;
Gateway binaries:
The command “ps ww” will show that /bin/sh /mnt/fsuser-1/demo_gps_loramote/gps-pkt-fwd.sh and ./gps_pkt_fwd are running. LoRaMote binary: You can flash the following loraMote binary with a ST/link V2 JTAG probe.
the Mote will send a packet every 30s, and you will see it on the Semtech server (documentation: loramote_demonstration_user_guide_v1.1.pdf above)