Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sx1302: upgrade hal to v2.1.0 #40

Merged
merged 3 commits into from
Oct 5, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,10 @@ RUN apt-get update && \
build-essential \
python3 \
python3-pip \
python3-venv

python3-venv && \
# Because the PATH is already updated above, this command creates a new venv AND activates it
python3 -m venv /opt/iotloragateway/dev/venv && \
# Given venv is active, this `pip` refers to the python3 variant
RUN python3 -m venv /opt/iotloragateway/dev/venv && \
pip install --no-cache-dir -r requirements.txt

# Copy the buildfiles and sx1302 concentrator fixes
Expand Down Expand Up @@ -94,7 +93,7 @@ COPY lora_templates_sx1301/EU-global_conf.json global_conf.json
WORKDIR /opt/iotloragateway/packet_forwarder/sx1302

# Copy sx1302 hal from builder
COPY --from=builder /opt/iotloragateway/dev/sx1302_hal-1.0.5 .
COPY --from=builder /opt/iotloragateway/dev/sx1302_hal-2.1.0 .

# Copy sx1302 regional config templates
COPY lora_templates_sx1302 lora_templates_sx1302/
Expand Down
9 changes: 5 additions & 4 deletions buildfiles/compileSX1302.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,17 @@

cd /opt/iotloragateway/dev || exit

#git clone https://github.com/NebraLtd/sx1302_hal.git
wget https://github.com/NebraLtd/sx1302_hal/archive/V1.0.5.tar.gz
tar -xzvf V1.0.5.tar.gz
wget https://github.com/NebraLtd/sx1302_hal/archive/V2.1.0.tar.gz
tar -xzvf V2.1.0.tar.gz

cd /opt/iotloragateway/dev/sx1302_hal-1.0.5 || exit
cd /opt/iotloragateway/dev/sx1302_hal-2.1.0 || exit

#Remove old files

rm libloragw/inc/loragw_stts751.h -f
rm libloragw/src/loragw_stts751.c -f
rm libloragw/inc/loragw_ad5338r.h -f
rm libloragw/src/loragw_ad5338r.c -f

#Copy new files
cp ../sx1302fixes/loragw_hal.c libloragw/src/loragw_hal.c -f
Expand Down
2 changes: 1 addition & 1 deletion files/configurePktFwd.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def writeRegionConfSx1302(regionId, spi_bus):
newGlobal = json.load(regionconfJFile)

# Inject SPI Bus
newGlobal['SX130x_conf']['spidev_path'] = "/dev/%s" % spi_bus
newGlobal['SX130x_conf']['com_path'] = "/dev/%s" % spi_bus

globalPath = "/opt/iotloragateway/packet_forwarder/sx1302/packet_forwarder/global_conf.json"

Expand Down
10 changes: 5 additions & 5 deletions lora_templates_sx1302/AS-global_conf.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"SX130x_conf": {
"spidev_path": "/dev/spidev1.2",
"com_type": "SPI",
"com_path": "/dev/spidev1.2",
"lorawan_public": true,
"clksrc": 0,
"antenna_gain": 0,
"full_duplex": false,
"precision_timestamp": {
"enable": false,
"max_ts_metrics": 255,
"nb_symbols": 1
"fine_timestamp": {
"enable": false,
"mode": "all_sf"
},
"radio_0": {
"enable": true,
Expand Down
10 changes: 5 additions & 5 deletions lora_templates_sx1302/AS1-global_conf.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"SX130x_conf": {
"spidev_path": "/dev/spidev1.2",
"com_type": "SPI",
"com_path": "/dev/spidev1.2",
"lorawan_public": true,
"clksrc": 0,
"antenna_gain": 0,
"full_duplex": false,
"precision_timestamp": {
"enable": false,
"max_ts_metrics": 255,
"nb_symbols": 1
"fine_timestamp": {
"enable": false,
"mode": "all_sf"
},
"radio_0": {
"enable": true,
Expand Down
10 changes: 5 additions & 5 deletions lora_templates_sx1302/AS2-global_conf.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"SX130x_conf": {
"spidev_path": "/dev/spidev1.2",
"com_type": "SPI",
"com_path": "/dev/spidev1.2",
"lorawan_public": true,
"clksrc": 0,
"antenna_gain": 0,
"full_duplex": false,
"precision_timestamp": {
"enable": false,
"max_ts_metrics": 255,
"nb_symbols": 1
"fine_timestamp": {
"enable": false,
"mode": "all_sf"
},
"radio_0": {
"enable": true,
Expand Down
10 changes: 5 additions & 5 deletions lora_templates_sx1302/AS3-global_conf.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"SX130x_conf": {
"spidev_path": "/dev/spidev1.2",
"com_type": "SPI",
"com_path": "/dev/spidev1.2",
"lorawan_public": true,
"clksrc": 0,
"antenna_gain": 0,
"full_duplex": false,
"precision_timestamp": {
"enable": false,
"max_ts_metrics": 255,
"nb_symbols": 1
"fine_timestamp": {
"enable": false,
"mode": "all_sf"
},
"radio_0": {
"enable": true,
Expand Down
10 changes: 5 additions & 5 deletions lora_templates_sx1302/AU-global_conf.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"SX130x_conf": {
"spidev_path": "/dev/spidev1.2",
"com_type": "SPI",
"com_path": "/dev/spidev1.2",
"lorawan_public": true,
"clksrc": 0,
"antenna_gain": 0,
"full_duplex": false,
"precision_timestamp": {
"enable": false,
"max_ts_metrics": 255,
"nb_symbols": 1
"fine_timestamp": {
"enable": false,
"mode": "all_sf"
},
"radio_0": {
"enable": true,
Expand Down
8 changes: 4 additions & 4 deletions lora_templates_sx1302/CN-global_conf.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"SX130x_conf": {
"spidev_path": "/dev/spidev1.2",
"com_type": "SPI",
"com_path": "/dev/spidev1.2",
"lorawan_public": true,
"clksrc": 0,
"antenna_gain": 0,
"full_duplex": false,
"precision_timestamp": {
"fine_timestamp": {
"enable": false,
"max_ts_metrics": 255,
"nb_symbols": 1
"mode": "all_sf"
},
"radio_0": {
"enable": true,
Expand Down
8 changes: 4 additions & 4 deletions lora_templates_sx1302/EU-global_conf.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"SX130x_conf": {
"spidev_path": "/dev/spidev1.2",
"com_type": "SPI",
"com_path": "/dev/spidev1.2",
"lorawan_public": true,
"clksrc": 0,
"antenna_gain": 0,
"full_duplex": false,
"precision_timestamp": {
"fine_timestamp": {
"enable": false,
"max_ts_metrics": 255,
"nb_symbols": 1
"mode": "all_sf"
},
"radio_0": {
"enable": true,
Expand Down
8 changes: 4 additions & 4 deletions lora_templates_sx1302/IN-global_conf.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"SX130x_conf": {
"spidev_path": "/dev/spidev1.2",
"com_type": "SPI",
"com_path": "/dev/spidev1.2",
"lorawan_public": true,
"clksrc": 0,
"antenna_gain": 0,
"full_duplex": false,
"precision_timestamp": {
"fine_timestamp": {
"enable": false,
"max_ts_metrics": 255,
"nb_symbols": 1
"mode": "all_sf"
},
"radio_0": {
"enable": true,
Expand Down
10 changes: 5 additions & 5 deletions lora_templates_sx1302/KR-global_conf.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"SX130x_conf": {
"spidev_path": "/dev/spidev0.0",
"com_type": "SPI",
"com_path": "/dev/spidev1.2",
"lorawan_public": true,
"clksrc": 0,
"antenna_gain": 0,
"full_duplex": false,
"precision_timestamp": {
"enable": false,
"max_ts_metrics": 255,
"nb_symbols": 1
"fine_timestamp": {
"enable": false,
"mode": "all_sf"
},
"radio_0": {
"enable": true,
Expand Down
8 changes: 4 additions & 4 deletions lora_templates_sx1302/RU-global_conf.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"SX130x_conf": {
"spidev_path": "/dev/spidev1.2",
"com_type": "SPI",
"com_path": "/dev/spidev1.2",
"lorawan_public": true,
"clksrc": 0,
"antenna_gain": 0,
"full_duplex": false,
"precision_timestamp": {
"fine_timestamp": {
"enable": false,
"max_ts_metrics": 255,
"nb_symbols": 1
"mode": "all_sf"
},
"radio_0": {
"enable": true,
Expand Down
8 changes: 4 additions & 4 deletions lora_templates_sx1302/US-global_conf.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"SX130x_conf": {
"spidev_path": "/dev/spidev1.2",
"com_type": "SPI",
"com_path": "/dev/spidev1.2",
"lorawan_public": true,
"clksrc": 0,
"antenna_gain": 0,
"full_duplex": false,
"precision_timestamp": {
"fine_timestamp": {
"enable": false,
"max_ts_metrics": 255,
"nb_symbols": 1
"mode": "all_sf"
},
"radio_0": {
"enable": true,
Expand Down
78 changes: 62 additions & 16 deletions sx1302fixes/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,20 @@ LIBS := -lloragw -ltinymt32 -lrt -lm

### general build targets

all: libloragw.a test_loragw_spi test_loragw_i2c test_loragw_reg test_loragw_hal_tx test_loragw_hal_rx test_loragw_cal test_loragw_capture_ram test_loragw_spi_sx1250 test_loragw_counter test_loragw_gps test_loragw_gps_i2c
all: libloragw.a \
test_loragw_com \
test_loragw_i2c \
test_loragw_reg \
test_loragw_hal_tx \
test_loragw_hal_rx \
test_loragw_cal_sx125x \
test_loragw_capture_ram \
test_loragw_com_sx1250 \
test_loragw_com_sx1261 \
test_loragw_counter \
test_loragw_gps \
test_loragw_toa \
test_loragw_sx1261_rssi

clean:
rm -f libloragw.a
Expand Down Expand Up @@ -60,17 +73,19 @@ inc/config.h: ../VERSION library.cfg
@echo "Release version : $(LIBLORAGW_VERSION)"
@echo " #define LIBLORAGW_VERSION "\"$(LIBLORAGW_VERSION)\""" >> $@
# Debug options
@echo " #define DEBUG_AUX $(DEBUG_AUX)" >> $@
@echo " #define DEBUG_SPI $(DEBUG_SPI)" >> $@
@echo " #define DEBUG_I2C $(DEBUG_I2C)" >> $@
@echo " #define DEBUG_REG $(DEBUG_REG)" >> $@
@echo " #define DEBUG_HAL $(DEBUG_HAL)" >> $@
@echo " #define DEBUG_GPS $(DEBUG_GPS)" >> $@
@echo " #define DEBUG_GPIO $(DEBUG_GPIO)" >> $@
@echo " #define DEBUG_LBT $(DEBUG_LBT)" >> $@
@echo " #define DEBUG_RAD $(DEBUG_RAD)" >> $@
@echo " #define DEBUG_CAL $(DEBUG_CAL)" >> $@
@echo " #define DEBUG_AUX $(DEBUG_AUX)" >> $@
@echo " #define DEBUG_COM $(DEBUG_COM)" >> $@
@echo " #define DEBUG_MCU $(DEBUG_MCU)" >> $@
@echo " #define DEBUG_I2C $(DEBUG_I2C)" >> $@
@echo " #define DEBUG_REG $(DEBUG_REG)" >> $@
@echo " #define DEBUG_HAL $(DEBUG_HAL)" >> $@
@echo " #define DEBUG_GPS $(DEBUG_GPS)" >> $@
@echo " #define DEBUG_GPIO $(DEBUG_GPIO)" >> $@
@echo " #define DEBUG_LBT $(DEBUG_LBT)" >> $@
@echo " #define DEBUG_RAD $(DEBUG_RAD)" >> $@
@echo " #define DEBUG_CAL $(DEBUG_CAL)" >> $@
@echo " #define DEBUG_SX1302 $(DEBUG_SX1302)" >> $@
@echo " #define DEBUG_FTIME $(DEBUG_FTIME)" >> $@
# end of file
@echo "#endif" >> $@
@echo "*** Configuration seems ok ***"
Expand All @@ -85,12 +100,37 @@ $(OBJDIR)/%.o: src/%.c $(INCLUDES) inc/config.h | $(OBJDIR)

### static library

libloragw.a: $(OBJDIR)/loragw_spi.o $(OBJDIR)/loragw_i2c.o $(OBJDIR)/loragw_aux.o $(OBJDIR)/loragw_reg.o $(OBJDIR)/loragw_sx1250.o $(OBJDIR)/loragw_sx125x.o $(OBJDIR)/loragw_sx1302.o $(OBJDIR)/loragw_cal.o $(OBJDIR)/loragw_debug.o $(OBJDIR)/loragw_hal.o $(OBJDIR)/loragw_gps.o $(OBJDIR)/loragw_sx1302_timestamp.o $(OBJDIR)/loragw_sx1302_rx.o
libloragw.a: $(OBJDIR)/loragw_spi.o \
$(OBJDIR)/loragw_usb.o \
$(OBJDIR)/loragw_com.o \
$(OBJDIR)/loragw_mcu.o \
$(OBJDIR)/loragw_i2c.o \
$(OBJDIR)/sx125x_spi.o \
$(OBJDIR)/sx125x_com.o \
$(OBJDIR)/sx1250_spi.o \
$(OBJDIR)/sx1250_usb.o \
$(OBJDIR)/sx1250_com.o \
$(OBJDIR)/sx1261_spi.o \
$(OBJDIR)/sx1261_usb.o \
$(OBJDIR)/sx1261_com.o \
$(OBJDIR)/loragw_aux.o \
$(OBJDIR)/loragw_reg.o \
$(OBJDIR)/loragw_sx1250.o \
$(OBJDIR)/loragw_sx1261.o \
$(OBJDIR)/loragw_sx125x.o \
$(OBJDIR)/loragw_sx1302.o \
$(OBJDIR)/loragw_cal.o \
$(OBJDIR)/loragw_debug.o \
$(OBJDIR)/loragw_hal.o \
$(OBJDIR)/loragw_lbt.o \
$(OBJDIR)/loragw_gps.o \
$(OBJDIR)/loragw_sx1302_timestamp.o \
$(OBJDIR)/loragw_sx1302_rx.o
$(AR) rcs $@ $^

### test programs

test_loragw_spi: tst/test_loragw_spi.c libloragw.a
test_loragw_com: tst/test_loragw_com.c libloragw.a
$(CC) $(CFLAGS) -L. -L../libtools $< -o $@ $(LIBS)

test_loragw_i2c: tst/test_loragw_i2c.c libloragw.a
Expand All @@ -108,10 +148,13 @@ test_loragw_hal_rx: tst/test_loragw_hal_rx.c libloragw.a
test_loragw_capture_ram: tst/test_loragw_capture_ram.c libloragw.a
$(CC) $(CFLAGS) -L. -L../libtools $< -o $@ $(LIBS)

test_loragw_cal: tst/test_loragw_cal.c libloragw.a
test_loragw_cal_sx125x: tst/test_loragw_cal_sx125x.c libloragw.a
$(CC) $(CFLAGS) -L. -L../libtools $< -o $@ $(LIBS)

test_loragw_spi_sx1250: tst/test_loragw_spi_sx1250.c libloragw.a
test_loragw_com_sx1250: tst/test_loragw_com_sx1250.c libloragw.a
$(CC) $(CFLAGS) -L. -L../libtools $< -o $@ $(LIBS)

test_loragw_com_sx1261: tst/test_loragw_com_sx1261.c libloragw.a
$(CC) $(CFLAGS) -L. -L../libtools $< -o $@ $(LIBS)

test_loragw_counter: tst/test_loragw_counter.c libloragw.a
Expand All @@ -120,7 +163,10 @@ test_loragw_counter: tst/test_loragw_counter.c libloragw.a
test_loragw_gps: tst/test_loragw_gps.c libloragw.a
$(CC) $(CFLAGS) -L. -L../libtools $< -o $@ $(LIBS)

test_loragw_gps_i2c: tst/test_loragw_gps_i2c.c libloragw.a
test_loragw_toa: tst/test_loragw_toa.c libloragw.a
$(CC) $(CFLAGS) -L. -L../libtools $< -o $@ $(LIBS)

test_loragw_sx1261_rssi: tst/test_loragw_sx1261_rssi.c libloragw.a
$(CC) $(CFLAGS) -L. -L../libtools $< -o $@ $(LIBS)

### EOF
Loading