Conduit Manual Join to SX1276 MBED (Third party device)
Home › Forums › Conduit: mLinux Model › Conduit Manual Join to SX1276 MBED (Third party device)
Tagged: SX1276
- This topic has 29 replies, 2 voices, and was last updated 8 years, 11 months ago by Eduardo Garcia.
-
AuthorPosts
-
November 12, 2015 at 5:24 pm #9960Eduardo GarciaParticipant
Hello:
I am using the mLinux Conduit, trying to add a third party device to the network manually (my SX1276 MBED shield module). I have double checked that every key is the same, but I still get a “read(net): Connection Refused” after I try a ‘node add’. Does anyboday have any tips they could give me or point me in the right direction?
The code I am using on my 3rd party device is an example directly from the manufacturer( ).
If somebody has also had success with the SX1276 I would appreciate any comments you may have!
Thanks!,
-Ed
- This topic was modified 8 years, 11 months ago by Eduardo Garcia.
November 12, 2015 at 5:35 pm #9961Eduardo GarciaParticipantI forgot to mention the code I am using on the SX1276 is (https://developer.mbed.org/teams/Semtech/code/LoRaWAN-lmic-app/).
Here is my mLinux configuration file:
GNU nano 2.2.5 File: lora-network-server.conf { "db": "/var/config/lora/lora-network-server.db", "backupInterval": 21600, /* DB write interval (seconds) */ "lora": { "netID": "010203", /* netID for beacon packets */ "frequencyBand": "915", /* US="915", EU="868" */ "frequencySubBand": 7, /* Sub-band for US operation, 1-8 */ "rx1DatarateOffset": 0, /* Datarate offset for mote rx window 1 s$ "rx2Datarate": 12, /* Datarate for mote rxwindow 2 $ "maxTxPower": 14, /* Max Tx power (dBm), -6 to 26 */ "frequencyEU": 867500000 /* center freq for extra EU channels (Hz$ }, "udp": { "appPortUp": 1784, /* port for user-developed application use */ "appPortDown": 1786 /* port for user-developed application use */ }, "addressRange": { "start": "00:00:00:01", /* address range used for mDots */ "end": "FF:FF:FF:FE" }, "network": { "public": true, /* set to false for private LoRa network with $ "leasetime": 1440, /* time until mDot join expires (minutes) */ "name": "LORA", /* configure network security */ "passphrase": "LORA" }, "mqtt" : { "enabled": true, /* set to true to publish/subscribe to MQTT serv$ "host": "127.0.0.1", "port": 1883 }, "log" : { "console" : true, "syslog" : false, "level" : 30, /* error=10, warn=20, info=30, debug=50, trace=60, $ "path": "/var/log/lora-network-server.log" } }
- This reply was modified 8 years, 11 months ago by Eduardo Garcia.
November 12, 2015 at 5:45 pm #9964Jason ReissKeymasterCan you post an example of the node add command you issued?
Also post the command you use to connect to command port.
November 12, 2015 at 5:50 pm #9965Eduardo GarciaParticipantSure!
Here was my first try with the original info:
node add 12345678 0000000000000000 0123456789ABCDEF 2b7e151628aed2a6abf7158809cf4f3c 2b7e151628aed2a6abf7158809cf4f3c
I also tried the following (changing all data on the SX1276) just to rule out stuff like endiannes:
node add 33333333 ffffffffffffffff ffffffffffffffff afafafafafafafafafafafafafafafaf afafafafafafafafafafafafafafafaf
I am not sure about the command to connect to the command port. I did
'nc -u localhost 6677'
after connecting to the Conduit by SSH.Thank you!
- This reply was modified 8 years, 11 months ago by Eduardo Garcia.
November 12, 2015 at 5:50 pm #9966Jason ReissKeymasterCommand should be
nc -u localhost 6677November 12, 2015 at 5:52 pm #9968Jason ReissKeymasterCheck
# ps -A | grep loraMake sure lora-network-server is running.
November 12, 2015 at 5:57 pm #9969Jason ReissKeymasterNetwork name and passphrase need to be at least 8 characters.
November 12, 2015 at 5:59 pm #9970Eduardo GarciaParticipantHi Jason:
Thanks, I have checked your comments. I did write the nc -u localhost 6677 correctly on my code, I mispelled it on this post (sorry). I will change the network name and passphrase (but aren’t they for OTA?). When I do “ps -A | grep lora” nothing is happening! I believe Lora is not running. I did “/etc/init.d/lora-network-server restart” and got the following:
Stopping lora-network-server: start-stop-daemon: warning: failed to kill 1145: No such process OK Found lora card MTAC-LORA-915 Starting lora-network-server: OK
Then I did “ps -A | grep lora” but nothing appears on screen.
- This reply was modified 8 years, 11 months ago by Eduardo Garcia.
November 12, 2015 at 6:05 pm #9972Eduardo GarciaParticipantAlso:
# opkg list | grep lora lora-network-server - 0.0.8-r0.0 lora-packet-forwarder - 1.4.1-r8.16 lora-query - 0.0.1-r0.0
November 12, 2015 at 6:12 pm #9973Jason ReissKeymasterYou can check /var/log/lora-network-server.log.
It will mention the short name and passphrase.
Have you modified lmic for 8 channel operation?
November 12, 2015 at 6:19 pm #9974Eduardo GarciaParticipantI have changed the network name to be more than 8 characters long, and after restarting I do not get any errors on the log. I am not sure if the lora process is active, “ps -A | grep lora” returns me nothing.
I think the LMIC has not been modified for 8 channel operation (I am still new to the code), I will check into it.
“ps -A” returns me the following:
PID TTY TIME CMD 1 ? 00:00:05 init 2 ? 00:00:00 kthreadd 3 ? 00:00:00 ksoftirqd/0 5 ? 00:00:00 kworker/0:0H 6 ? 00:00:00 kworker/u2:0 7 ? 00:00:00 khelper 8 ? 00:00:00 kdevtmpfs 9 ? 00:00:00 writeback 10 ? 00:00:00 bioset 11 ? 00:00:00 crypto 12 ? 00:00:00 kblockd 13 ? 00:00:00 khubd 23 ? 00:00:00 rpciod 25 ? 00:00:00 khungtaskd 26 ? 00:00:00 kswapd0 27 ? 00:00:00 fsnotify_mark 28 ? 00:00:00 nfsiod 29 ? 00:00:00 cifsiod 62 ? 00:00:00 deferwq 74 ? 00:00:00 jffs2_gcd_mtd6 87 ? 00:00:00 udevd 195 ? 00:00:10 jffs2_gcd_mtd8 222 ? 00:00:00 kworker/u2:2 336 ? 00:00:00 udevd 337 ? 00:00:00 udevd 373 ? 00:00:00 dbus-daemon 382 ? 00:00:00 sshd 393 ? 00:00:00 syslogd 397 ? 00:00:00 klogd 446 ? 00:00:37 mosquitto 464 ? 00:00:00 crond 470 ? 00:00:00 reset-handler 477 ttyS0 00:00:00 getty 479 ttyGS0 00:00:00 getty 686 ? 00:00:00 kworker/0:0 705 ? 00:00:00 kworker/0:2 751 ? 00:00:05 sshd 756 pts/0 00:00:01 sh 1292 ? 00:00:23 basic_pkt_fwd 1298 pts/0 00:00:00 ps
November 12, 2015 at 6:22 pm #9975Jason ReissKeymasterWhat does the log show?
November 12, 2015 at 6:31 pm #9976Eduardo GarciaParticipantSorry Jason, after changing the name I erased the contents of the log, and no other log has been created! The only thing that it said before I deleted it was that it was complaining about the name being too short. Nothing else.
I have retried everhing again (restart lora server and manual connection) to see if it would write something to the log, but no luck. The weird part is that the log was erased, and now I cannot find the file!
November 12, 2015 at 6:48 pm #9977Jason ReissKeymasterTry stop and then start instead of restart.
November 12, 2015 at 6:49 pm #9978Jason ReissKeymasterDid you change passphrase?
November 12, 2015 at 7:41 pm #9981Jason ReissKeymasterAnother thing to do is check that the lora-network-server.conf file is in proper form. You can copy and paste the contents to jsonlint.com to verify it is still in json format. Fix any errors and copy/paste the file back.
- This reply was modified 8 years, 11 months ago by Jason Reiss.
November 13, 2015 at 8:43 am #9987Eduardo GarciaParticipantHi Jason:
Thank again for your ligthning fast responses!
Contents of Init script:
#!/bin/bash NAME="lora-network-server" ENABLED="yes" [ -f /etc/default/$NAME ] && source /etc/default/$NAME run_dir=/var/run/lora conf_dir=/var/config/lora conf_file=$conf_dir/lora-network-server.conf conf_db=$conf_dir/lora-network-server.db net_server=/opt/lora/lora-network-server net_server_log=/var/log/lora-network-server.log net_server_pidfile=$run_dir/$NAME.pid pkt_fwd=/opt/lora/basic_pkt_fwd pkt_fwd_log=/var/log/lora-pkt-fwd.log pkt_fwd_pidfile=$run_dir/lora-pkt-fwd.pid lora_us_id="MTAC-LORA-915" lora_eu_id="MTAC-LORA-868" read_card_info() { # product-id of first lora card lora_id=$(mts-io-sysfs show lora/product-id 2> /dev/null) lora_eui=$(mts-io-sysfs show lora/eui 2> /dev/null) # remove all colons lora_eui_raw=${lora_eui//:/} } card_found() { if [ "$lora_id" = "$lora_us_id" ] || [ "$lora_id" = "$lora_eu_id" ]; then echo "Found lora card $lora_id" return 0 else return 1 fi } do_start() { read_card_info if ! [ -f $conf_file ]; then echo "$0: $conf_file missing" exit 1 fi if ! card_found; then echo "$0: MTAC-LORA not detected" exit 1 fi echo -n "Starting $NAME: " mkdir -p $run_dir # start network server start-stop-daemon --start --background --make-pidfile \ --pidfile $net_server_pidfile --exec $net_server -- \ -c $conf_file --lora-eui $lora_eui --lora-path $run_dir --db $conf_db \ --noconsole -l $net_server_log sleep 1 # start packet forwarder start-stop-daemon --start --background --make-pidfile \ --pidfile $pkt_fwd_pidfile --exec $pkt_fwd -- \ -c $run_dir -l $pkt_fwd_log echo "OK" } do_stop() { echo -n "Stopping $NAME: " start-stop-daemon --stop --quiet --oknodo --pidfile $net_server_pidfile --retry 15 start-stop-daemon --stop --quiet --oknodo --pidfile $pkt_fwd_pidfile --retry 5 rm -f $net_server_pidfile $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
I also tried the JSON lint. It seems it did not like the comments that the file had, so I removed them until I got no errors. Here is the conf file I am using now:
{ "db": "/var/config/lora/lora-network-server.db", "backupInterval": "21600", "lora": { "netID": "010203", "frequencyBand": "915", "frequencySubBand": 7, "rx1DatarateOffset": 0, "rx2Datarate": 12, "maxTxPower": 14, "frequencyEU": 867500000 }, "udp": { "appPortUp": 1784, "appPortDown": 1786 }, "addressRange": { "start": "00:00:00:01", "end": "FF:FF:FF:FE" }, "network": { "public": true, "leasetime": 1440, "name": "BGLORANETWORK", "passphrase": "BGLORANETWORK" }, "mqtt": { "enabled": true, "host": "127.0.0.1", "port": 1883 }, "log": { "console": true, "syslog": false, "level": 30, "path": "/var/log/lora-network-server.log" } }
I also tried stopping and starting the proccess as you suggested, but when I try to stop it tells me the following:
root@mtcdt:/var/config/lora# /etc/init.d/lora-network-server stop Stopping lora-network-server: start-stop-daemon: warning: failed to kill 1100: No such process OK root@mtcdt:/var/config/lora# /etc/init.d/lora-network-server start Found lora card MTAC-LORA-915 Starting lora-network-server: OK root@mtcdt:/var/config/lora#
I still believe the process may not be starting correctly!
Thanks!- This reply was modified 8 years, 11 months ago by Eduardo Garcia.
November 13, 2015 at 8:58 am #9989Eduardo GarciaParticipantHere is the log from my latest server restart:
9:55:38:888|INFO| ------------------------------------------- 9:55:38:893|INFO| DB loading... 9:55:38:900|ERROR| SQL error: [no such table: schema] on first call 9:55:38:900|INFO| Database version: 0 9:55:38:900|INFO| Latest version: 5 9:55:38:901|WARNING| Creating database 9:55:38:969|INFO| Network settings not found in database, setting to current settings 9:55:39:37|INFO| Beacon is disabled
November 13, 2015 at 8:58 am #9990Jason ReissKeymasterWhen I copy and paste from the above post there are some bad quote characters. Are these in the file on the Conduit?
Here they are replaced with ‘?’ characters:
{ "db": "/var/config/lora/lora-network-server.db", "backupInterval": "21600?, "lora": { "netID": "010203?, "frequencyBand": "915?, "frequencySubBand": 7, "rx1DatarateOffset": 0, "rx2Datarate": 12, "maxTxPower": 14, "frequencyEU": 867500000 }, "udp": { "appPortUp": 1784, "appPortDown": 1786 }, "addressRange": { "start": "00:00:00:01?, "end": "FF:FF:FF:FE" }, "network": { "public": true, "leasetime": 1440, "name": "BGLORANETWORK", "passphrase": "BGLORANETWORK" }, "mqtt": { "enabled": true, "host": "127.0.0.1?, "port": 1883 }, "log": { "console": true, "syslog": false, "level": 30, "path": "/var/log/lora-network-server.log" } }
November 13, 2015 at 8:59 am #9991Jason ReissKeymasterOK, things are running?
November 13, 2015 at 9:04 am #9992Eduardo GarciaParticipantI am not sure if they are running correctly: no luck connecting. Also, “ps -A | grep lora” does not return anything.
I changed the quotes you mentioned (I have no idea how they could be other characters!)
After doing this change and restarting I am getting the same log message as I posted before.
November 13, 2015 at 9:14 am #9993Eduardo GarciaParticipantI am now trying with every code being filled with 0xFF as shown below:
nc -u localhost 6677 node add 33333333 ffffffffffffffff ffffffffffffffff ffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffff
I also made these changes on the SX1276. I still get connection refused.
November 13, 2015 at 9:20 am #9994Jason ReissKeymasterI found the issue with the config.
Backup interval must be a number, not a string.“backupInterval”: 21600,
November 13, 2015 at 9:29 am #9995Eduardo GarciaParticipantThanks Jason, now when I do ps -A | grep lora I get
“1383 ? 00:00:03 lora-network-se”So I think that fixed the issue.
I tried to add the node and something seemed to happen. Are there any function I could use to check the nodes in the networks, datalog data or anything to check that the node is indeed in the network?Thanks again!
November 13, 2015 at 9:32 am #9996Jason ReissKeymasternode list
November 13, 2015 at 9:33 am #9997Jason ReissKeymasterAlso lora-query
Usage: lora-query [-t timeout] [-s] [-n]
Simple UDP client utility to pull info from LoRa Network server
–timeout (t) : UDP recv timeout, default: 100 (msecs)
–stats (s) : get LoRa Network server statistics
–stats-reset (r) : reset LoRa Network server statistics
–node-list (n) : get Node List
–json (j) : data in json format
–help (?) : returns this message
–version (v) : print versionNovember 13, 2015 at 9:36 am #9998Eduardo GarciaParticipantI tried both commands and they say that the command is not found.
November 13, 2015 at 9:39 am #9999Eduardo GarciaParticipantSorry, I wrote the second command wrong. Now I type
“lora-query -t 5000 -s -n”
and I getnull ^[[ASyntax error in command "node list" Word 1
November 13, 2015 at 9:49 am #10000Jason ReissKeymasterlora-query will be run on the command line. It will open UDP session and issue command and give result. It makes it easier than using the “nc -u localhost 6677”.
# lora-query -t 5000 -s -n
November 13, 2015 at 10:09 am #10001Eduardo GarciaParticipantHi Jason:
Thank you very much for your help! It seems that the node is now connected and I can see it with the lora-query command.
Thanks again for your fast responses, and for all your help!
-
AuthorPosts
- You must be logged in to reply to this topic.