[Multitech Conduit] Problem including GPS-Data in Package-Forwarder

Hi there!

I have set up a Gateway from Multitech with a Gateway-Bridge and Package-Forwarder and erverything is working fine.

The Packages are created by and send correct and arrive on the server.

I used the default package forwarder from semtech and the gateway-bridge from broccar.
(I’ll include the .init and conf files at the end)

However we noticed, GPS-Data is missing. If i do

sudo tcpdump -AUq -i lo port 1700

I get all the other Information in the stats file, but nothing about the gps data.

However
grep '' /dev/ttyXRUSB2
Shows, that the gateway knows, where it is.

After reading some topics, I included
“gps”:“true”,
and
“gps_tty_path”:"/dev/ttyXRUSB2"
in the global_conf.

Also i found a path ($gps_path) in the .init file of the package forwarder and changed it to /dev/XRUSB2.

I also tried to start the forwarder manually since it would give me more output to work with, but I always get the error no conf files found.

Somehow there is also no log data at /var/log/lora-pkt-fwd-1.log (where I would expect it).

However there is still no GPS data in the forwarder packages, has any of you guys an idea why?

Any help is really appreciated, I don’t know what to do further to fix this problem.

UPDATE:

I tried to use the fake gps Option to check if it works with it but when I edit the global_conf like

"fake_gps":"true",
"ref_latitude": xxxx,xx,
"ref_longitude": xxxx,xx,
"ref_altitude": xxx

Now the dump data shows correct lati and alti attitudes. (if i don’t set “gps”:“true”)

Has anybody experienced something similar to this?
How can I get the real data in?

CODE:

Packet-Forwarder : init
#!/bin/bash

NAME="lora-packet-forwarder"
ENABLED="yes"


[ -f /etc/default/$NAME ] && source /etc/default/$NAME

run_dir=/var/run/lora
opt_conf_dir=/opt/lora
conf_dir=/var/config/lora
conf_file=$conf_dir/global_conf.json
conf_file_local=$conf_dir/local_conf.json

pkt_fwd=$run_dir/1/lora_pkt_fwd
pkt_fwd_log=/var/log/lora-pkt-fwd-1.log
pkt_fwd_pidfile=$run_dir/lora-pkt-fwd-1.pid

port1=/sys/devices/platform/mts-io/ap1
port2=/sys/devices/platform/mts-io/ap2

lora_mtac_id="MTAC-LORA"
lora_1_0_hw="MTAC-LORA-1.0"
lora_1_5_h_hw="MTAC-LORA-1.5"
lora_2_1_hw="MTAC-LORA-2.1"

lora_mtac_id="MTAC-LORA"
lora_mtac_id915="MTAC-LORA-915"
lora_mtac_id868="MTAC-LORA-868"
lora_mtac_h_id915="MTAC-LORA-H-915"
lora_mtac_h_id868="MTAC-LORA-H-868"

lora_mtcap_id="MTCAP-LORA"
lora_mtcap_id868="MTCAP-LORA-868"
lora_mtcap_id915="MTCAP-LORA-915"

lora_mtac_g_id="MTAC-LORA-G"
lora_mtac_g16_id868="MTAC-LORA-G16-868"
lora_mtac_g16_id915="MTAC-LORA-G16-915"
lora_mtac_g64_id868="MTAC-LORA-G64-868"
lora_mtac_g64_id915="MTAC-LORA-G64-915"

pkt_fwd_options=""

gps_path="/dev/ttyXRUSB2"

read_lora_hw_info() {
    lora_id=$(mts-io-sysfs show lora/product-id 2> /dev/null)
    lora_hw=$(mts-io-sysfs show lora/hw-version 2> /dev/null)
    lora_eui=$(mts-io-sysfs show lora/eui 2> /dev/null)
    lora_eui_raw=${lora_eui//:/}
}

hardware_found() {
    if [[ "$lora_id" =~ "$lora_mtac_g_id" ]]; then
        setup_mtcdt_2_1
    elif [[ "$lora_id" =~ "$lora_mtcap_id" ]]; then
        setup_mtcap
    elif [[ "$lora_id" =~ "$lora_mtac_id" ]]; then
        setup_mtcdt
    else
        return 1
    fi
    return 0
}

setup_mtcdt() {
    if [ -d $port1 ] && [[ $(cat $port1/hw-version) = $lora_hw ]]; then
        ln -sf /dev/spidev32766.2 /dev/spidev0.0
    elif [ -d $port2 ] && [[ $(cat $port2/hw-version) = $lora_hw ]]; then
        ln -sf /dev/spidev32765.2 /dev/spidev0.0
    fi

    if [ "$lora_hw" = "$lora_1_0_hw" ] && [[ ! "$lora_id" =~ .*-SPI ]]; then
        if [ "$lora_id" = "$lora_mtac_id868" ]; then
            GLOBAL_CONF=/opt/lora/global_conf.json.MTCDT_LORA_1_0.EU868
        elif [ "$lora_id" = "$lora_mtac_id915" ]; then
            GLOBAL_CONF=/opt/lora/global_conf.json.MTCDT_LORA_1_0.US915
        else
            echo "No valid configuration found for mtcdt exiting."
            exit 1
        fi
        ln -sf /opt/lora/basic_pkt_fwd-usb $pkt_fwd
    else
        if [ "$lora_id" = "$lora_mtac_h_id868" ]; then
            GLOBAL_CONF=/opt/lora/global_conf.json.MTCDT_LORA_1_5.EU868
        elif [ "$lora_id" = "$lora_mtac_h_id915" ]; then
            GLOBAL_CONF=/opt/lora/global_conf.json.MTCDT_LORA_1_5.US915
        else
            echo "No valid configuration found for mtcdt exiting."
            exit 1
        fi
        ln -sf /opt/lora/lora_pkt_fwd $pkt_fwd
    fi

    opt_conf_file=$opt_conf_dir/global_conf.json
    opt_conf_file_local=$opt_conf_dir/local_conf.json

    cp $GLOBAL_CONF $opt_conf_file

    if ! [ -f $conf_file ]; then
        mkdir -p /var/config/lora/
        cp $opt_conf_file $conf_file
        cp $opt_conf_file_local $conf_file_local
    fi
}

setup_mtcap() {
    if [ "$lora_id" = "$lora_mtcap_id868" ]; then
        GLOBAL_CONF=/opt/lora/global_conf.json.MTCAP_LORA_1_5.EU868
    elif [ "$lora_id" = "$lora_mtcap_id915" ]; then
        GLOBAL_CONF=/opt/lora/global_conf.json.MTCAP_LORA_1_5.US915
    else
        echo "No valid configuration found for mtcap exiting."
        exit 1
    fi

    opt_conf_file=$opt_conf_dir/global_conf.json
    opt_conf_file_local=$opt_conf_dir/local_conf.json

    cp $GLOBAL_CONF $opt_conf_file

    if ! [ -f $conf_file ]; then
        mkdir -p /var/config/lora/
        cp $opt_conf_file $conf_file
        cp $opt_conf_file_local $conf_file_local
    fi

    ln -sf /opt/lora/lora_pkt_fwd $pkt_fwd
}

setup_mtcdt_2_1() {
    if [[ "$lora_id" = "$lora_mtac_g16_id868" ]]; then
        GLOBAL_CONF=/opt/lora/global_conf.json.MTAC_LORA_2_1_loc_single_antenna_16ch_EU868
    elif [[ "$lora_id" = "$lora_mtac_g16_id915" ]]; then
        GLOBAL_CONF=/opt/lora/global_conf.json.MTAC_LORA_2_1_loc_single_antenna_16ch_US915
    elif [[ "$lora_id" = "$lora_mtac_g64_id868" ]]; then
        GLOBAL_CONF=/opt/lora/global_conf.json.MTAC_LORA_2_1_test_single_antenna_64ch_8x8_EU868
    elif [[ "$lora_id" = "$lora_mtac_g64_id915" ]]; then
        GLOBAL_CONF=/opt/lora/global_conf.json.MTAC_LORA_2_1_loc_single_antenna_64ch_US915
    else
        return 1
    fi

    opt_conf_file=$opt_conf_dir/global_conf.json

    cp $GLOBAL_CONF $opt_conf_file

    if ! [ -f $conf_file ]; then
        mkdir -p /var/config/lora/
        cp $opt_conf_file $conf_file
    fi

    ln -sf /opt/lora/pkt_forwarder $pkt_fwd

    if [ -f $gps_path ]; then
        pkt_fwd_options=" -g"
    fi
}

do_start() {

    mkdir -p $run_dir/1
    rm -rf $run_dir/1/*

    read_lora_hw_info

    if hardware_found; then
        echo "Found $lora_id with $lora_hw hardware. Configuring"
    else
        echo "$0: LORA card not detected"
        exit 1
    fi

    if ! [ -f $conf_file ]; then
        echo "$0: $conf_file missing"
        exit 1
    fi

    #
    # copy conf files to the run directory
    #
    cp $conf_file $run_dir/1/
    if [ -f $conf_file_local ]; then
        cp $conf_file_local $run_dir/1/
        sed -i.bak "s/\(.gateway_ID\"\s\:\s*\"\)<.>[^\"]\(.*\)/\1${lora_eui_raw}\2/g" /var/run/lora/1/local_conf.json
    fi

    sed -i.bak "s/\(.gateway_ID\"\s\:\s*\"\)<.>[^\"]\(.*\)/\1${lora_eui_raw}\2/g" /var/run/lora/1/global_conf.json

    #
    # start packet forwarder
    #
    echo -n "Starting $NAME: "

    /usr/sbin/start-stop-daemon --chdir $run_dir/1 --background --start --make-pidfile \
        --pidfile $pkt_fwd_pidfile --startas /bin/bash -- -c "exec $pkt_fwd $pkt_fwd_options"

    renice -n -20 -p $(pgrep $(basename $pkt_fwd))

    echo "OK"
}


do_stop() {
    echo -n "Stopping $NAME: "
    start-stop-daemon --stop --quiet --oknodo --pidfile $pkt_fwd_pidfile --retry 5
    rm -f $pkt_fwd_pidfile
    echo "OK"
}


if [ "$ENABLED" != "yes" ]; then
    echo "$NAME: disabled in /etc/default"
    exit
fi


case "$1" in
    "start")
    do_start
        ;;
    "stop")
    do_stop
        ;;
    "restart")
        ## Stop the service and regardless of whether it was
        ## running or not, start it again.
        do_stop
        do_start
        ;;
    *)
        ## If no parameters are given, print which are avaiable.
        echo "Usage: $0 {start|stop|restart}"
        exit 1
    ;;
esac

local conf

{
    "gateway_conf": {
        "server_address": "localhost",
        "serv_port_up": 1680,
        "serv_port_down": 1680,
    }

}

global conf

{
        "SX1301_conf": {
                "antenna_gain": 0,
                "chan_FSK": {
                        "bandwidth": 125000,
                        "datarate": 50000,
                        "enable": true,
                        "if": 300000,
                        "radio": 1
                },
                "chan_Lora_std": {
                        "bandwidth": 250000,
                        "enable": true,
                        "if": -200000,
                        "radio": 1,
                        "spread_factor": 7
                },
                "chan_multiSF_0": {
                        "enable": true,
                        "if": -400000,
                        "radio": 1
                },
                "chan_multiSF_1": {
                        "datarate": 50000,
                        "enable": true,
                        "if": 300000,       
                        "radio": 1        
                },                          
                "chan_Lora_std": {        
                        "bandwidth": 250000,
                        "enable": true,
                        "if": -200000,
                        "radio": 1,         
                        "spread_factor": 7
                },                          
                "chan_multiSF_0": {    
                        "enable": true,   
                        "if": -400000,
                        "radio": 1        
                },                     
                "chan_multiSF_1": {   
                        "enable": true,
                        "if": -200000,
                        "radio": 1 
                },                     
                "chan_multiSF_2": {   
                        "enable": true,     
                        "if": 0,            
                        "radio": 1          
                },                          
                "chan_multiSF_3": {         
                        "enable": true,     
                        "if": -400000,    
                        "radio": 0          
                },                          
                "chan_multiSF_4": {       
                        "enable": true,     
                        "if": -200000,    
                        "radio": 0        
                },                     
                "chan_multiSF_5": {       
                        "enable": true,
                        "if": 0,       
                        "radio": 0     
                },                     
                "chan_multiSF_6": {    
                        "enable": true,
                        "if": 200000,  
.....

"gateway_conf": {                        
                "forward_crc_disabled": false,
                "forward_crc_error": true,       
                "forward_crc_valid": true,       
                "gateway_ID": "<WILL-BE-AUTO-REPLACED-WITH-LORA-EUI>",
                "keepalive_interval": 10,        
                "push_timeout_ms": 100,                               
                "serv_port_down": 20000,   
                "serv_port_up": 20000,           
                "server_address": "52.3.215.147",                     
                "stat_interval": 30,       
                "autoquit_threshold": 60,        
                		"gps":"true",                                         
                "gps_tty_path":"/dev/ttyXRUSB2"
        }                                        
}

What multitech model are you using? And what packages .ipkg have you installed?

BR

Hi,
I am using the MultiConnect Conduit IP67 Base Station from Multitech.

I didn’t straight on install ipks’s since I created my own image for it by the yocto project,
I included the sources from brocarr for the gateway bridge and the official one from semtech for the packet-forwarder.

I guess that means, that i have the newest package-forwarder and gateway-bridge.

Is there any way to find out the version ?

If you need more information about something, i’m happy to provide it.

Oh! Did you manage to create a mlinux image with yocto? I have struggled a lot to achieve this, I could provide link or creation processes maybe this will solve some of my problems, I have in stock the same device that you, maybe we can help.

Use these commands will give you information to perform a deeper search of the problem.

mts-io-sysfs show lora/product-id
mts-io-sysfs show lora/hw-version
mts-io-sysfs lora/hw-version

Yes, after a lot of struggle, I did manage to generate an Image with all the necessary stuff.

If you have questions to some part or a problem, feel free to share it.

I will edit the original question since I tried some new stuff.

Could you tell me how you created the image with the broocar sources for the gateway and the official Seemtech and installed it on Multitech IP67? You seem to have solved what you had been trying for a long time and you can’t imagine how much I would appreciate it.

Hi yes sure,
I really know the struggle.
But I have to finish this project until thursday and gps data is essential so I can’t give you a long process documentation until then.

(If I solve it I can give it to you earlier :wink: )

All right I’ll hope and good luck with your project, while I continue to see how to install the seemtech to my Multitech, I think there must be a way without having to make a custom image to the base mlinux image.

Please don’t forget, you’re the only one I’ve seen work.

any news on this?
I have the same problem, and i cant make the real gps shows in the Loraserver.