mirakonta / lora_gateway

Driver/HAL to build a gateway using a concentrator board based on Semtech SX1301 multi-channel modem and SX1257/SX1255 RF transceivers.
Other
107 stars 39 forks source link

ERROR: Version of calibration firmware not expected #3

Closed huzhifeng closed 8 years ago

huzhifeng commented 8 years ago

Hi @nestorayuso Wiki page is really an awesome tutorial. I'm following the Part 3: Compile LoRa gateway software to setup my own LoRa gateway, the only difference is that i'm using Ubuntu 14.04 instead of Raspberry-Pi, packet_forwarder(basic_pkt_fwd) works as expected, but util_tx_test, test_loragw_hal and test_loragw_cal report "ERROR: Version of calibration firmware not expected, actual:4 expected:2"

Below is the detail, any suggestions will be appreciated, thanks.

huzhifeng@Ubuntu14:~$ lsusb | grep FT232H
Bus 001 Device 003: ID 0403:6014 Future Technology Devices International, Ltd FT232H Single HS USB-UART/FIFO IC
huzhifeng@Ubuntu14:~$ cd lora/mirakonta/   
huzhifeng@Ubuntu14:~/lora/mirakonta$ ls
lora_gateway  packet_forwarder
huzhifeng@Ubuntu14:~/lora/mirakonta$ cd lora_gateway/
huzhifeng@Ubuntu14:~/lora/mirakonta/lora_gateway$ git remote -v
origin  https://github.com/mirakonta/lora_gateway.git (fetch)
origin  https://github.com/mirakonta/lora_gateway.git (push)
huzhifeng@Ubuntu14:~/lora/mirakonta/lora_gateway$ make clean all
huzhifeng@Ubuntu14:~/lora/mirakonta/lora_gateway$ cd ../packet_forwarder/
huzhifeng@Ubuntu14:~/lora/mirakonta/packet_forwarder$ git remote -v          
origin  https://github.com/mirakonta/packet_forwarder.git (fetch)
origin  https://github.com/mirakonta/packet_forwarder.git (push)
huzhifeng@Ubuntu14:~/lora/mirakonta/packet_forwarder$ make clean all
huzhifeng@Ubuntu14:~/lora/mirakonta/packet_forwarder$ cd ..
huzhifeng@Ubuntu14:~/lora/mirakonta$ mkdir -p exec
huzhifeng@Ubuntu14:~/lora/mirakonta$ cp packet_forwarder/basic_pkt_fwd/basic_pkt_fwd exec/
huzhifeng@Ubuntu14:~/lora/mirakonta$ cp packet_forwarder/basic_pkt_fwd/*.json exec/
huzhifeng@Ubuntu14:~/lora/mirakonta$ cd exec/
huzhifeng@Ubuntu14:~/lora/mirakonta/exec$ ./basic_pkt_fwd 
*** Basic Packet Forwarder for Lora Gateway ***
Version: 2.1.0
*** Lora concentrator HAL library version info ***
Version: 3.1.0; Options: ftdi;
***
INFO: Little endian host
INFO: found global configuration file global_conf.json, parsing it
INFO: global_conf.json does contain a JSON object named SX1301_conf, parsing SX1301 parameters
INFO: lorawan_public 1, clksrc 0
lgw_board_setconf:566: Note: board configuration; lorawan_public:1, clksrc:0
INFO: Configuring TX LUT with 16 indexes
INFO: radio 0 enabled (type SX1257), center frequency 868200000, RSSI offset -166.000000, tx enabled 1
lgw_rxrf_setconf:598: Note: rf_chain 0 configuration; en:1 freq:868200000 rssi_offset:-166.000000 radio_type:2 tx_enable:1
INFO: radio 1 enabled (type SX1257), center frequency 869200000, RSSI offset -166.000000, tx enabled 0
lgw_rxrf_setconf:598: Note: rf_chain 1 configuration; en:1 freq:869200000 rssi_offset:-166.000000 radio_type:2 tx_enable:0
INFO: Lora multi-SF channel 0>  radio 0, IF -100000 Hz, 125 kHz bw, SF 7 to 12
lgw_rxif_setconf:702: Note: LoRa 'multi' if_chain 0 configuration; en:1 freq:-100000 SF_mask:0x7e
INFO: Lora multi-SF channel 1>  radio 0, IF 100000 Hz, 125 kHz bw, SF 7 to 12
lgw_rxif_setconf:702: Note: LoRa 'multi' if_chain 1 configuration; en:1 freq:100000 SF_mask:0x7e
INFO: Lora multi-SF channel 2>  radio 0, IF 300000 Hz, 125 kHz bw, SF 7 to 12
lgw_rxif_setconf:702: Note: LoRa 'multi' if_chain 2 configuration; en:1 freq:300000 SF_mask:0x7e
INFO: Lora multi-SF channel 3>  radio 1, IF -350000 Hz, 125 kHz bw, SF 7 to 12
lgw_rxif_setconf:702: Note: LoRa 'multi' if_chain 3 configuration; en:1 freq:-350000 SF_mask:0x7e
INFO: Lora multi-SF channel 4>  radio 1, IF -150000 Hz, 125 kHz bw, SF 7 to 12
lgw_rxif_setconf:702: Note: LoRa 'multi' if_chain 4 configuration; en:1 freq:-150000 SF_mask:0x7e
INFO: Lora multi-SF channel 5>  radio 1, IF 325000 Hz, 125 kHz bw, SF 7 to 12
lgw_rxif_setconf:702: Note: LoRa 'multi' if_chain 5 configuration; en:1 freq:325000 SF_mask:0x7e
INFO: Lora multi-SF channel 6 disabled
lgw_rxif_setconf:623: Note: if_chain 6 disabled
INFO: Lora multi-SF channel 7 disabled
lgw_rxif_setconf:623: Note: if_chain 7 disabled
INFO: Lora std channel> radio 0, IF 100000 Hz, 250000 Hz bw, SF 7
lgw_rxif_setconf:676: Note: LoRa 'std' if_chain 8 configuration; en:1 freq:100000 bw:2 dr:2
INFO: FSK channel> radio 0, IF 100000 Hz, 125000 Hz bw, 50000 bps datarate
lgw_rxif_setconf:732: Note: FSK if_chain 9 configuration; en:1 freq:100000 bw:3 dr:50000 (50000 real dr) sync:0xC194C1
INFO: global_conf.json does contain a JSON object named gateway_conf, parsing gateway parameters
INFO: gateway MAC address is configured to AA555A0000000000
INFO: server hostname or IP address is configured to "127.0.0.1"
INFO: upstream port is configured to "1680"
INFO: downstream port is configured to "1680"
INFO: downstream keep-alive interval is configured to 10 seconds
INFO: statistics display interval is configured to 30 seconds
INFO: upstream PUSH_DATA time-out is configured to 100 ms
INFO: packets received with a valid CRC will be forwarded
INFO: packets received with a CRC error will NOT be forwarded
INFO: packets received with no CRC will NOT be forwarded
INFO: found local configuration file local_conf.json, parsing it
INFO: redefined parameters will overwrite global parameters
INFO: local_conf.json does not contain a JSON object named SX1301_conf
INFO: local_conf.json does contain a JSON object named gateway_conf, parsing gateway parameters
INFO: gateway MAC address is configured to AA555A0000000101
INFO: packets received with a valid CRC will be forwarded
INFO: packets received with a CRC error will NOT be forwarded
INFO: packets received with no CRC will NOT be forwarded
Note: success connecting the concentrator
setup_sx125x:358: Note: SX125x #0 version register returned 0x21
setup_sx125x:363: Note: SX125x #0 clock output enabled
setup_sx125x:420: Note: SX125x #0 PLL start (attempt 1)
setup_sx125x:358: Note: SX125x #1 version register returned 0x21
setup_sx125x:366: Note: SX125x #1 clock output disabled
setup_sx125x:420: Note: SX125x #1 PLL start (attempt 1)
lgw_start:887: Note: calibration started (time: 2300 ms)
lgw_start:908: Note: calibration finished (status = 191)
Info: Initialising AGC firmware...
Info: putting back original RADIO_SELECT value
INFO: [main] concentrator started, packet can now be received

##### 2016-07-10 14:14:26 GMT #####
### [UPSTREAM] ###
# RF packets received by concentrator: 0
# CRC_OK: 0.00%, CRC_FAIL: 0.00%, NO_CRC: 0.00%
# RF packets forwarded: 0 (0 bytes)
# PUSH_DATA datagrams sent: 0 (0 bytes)
# PUSH_DATA acknowledged: 0.00%
### [DOWNSTREAM] ###
# PULL_DATA sent: 3 (0.00% acknowledged)
# PULL_RESP(onse) datagrams received: 0 (0 bytes)
# RF packets sent to concentrator: 0 (0 bytes)
# TX errors: 0
##### END #####
^C
##### 2016-07-10 14:14:35 GMT #####
### [UPSTREAM] ###
# RF packets received by concentrator: 0
# CRC_OK: 0.00%, CRC_FAIL: 0.00%, NO_CRC: 0.00%
# RF packets forwarded: 0 (0 bytes)
# PUSH_DATA datagrams sent: 0 (0 bytes)
# PUSH_DATA acknowledged: 0.00%
### [DOWNSTREAM] ###
# PULL_DATA sent: 1 (0.00% acknowledged)
# PULL_RESP(onse) datagrams received: 0 (0 bytes)
# RF packets sent to concentrator: 0 (0 bytes)
# TX errors: 0
##### END #####

INFO: End of upstream thread
Note: success disconnecting the concentrator
INFO: concentrator stopped successfully
INFO: Exiting packet forwarder program
huzhifeng@Ubuntu14:~/lora/mirakonta/exec$ 
huzhifeng@Ubuntu14:~/lora/mirakonta/exec$ ../lora_gateway/util_tx_test/util_tx_test -r 1257 -f 868
Sending -1 packets on 868000000 Hz (BW 125 kHz, SF 10, CR 1, 16 bytes payload, 8 symbols preamble) at 14 dBm, with 1000 ms between each
lgw_board_setconf:566: Note: board configuration; lorawan_public:1, clksrc:1
lgw_rxrf_setconf:598: Note: rf_chain 0 configuration; en:1 freq:868000000 rssi_offset:0.000000 radio_type:2 tx_enable:1
Note: success connecting the concentrator
setup_sx125x:358: Note: SX125x #0 version register returned 0x21
setup_sx125x:366: Note: SX125x #0 clock output disabled
setup_sx125x:420: Note: SX125x #0 PLL start (attempt 1)
setup_sx125x:358: Note: SX125x #1 version register returned 0x21
setup_sx125x:363: Note: SX125x #1 clock output enabled
setup_sx125x:377: ERROR: UNEXPECTED VALUE 0 FOR RADIO TYPE
setup_sx125x:424: Note: SX125x #1 kept in standby mode
ERROR: Version of calibration firmware not expected, actual:4 expected:2
ERROR: failed to start the concentrator
huzhifeng@Ubuntu14:~/lora/mirakonta/exec$
huzhifeng@Ubuntu14:~/lora/mirakonta/exec$ ../lora_gateway/libloragw/test_loragw_hal -a 868.1 -b 868.3 -t 868 -r 1257
Beginning of test for loragw_hal.c
*** Library version information ***
Version: 3.1.0; Options: ftdi;

lgw_board_setconf:566: Note: board configuration; lorawan_public:1, clksrc:1
lgw_rxrf_setconf:598: Note: rf_chain 0 configuration; en:1 freq:868100000 rssi_offset:0.000000 radio_type:2 tx_enable:1
lgw_rxrf_setconf:598: Note: rf_chain 1 configuration; en:1 freq:868300000 rssi_offset:0.000000 radio_type:2 tx_enable:0
lgw_rxif_setconf:702: Note: LoRa 'multi' if_chain 0 configuration; en:1 freq:-300000 SF_mask:0x7e
lgw_rxif_setconf:702: Note: LoRa 'multi' if_chain 1 configuration; en:1 freq:300000 SF_mask:0x7e
lgw_rxif_setconf:702: Note: LoRa 'multi' if_chain 2 configuration; en:1 freq:-300000 SF_mask:0x7e
lgw_rxif_setconf:702: Note: LoRa 'multi' if_chain 3 configuration; en:1 freq:300000 SF_mask:0x7e
lgw_rxif_setconf:702: Note: LoRa 'multi' if_chain 4 configuration; en:1 freq:-100000 SF_mask:0x7e
lgw_rxif_setconf:702: Note: LoRa 'multi' if_chain 5 configuration; en:1 freq:100000 SF_mask:0x7e
lgw_rxif_setconf:702: Note: LoRa 'multi' if_chain 6 configuration; en:1 freq:-100000 SF_mask:0x7e
lgw_rxif_setconf:702: Note: LoRa 'multi' if_chain 7 configuration; en:1 freq:100000 SF_mask:0x7e
lgw_rxif_setconf:676: Note: LoRa 'std' if_chain 8 configuration; en:1 freq:0 bw:2 dr:16
lgw_rxif_setconf:732: Note: FSK if_chain 9 configuration; en:1 freq:0 bw:2 dr:64000 (64000 real dr) sync:0xC194C1
Note: success connecting the concentrator
setup_sx125x:358: Note: SX125x #0 version register returned 0x21
setup_sx125x:366: Note: SX125x #0 clock output disabled
setup_sx125x:420: Note: SX125x #0 PLL start (attempt 1)
setup_sx125x:358: Note: SX125x #1 version register returned 0x21
setup_sx125x:363: Note: SX125x #1 clock output enabled
setup_sx125x:420: Note: SX125x #1 PLL start (attempt 1)
ERROR: Version of calibration firmware not expected, actual:4 expected:2
*** Impossible to start concentrator ***
huzhifeng@Ubuntu14:~/lora/mirakonta/exec$ 
nestorayuso commented 8 years ago

Hi, I did not run this tests. In my tutorial I explain the baseband is clocked by the other radio, not the default one. In packet forwarder it is modified in global_conf.json file.

In util_tx_test it should be modified in line 121 of util_tx_test.c https://github.com/mirakonta/lora_gateway/blob/master/util_tx_test/src/util_tx_test.c#L121

Tell me if this (clocksource = 0) solves the problem and I will update the repository

huzhifeng commented 8 years ago

Hi @nestorayuso

You are right, it works now when I change "clocksource = 1" to "clocksource = 0" Thanks for your help.

BTW, test_loragw_hal and test_loragw_cal have same problem, you'd better fix them before close this issue.

My changes and test logs:

huzhifeng@Ubuntu14:~/lora/mirakonta/lora_gateway$ grep -rwn "clocksource = 1" ./  
./util_tx_test/src/util_tx_test.c:121:  uint8_t clocksource = 1; /* Radio B is source by default */
./libloragw/tst/test_loragw_hal.c:101:  uint8_t clocksource = 1; /* Radio B is source by default */
./libloragw/tst/test_loragw_cal.c:145:  uint8_t clocksource = 1; /* Radio B is source by default */
huzhifeng@Ubuntu14:~/lora/mirakonta/lora_gateway$ grep -rwl "clocksource = " ./ | xargs sed -i "s/clocksource = 1/clocksource = 0/g" 
huzhifeng@Ubuntu14:~/lora/mirakonta/lora_gateway$ git diff
diff --git a/libloragw/tst/test_loragw_cal.c b/libloragw/tst/test_loragw_cal.c
index fe8c140..8d36fc1 100644
--- a/libloragw/tst/test_loragw_cal.c
+++ b/libloragw/tst/test_loragw_cal.c
@@ -142,7 +142,7 @@ int main(int argc, char **argv)
        double xd = 0.0;
        uint32_t fa = 0, fb = 0;
        enum lgw_radio_type_e radio_type = LGW_RADIO_TYPE_NONE;
-       uint8_t clocksource = 1; /* Radio B is source by default */
+       uint8_t clocksource = 0; /* Radio B is source by default */
        uint8_t tx_enable = 0;
        int nb_cal = 5; 

diff --git a/libloragw/tst/test_loragw_hal.c b/libloragw/tst/test_loragw_hal.c
index 62dc115..e4f6129 100644
--- a/libloragw/tst/test_loragw_hal.c
+++ b/libloragw/tst/test_loragw_hal.c
@@ -98,7 +98,7 @@ int main(int argc, char **argv)
        int nb_pkt;
        uint32_t fa = 0, fb = 0, ft = 0;
        enum lgw_radio_type_e radio_type = LGW_RADIO_TYPE_NONE;
-       uint8_t clocksource = 1; /* Radio B is source by default */
+       uint8_t clocksource = 0; /* Radio B is source by default */

        uint32_t tx_cnt = 0;
        unsigned long loop_cnt = 0;
diff --git a/util_tx_test/src/util_tx_test.c b/util_tx_test/src/util_tx_test.c
index f4166aa..f5c681b 100644
--- a/util_tx_test/src/util_tx_test.c
+++ b/util_tx_test/src/util_tx_test.c
@@ -118,7 +118,7 @@ int main(int argc, char **argv)

        /* RF configuration (TX fail if RF chain is not enabled) */
        enum lgw_radio_type_e radio_type = LGW_RADIO_TYPE_NONE;
-       uint8_t clocksource = 1; /* Radio B is source by default */
+       uint8_t clocksource = 0; /* Radio B is source by default */
        struct lgw_conf_board_s boardconf;
        struct lgw_conf_rxrf_s rfconf;

huzhifeng@Ubuntu14:~/lora/mirakonta/lora_gateway$ make clean all
huzhifeng@Ubuntu14:~/lora/mirakonta/lora_gateway$ ./util_tx_test/util_tx_test -r 1257 -f 868
Sending -1 packets on 868000000 Hz (BW 125 kHz, SF 10, CR 1, 16 bytes payload, 8 symbols preamble) at 14 dBm, with 1000 ms between each
INFO: concentrator started, packet can be sent
Sending packet number 1 ...OK
Sending packet number 2 ...OK
Sending packet number 3 ...OK
Sending packet number 4 ...OK
Sending packet number 5 ...OK
Sending packet number 6 ...OK
Sending packet number 7 ...OK
^CExiting LoRa concentrator TX test program
huzhifeng@Ubuntu14:~/lora/mirakonta/lora_gateway$ 
huzhifeng@Ubuntu14:~/lora/mirakonta/lora_gateway$ ./libloragw/test_loragw_hal -a 868.1 -b 868.3 -t 868 -r 1257
Beginning of test for loragw_hal.c
*** Library version information ***
Version: 3.1.0; Options: ftdi;

*** Concentrator started ***
+++
Sending packet #0, rf path 0, return 0
status -> 4:2:
TX finished
+++
Sending packet #1, rf path 0, return 0
status -> 4:2:
TX finished
+++
Sending packet #2, rf path 0, return 0
status -> 4:2:
TX finished
^C
End of test for loragw_hal.c
huzhifeng@Ubuntu14:~/lora/mirakonta/lora_gateway$ ./libloragw/test_loragw_cal -a 868.1 -b 868.3 -t 868 -r 1257 
Library version information: Version: 3.1.0; Options: ftdi;
Radio type: 2
Radio A frequency: 868.100000 MHz
Radio B frequency: 868.300000 MHz
Number of calibration iterations: 5
Calibration command: brd: 0, chip: 1257, dac: 3
nestorayuso commented 8 years ago

fixed in test_loragw_hal and test_loragw_cal too.