Skip to content

Commit

Permalink
v3.0.0
Browse files Browse the repository at this point in the history
- Added new HAL function lgw_board_setconf() to configure board/concentrator specific parameters: network type (LoRa public or private), concentrator clock source. Note: those parameters are not any more set from the library.cfg file configuration (CFG_NET, CFG_BRD), and should be passed at initialization by the application.
- Added new HAL function lgw_txgain_setconf() to configure concentrator TX gain table. It can now be dynamically set by the application at initialization time.
- Changed HAL function lgw_rxrf_setconf(), it will now also configure the radio type (CFG_RADIO has been removed from library.cfg), the RSSI offset to be used for this radio and if TX is enabled or not on this radio.
- Added support of IoT Starter Kit platform, which is now the default board.
- Added util_tx_continuous utility for gateway TX power calibration and spectral emission measurements/qualification.
- Removed CFG_BAND configuration from library.cfg. Band configuration is done by application and passed dynamically at initialization time.
- Updated makefiles to allow cross compilation from environment variable (ARCH, CROSS_COMPILE).

** WARNING: **
** Known issue: a problem with carrier leakage calibration has been seen on 433MHz boards. **
  • Loading branch information
mcoracin committed May 7, 2015
1 parent 45be5ff commit ee26db0
Show file tree
Hide file tree
Showing 34 changed files with 3,169 additions and 2,519 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
*.o
*.swp
*.bak
9 changes: 5 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
### Environment constants

CROSS_COMPILE :=
ARCH ?=
CROSS_COMPILE ?=
export

### general build targets

all:
$(MAKE) all -e -C libloragw
$(MAKE) all -e -C util_band_survey
$(MAKE) all -e -C util_pkt_logger
$(MAKE) all -e -C util_spi_stress
$(MAKE) all -e -C util_tx_test
$(MAKE) all -e -C util_tx_continuous

clean:
$(MAKE) clean -e -C libloragw
$(MAKE) clean -e -C util_band_survey
$(MAKE) clean -e -C util_pkt_logger
$(MAKE) clean -e -C util_spi_stress
$(MAKE) clean -e -C util_tx_test
$(MAKE) clean -e -C util_tx_continuous

### EOF
### EOF
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.0.0
3.0.0
130 changes: 11 additions & 119 deletions libloragw/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ include library.cfg

### constant symbols

CROSS_COMPILE :=
ARCH ?=
CROSS_COMPILE ?=
CC := $(CROSS_COMPILE)gcc
AR := $(CROSS_COMPILE)ar

Expand All @@ -14,7 +15,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/spidev32766.0)
CFG_SPI_MSG := Linux native SPI driver
CFG_SPI_OPT := CFG_SPI_NATIVE
else ifeq ($(CFG_SPI),ftdi)
CFG_SPI_MSG := FTDI SPI-over-USB bridge using libmpsse/libftdi/libusb
Expand All @@ -23,115 +24,15 @@ else
$(error No SPI physical layer selected, check ../target.cfg file.)
endif

ifeq ($(CFG_CHIP),sx1301)
CFG_CHIP_MSG := Semtech SX1301 production chip
CFG_CHIP_OPT := CFG_CHIP_1301
else ifeq ($(CFG_CHIP),fpga1301)
CFG_CHIP_MSG := FPGA containing the SX1301 IP
CFG_CHIP_OPT := CFG_CHIP_FPGA
else
$(error No concentrator chip selected, check library.cfg file.)
endif

ifeq ($(CFG_RADIO),sx1257)
CFG_RADIO_MSG := Dual SX1257 transceivers, covering 860-1000 MHz
CFG_RADIO_OPT := CFG_RADIO_1257
else ifeq ($(CFG_RADIO),sx1255)
CFG_RADIO_MSG := Dual SX1255 transceivers, covering 400-510 MHz
CFG_RADIO_OPT := CFG_RADIO_1255
else
$(error No radio chip selected, check library.cfg file.)
endif

ifeq ($(CFG_BAND),full)
CFG_BAND_MSG := Full range supported by the radio(s)
CFG_BAND_OPT := CFG_BAND_FULL
else ifeq ($(CFG_BAND),eu868)
ifeq ($(CFG_RADIO),sx1257)
CFG_BAND_MSG := ETSI 868 (866) MHz band
CFG_BAND_OPT := CFG_BAND_868
else
$(error The selected radio(s) cannot work in the selected band.)
endif
else ifeq ($(CFG_BAND),us915)
ifeq ($(CFG_RADIO),sx1257)
CFG_BAND_MSG := FCC 915 MHz band
CFG_BAND_OPT := CFG_BAND_915
else
$(error The selected radio(s) cannot work in the selected band.)
endif
else ifeq ($(CFG_BAND),cn470)
ifeq ($(CFG_RADIO),sx1255)
CFG_BAND_MSG := China 470 MHz band
CFG_BAND_OPT := CFG_BAND_470
else
$(error The selected radio(s) cannot work in the selected band.)
endif
else ifeq ($(CFG_BAND),eu433)
ifeq ($(CFG_RADIO),sx1255)
CFG_BAND_MSG := ETSI 433 MHz band
CFG_BAND_OPT := CFG_BAND_433
else
$(error The selected radio(s) cannot work in the selected band.)
endif
else ifeq ($(CFG_BAND),cn780)
ifeq ($(CFG_RADIO),sx1257)
CFG_BAND_MSG := China 780 MHz band
CFG_BAND_OPT := CFG_BAND_780
else
$(error The selected radio(s) cannot work in the selected band.)
endif
else
$(warning [Warning] No frequency band selected, full radio capability assumed.)
CFG_BAND_MSG := Full range supported by the radio(s)
CFG_BAND_OPT := CFG_BAND_FULL
endif

ifeq ($(CFG_BRD),dev_nano_868)
CFG_BRD_MSG := FPGA-based nano-concentrator, with 868 MHz SAW filter
CFG_BRD_OPT := CFG_BRD_NANO868
else ifeq ($(CFG_BRD),ref_1301_868)
CFG_BRD_MSG := SX1301 reference board with SX1257 radios, 868 MHz filters
CFG_BRD_OPT := CFG_BRD_1301REF868
else ifeq ($(CFG_BRD),ref_1301_433)
CFG_BRD_MSG := SX1301 reference board with SX1255 radios, 433 MHz filters
CFG_BRD_OPT := CFG_BRD_1301REF433
else ifeq ($(CFG_BRD),kerlink_868)
CFG_BRD_MSG := Kerlink LoRa 868MHz gateway
CFG_BRD_OPT := CFG_BRD_KERLINK868
else ifeq ($(CFG_BRD),kerlink_868_27dbm)
CFG_BRD_MSG := Kerlink LoRa 868MHz gateway with 27dBm capability
CFG_BRD_OPT := CFG_BRD_KERLINK868_27DBM
else ifeq ($(CFG_BRD),kerlink_433)
CFG_BRD_MSG := Kerlink LoRa 433MHz gateway
CFG_BRD_OPT := CFG_BRD_KERLINK433
else ifeq ($(CFG_BRD),cisco_433)
CFG_BRD_MSG := Cisco LoRa 433MHz gateway
CFG_BRD_OPT := CFG_BRD_CISCO433
else ifeq ($(CFG_BRD),cisco_470)
CFG_BRD_MSG := Cisco LoRa 470MHz gateway
CFG_BRD_OPT := CFG_BRD_CISCO470
else ifeq ($(CFG_BRD),cisco_780)
CFG_BRD_MSG := Cisco LoRa 780MHz gateway
CFG_BRD_OPT := CFG_BRD_CISCO780
ifeq ($(CFG_BRD),iot_sk_1301_868)
CFG_BRD_MSG := SX1301 IoT Starter Kit board with SX1257 radios, 868 MHz filters
CFG_BRD_OPT := CFG_BRD_1301IOTSK868
else
$(info [Info] No specific board selected.)
CFG_BRD_MSG := None
CFG_BRD_OPT := CFG_BRD_NONE
endif

ifeq ($(CFG_NET),private)
CFG_NET_MSG := Private network
CFG_NET_OPT := CFG_NET_PRIVATE
else ifeq ($(CFG_NET),lora_mac)
CFG_NET_MSG := LoRa MAC network
CFG_NET_OPT := CFG_NET_LORAMAC
else
$(warning [Warning] No network type selected, assume private network by default.)
CFG_NET_MSG := Private network
CFG_NET_OPT := CFG_NET_PRIVATE
endif

### linking options

ifeq ($(CFG_SPI),native)
Expand Down Expand Up @@ -164,27 +65,16 @@ inc/config.h: ../VERSION library.cfg
# SPI interface
@echo "SPI interface : $(CFG_SPI_MSG)"
@echo " #define $(CFG_SPI_OPT) 1" >> $@
# Concentrator chip
@echo "Concentrator chip : $(CFG_CHIP_MSG)"
@echo " #define $(CFG_CHIP_OPT) 1" >> $@
# Radio chip(s)
@echo "Radio chip(s) : $(CFG_RADIO_MSG)"
@echo " #define $(CFG_RADIO_OPT) 1" >> $@
# Frequency band
@echo "Frequency band : $(CFG_BAND_MSG)"
@echo " #define $(CFG_BAND_OPT) 1" >> $@
# Board misc. parameters
@echo "Board misc. param : $(CFG_BRD_MSG)"
@echo " #define $(CFG_BRD_OPT) 1" >> $@
# Network type
@echo "Network type : $(CFG_NET_MSG)"
@echo " #define $(CFG_NET_OPT) 1" >> $@
# Debug options
@echo " #define DEBUG_AUX $(DEBUG_AUX)" >> $@
@echo " #define DEBUG_SPI $(DEBUG_SPI)" >> $@
@echo " #define DEBUG_REG $(DEBUG_REG)" >> $@
@echo " #define DEBUG_HAL $(DEBUG_HAL)" >> $@
@echo " #define DEBUG_GPS $(DEBUG_GPS)" >> $@
@echo " #define DEBUG_GPIO $(DEBUG_GPIO)" >> $@
# end of file
@echo "#endif" >> $@
@echo "*** Configuration seems ok ***"
Expand All @@ -197,6 +87,8 @@ obj/loragw_aux.o: src/loragw_aux.c inc/loragw_aux.h inc/config.h
ifeq ($(CFG_SPI),native)
obj/loragw_spi.o: src/loragw_spi.native.c inc/loragw_spi.h inc/config.h
$(CC) -c $(CFLAGS) $< -o $@
obj/loragw_gpio.o: src/loragw_gpio.native.c inc/loragw_gpio.h inc/config.h
$(CC) -c $(CFLAGS) $< -o $@
else ifeq ($(CFG_SPI),ftdi)
obj/loragw_spi.o: src/loragw_spi.ftdi.c inc/loragw_spi.h inc/config.h
$(CC) -c $(CFLAGS) $< -o $@
Expand All @@ -213,7 +105,7 @@ obj/loragw_gps.o: src/loragw_gps.c inc/loragw_gps.h inc/config.h

### static library

libloragw.a: obj/loragw_hal.o obj/loragw_gps.o obj/loragw_reg.o obj/loragw_spi.o obj/loragw_aux.o
libloragw.a: obj/loragw_hal.o obj/loragw_gps.o obj/loragw_reg.o obj/loragw_spi.o obj/loragw_aux.o obj/loragw_gpio.o
$(AR) rcs $@ $^

### test programs
Expand All @@ -233,4 +125,4 @@ test_loragw_gps: tst/test_loragw_gps.c libloragw.a
test_loragw_cal: tst/test_loragw_cal.c libloragw.a src/cal_fw.var
$(CC) $(CFLAGS) -L. $< -o $@ $(LIBS)

### EOF
### EOF
81 changes: 81 additions & 0 deletions libloragw/inc/loragw_gpio.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
/*
/ _____) _ | |
( (____ _____ ____ _| |_ _____ ____| |__
\____ \| ___ | (_ _) ___ |/ ___) _ \
_____) ) ____| | | || |_| ____( (___| | | |
(______/|_____)_|_|_| \__)_____)\____)_| |_|
(C)2013 Semtech-Cycleo
Description:
Host specific functions to address the GPIO. mainly the Reset pin
License: Revised BSD License, see LICENSE.TXT file include in the project
Maintainer: Miguel Luis
*/


#ifndef _LORAGW_GPIO_H
#define _LORAGW_GPIO_H

/* -------------------------------------------------------------------------- */
/* --- DEPENDANCIES --------------------------------------------------------- */

#include <stdint.h> /* C99 types*/

#include "config.h" /* library configuration options (dynamically generated) */

/* -------------------------------------------------------------------------- */
/* --- PUBLIC CONSTANTS ----------------------------------------------------- */

#define LGW_GPIO_SUCCESS 0
#define LGW_GPIO_ERROR -1

#define LGW_GPIO_IN 0
#define LGW_GPIO_OUT 1

#define LGW_GPIO_LOW 0
#define LGW_GPIO_HIGH 1

/* -------------------------------------------------------------------------- */
/* --- PUBLIC FUNCTIONS PROTOTYPES ------------------------------------------ */

/**
@brief Reserves the given GPIO pin
@param pin pin ID to be reserved
@return status of operation (LGW_GPIO_SUCCESS/LGW_GPIO_ERROR)
*/
int lgw_gpio_export(int pin);

/**
@brief Releases the given GPIO pin reservation
@param pin pin ID to be released
@return status of operation (LGW_GPIO_SUCCESS/LGW_GPIO_ERROR)
*/
int lgw_gpio_unexport(int pin);

/**
@brief Sets the GPIO pin to the given direction
@param pin pin ID to be changed
@param dir new direction for the pin(LGW_GPIO_IN/LGW_GPIO_OUT)
@return status of operation (LGW_GPIO_SUCCESS/LGW_GPIO_ERROR)
*/
int lgw_gpio_direction(int pin, int dir);

/**
@brief Reads the given GPIO pin
@param pin pin ID to be read
@return value of the given pin ID (LGW_GPIO_LOW/LGW_GPIO_HIGH/LGW_GPIO_ERROR)
*/
int lgw_gpio_read(int pin);

/**
@brief Writes the given GPIO pin with value
@param pin pin ID to be changed
@param value new value for the pin(LGW_GPIO_LOW/LGW_GPIO_HIDH)
@return status of operation (LGW_GPIO_SUCCESS/LGW_GPIO_ERROR)
*/
int lgw_gpio_write(int pin, int value);

#endif

/* --- EOF ------------------------------------------------------------------ */
Loading

0 comments on commit ee26db0

Please sign in to comment.