Lora-net / sx1302_hal

SX1302/SX1303 Hardware Abstraction Layer and Tools (packet forwarder...)
Other
219 stars 272 forks source link

Failed to set SX1250_0 in STANDBY_RC mode #67

Closed gswebspace closed 1 year ago

gswebspace commented 2 years ago

Note: The device is using the RAK2287 Pi HAT, which uses RAK2287 concentrator with one SX1302 chip and two SX1250.

The packet forwarder (latest version) fails during startup with the following logs -

.
.
CoreCell reset through GPIO17...
SX1261 reset through GPIO17...
CoreCell power enable through GPIO18...
CoreCell ADC reset through GPIO13...
Opening SPI communication interface
Note: chip version is 0x05 (v0.5)
ERROR: Failed to set SX1250_0 in STANDBY_RC mode
ERROR: failed to setup radio 0
ERROR: [main] failed to start the concentrator

Tried using the chip_id tool, but that gives the same error -

root@bf8cb7d6a21e:/opt/sx1302_hal/bin# ./chip_id 
CoreCell reset through GPIO17...
SX1261 reset through GPIO17...
CoreCell power enable through GPIO18...
CoreCell ADC reset through GPIO13...
Opening SPI communication interface
Note: chip version is 0x05 (v0.5)
ERROR: Failed to set SX1250_0 in STANDBY_RC mode
ERROR: failed to setup radio 0
ERROR: failed to start the gateway

Interestingly power cycling (power off and on) helps. Logs after power cycle -

root@bf8cb7d6a21e:/opt/sx1302_hal/bin# ./chip_id 
CoreCell reset through GPIO17...
SX1261 reset through GPIO17...
CoreCell power enable through GPIO18...
CoreCell ADC reset through GPIO13...
Opening SPI communication interface
Note: chip version is 0x10 (v1.0)
INFO: using legacy timestamp
ARB: dual demodulation disabled for all SF
INFO: found temperature sensor on port 0x39

INFO: concentrator EUI: 0x0016c001ff19dccd

Closing SPI communication interface
CoreCell reset through GPIO17...
SX1261 reset through GPIO17...
CoreCell power enable through GPIO18...
CoreCell ADC reset through GPIO13...

But after the above command, if it is ran again, the problem shows up again -

root@bf8cb7d6a21e:/opt/sx1302_hal/bin# ./chip_id 
CoreCell reset through GPIO17...
SX1261 reset through GPIO17...
CoreCell power enable through GPIO18...
CoreCell ADC reset through GPIO13...
Opening SPI communication interface
Note: chip version is 0x10 (v1.0)
ERROR: Failed to set SX1250_0 in STANDBY_RC mode
ERROR: failed to setup radio 0
ERROR: failed to start the gateway

Note: Chip version goes from v0.5 to v1.0 after a power cycle, which is probably not normal.

Not sure how to fix/debug this ? Any help is appreciated. Thanks!

kmuster-semtech commented 2 years ago

The RAK2287 has its own firmware designed to work with the board described here. When using the sx1302_hal with the CoreCell board (PCB_E539V03A, user guide here), additional parameters are needed for the USB version with MCU mounted. Since the RAK2287 concentrator also has a MCU, try the following command instead: ./chip_id -u -d /dev/ttyACM0

mareksbb commented 2 years ago

I have the same problem with lora concentrator module RAK2287. Sometimes it works ok after power cycle..I also noticed switching version from v16(working) to v5(not working). Tried RAK's firmware for RAK2287 as suggested but got the same problem. Also tried test_loragw_com and test_loragw_com_sx1250 but it READS only zero. For me, bypassing returns 1 didnt work. It reads zeros after this is executed a = ioctl(spi_device, SPI_IOC_MESSAGE(1), &k); in loragw_sx1250.c and crash anyway.

pi@rak-gateway:/usr/local/rak/lora/rak2287_spi/lora_gateway $ ./test_loragw_com_sx1250 -d /dev/spidev0.0
CoreCell reset through GPIO17...
Opening SPI communication interface
Note: chip version is 0x00 (v0.0)
Radio0: get_status: 0x00
Radio1: get_status: 0x00
Cycle 0 > error during the buffer comparison
Written value: 67C66973
Read value:    00000000

Any suggestion to debug ? test

gpioread2

Edit: one more output:


~/sx1302_hal/bin $ ./chip_id -d /dev/spidev0.0  
CoreCell reset through GPIO23...  
SX1261 reset through GPIO23...  
CoreCell power enable through GPIO18...  
CoreCell ADC reset through GPIO13...  
Opening SPI communication interface  
Note: chip version is 0x05 (v0.5)  
ERROR: Failed to set SX1250_0 in STANDBY_RC mode  
ERROR: failed to setup radio 0  
ERROR: failed to start the gateway```
gswebspace commented 2 years ago

I can confirm similar results.

@kmuster-semtech Installed the latest RAK firmware as suggested. Same error.

RAK Firmware

root@rak-gateway:/opt/ttn-gateway/packet_forwarder/lora_pkt_fwd# ./start.sh 
./start.sh: line 6: echo: write error: Device or resource busy
*** Packet Forwarder ***
Version: 2.0.1
*** SX1302 HAL library version info ***
Version: 2.0.1;
***
INFO: Little endian host
INFO: found configuration file global_conf.json, parsing it
INFO: global_conf.json does contain a JSON object named SX130x_conf, parsing SX1302 parameters
INFO: com_type SPI, com_path /dev/spidev0.0, lorawan_public 1, clksrc 0, full_duplex 0
INFO: antenna_gain 0 dBi
INFO: Configuring legacy timestamp
INFO: no configuration for SX1261
INFO: Configuring Tx Gain LUT for rf_chain 0 with 16 indexes for sx1250
INFO: radio 0 enabled (type SX1250), center frequency 904300000, RSSI offset -215.399994, tx enabled 1, single input mode 0
INFO: radio 1 enabled (type SX1250), center frequency 905000000, RSSI offset -215.399994, tx enabled 0, single input mode 0
INFO: Lora multi-SF channel 0>  radio 0, IF -400000 Hz, 125 kHz bw, SF 5 to 12
INFO: Lora multi-SF channel 1>  radio 0, IF -200000 Hz, 125 kHz bw, SF 5 to 12
INFO: Lora multi-SF channel 2>  radio 0, IF 0 Hz, 125 kHz bw, SF 5 to 12
INFO: Lora multi-SF channel 3>  radio 0, IF 200000 Hz, 125 kHz bw, SF 5 to 12
INFO: Lora multi-SF channel 4>  radio 1, IF -300000 Hz, 125 kHz bw, SF 5 to 12
INFO: Lora multi-SF channel 5>  radio 1, IF -100000 Hz, 125 kHz bw, SF 5 to 12
INFO: Lora multi-SF channel 6>  radio 1, IF 100000 Hz, 125 kHz bw, SF 5 to 12
INFO: Lora multi-SF channel 7>  radio 1, IF 300000 Hz, 125 kHz bw, SF 5 to 12
INFO: Lora std channel> radio 0, IF 300000 Hz, 500000 Hz bw, SF 8, Explicit header
INFO: FSK channel 8 disabled
INFO: global_conf.json does contain a JSON object named gateway_conf, parsing gateway parameters
INFO: gateway MAC address is configured to E45F01FFFE2069FB
INFO: server hostname or IP address is configured to "nam1.cloud.thethings.network"
INFO: upstream port is configured to "1700"
INFO: downstream port is configured to "1700"
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: GPS serial port path is configured to "/dev/ttyAMA0"
INFO: Reference latitude is configured to 0.000000 deg
INFO: Reference longitude is configured to 0.000000 deg
INFO: Reference altitude is configured to 0 meters
INFO: Beaconing period is configured to 0 seconds
INFO: Beaconing signal will be emitted at 923300000 Hz
INFO: Beaconing channel number is set to 8
INFO: Beaconing channel frequency step is set to 600000Hz
INFO: Beaconing datarate is set to SF12
INFO: Beaconing modulation bandwidth is set to 500000Hz
INFO: Beaconing TX power is set to 27dBm
INFO: global_conf.json does contain a JSON object named debug_conf, parsing debug parameters
INFO: got 2 debug reference payload
INFO: reference payload ID 0 is 0xCAFE1234
INFO: reference payload ID 1 is 0xCAFE2345
INFO: setting debug log file name to loragw_hal.log
INFO: found configuration file local_conf.json, parsing it
INFO: local_conf.json does contain a JSON object named gateway_conf, parsing gateway parameters
INFO: gateway MAC address is configured to E45F01FFFE2069FB
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: [main] TTY port /dev/ttyAMA0 open for GPS synchronization
CoreCell reset through GPIO17...
Opening SPI communication interface
Note: chip version is 0x05 (v0.5)
ERROR: Failed to set SX1250_0 in STANDBY_RC mode
ERROR: failed to setup radio 0
ERROR: [main] failed to start the concentrator

Note: Failed to set SX1250_0 in STANDBY_RC mode

chip_id (USB)

root@rak-gateway:/opt/ttn-gateway# ./sx1302_hal/util_chip_id/chip_id -u -d /dev/ttyACM0
Opening USB communication interface
ERROR: failed to open COM port /dev/ttyACM0 - No such file or directory
ERROR: failed to start the gateway

Note: This one doesn't seem to be using USB.

chip_id (SPI)

root@rak-gateway:/opt/ttn-gateway# ./sx1302_hal/util_chip_id/chip_id -d /dev/spidev0.0
CoreCell reset through GPIO17...
Opening SPI communication interface
Note: chip version is 0x05 (v0.5)
ERROR: Failed to set SX1250_0 in STANDBY_RC mode
ERROR: failed to setup radio 0
ERROR: failed to start the gateway

Note: Same error Failed to set SX1250_0 in STANDBY_RC mode

test_loragw_com

root@rak-gateway:/opt/ttn-gateway/lora_gateway# ./test_loragw_com
CoreCell reset through GPIO17...
Beginning of test for loragw_com.c
Opening SPI communication interface
SX1302 version: 0x05
Cycle 0> error during the buffer comparison
Written values:
 5A  97  FC  0D  FF  2F  1A  FE  C0  54  AA  8C  8A  2B  C3  D9 
 9A  8C  D0  3A  65  35  AD  7B  26  29  FD  4E  EA  4D  F5  44 
 E5  F1  51  E4  20  6C  E2  E0  C0  8C  6D  4A  B7  30  23  51 
 BD  F3  8B  22  29  39  9D  4F  62  9A  9D  4D  E8  92  91  CD 
 84  E3  B1  A4  4F  93  85  0F  1F  F2  59  D6  22  7C  27  DF 
 6F  B3  02  98  EC  9F  E7  4E  3A  84  9B  22  17  2D  EF  9B 
 10  A0  3F  5F  33  C4  6E  52  B6  C7  28  D9  43  4F  B8  B2 
 02  BA  4B  EE  5A  32  3D  94  B7  D8  B6  CE  05  A5  69  15 
 45  A8  74  78  6D  E2  CA  23  A9  F2  FC  EC  41  B5  9F  44 
 6F  EA  32  C9  1C  6F  5D  D3  48  13  A1  4D  B8  0A  63  FD 
 B3  D7  75  20  BA  3F  43  63  31  40  50  73  F5  EF  B7  64 
 D9  E9  2E  F5  59  8B  C9  A1  9F  6A  EE  57  75  51  55  28 
 29  CA  48  E3  0A  8B  46  3B  CB  96  AE  C0  85  65  25  5E 
 4F  53  54  A8  DE  1D  49  7D  87  37  D5  FC  89  2A  24  B2 
 F4  6C  95  FE  F8  DB  3A  C3  72  E8  84  F7  4E  A9  56  9D 
 FC  AA  45  DA  C7  8E  58  4E  C5  2D  4B  4E  57  6F  00  4B 
 DC  95  4A  D4  71  84  97  E3  6C  1B  DA  BA  C4  30  57  C0 
 DA  9C  9B  A1  2A  F3  F0  F0  20  3B  3E  77  AA  3F  C2  86 
 D4  0C  5A  45  90  F2  28  FD  0D  03  B7  D2  33  0F  92  0E 
 AB  2D  AF  D6  20  9F  C6  40  DA  04  B7  85  43  7A  0B  18 
 86  66  5D  17  58  86  14  65  89  CB  37  BC  DA  CA  CA  86 
 F7  7A  5C  18  19  22  58  F4  26  10  79  6A  8A  84  82  10 
 EA  DF  27  42  65  3B  A8  EE  07  DF  AB  E1  A9  75  67  A1 
 EF  C3  B9  09  E5  11  FD  0C  21  76  76  AB  FA  F8  BC  E5 
 D7  E3  27  3D  1F  CF  2B  26  AF  D6  07  58  4C  6F  F9  3B 
 32  B2  44  18  C4  41  24  E5  B7  9A  91  B2  92  4D  97  69 
 30  BE  A6  4F  8E  D2  75  3D  A8  7D  95  F4  EC  8F  30  1E 
 41  74  36  05  B6  5A  EB  6D  F4  7C  1F  86  C9  B6  F0  F9 
 75  96  49  03  68  BE  40  11  3B  D5  05  27  64  35  46  A6 
 AA  7C  AB  60  D7  96  CD  CB  12  ED  52  DB  A3  42  D5  18 
 D8  1E  1B  41  DC  5B  52  18  31  57  3F  95  8D  85  3B  37 
 02  E7  97  D9  7D  64  A4  90  51  F6  6B  F5  38  40  0D  11 
 5E  29  52  3B  84  A4  53  B5  FB  92  4B  88  18  86  BF  1A 
 6D  56  F3  EB  BB  97  7B  0C  8E  E6  01  C6  27  0F  D7  85 
 38  29  C0  BC  CD  13  72  C9  A6  BD  51  BE  43  11  D8  B1 
 67  CB  9C  22  62  17  2F  F0  FD  30  B7  24  3F  8E  AA  77 
 B8  6A  34  85  7E  A6  4E  24  63  A0  E2  A6  B1  BA  57  18 
 85  F3  3B  E7  0A  6A  D8  08  9A  8F  2C  DA  1D  D6  51  D5 
 41  85  5B  BF  2B  A9  E3  8E  49  C5  35  FA  7F  8C  13  04 
 80  4E  EB  8A  B8  C3  92  52  52  BF  2C  70  95  7E  45  D6 
 03  A0  95  2F  4A  78  BD  93  3D  F2  8E  BC  7F  A1  C0  FF 
 EF  AC  89  A7  6F  1C  F9  C2  DB  26  32  70  A4  77  47  A7 
 18  DC  D6  62  55  94  F5  92  86  83  4F  05  24  0F  04  13 
 BB  8E  BA  2B  AA  B4  ED  85  DA  1F  F5  7E  96  3C  25  AE 
 19  FC  10  6E  90  06  00  16  89  4F  1C  AE  5F  20  C1  1A 
 AE  7C  45  58  30  32  DD  0A  51  D3  88  E8  0F  AD  96  28 
 A9  A7  96  39  AD  97  50  36  E6  6C  E4  45  8C  A6  60  3B 
 22  A5  93  52  D8  71  5C  29  44  E4  11  53  91  A8  7C  3B 
 4F  12  74  FC  A9  C4  32  90  30  17  D5  BD  BD  35  F8  DF 
 DB  8B  31  B3  FC  8D  DC  40  71  EE  94  02  96  10  3D  E5 
 22  B2  E1  CC  76  13  5C  A7  2A  31  64  E7  67  5C  C6  42 
 E7  F7  F5  E4  84  D1  24  F5  BF  B8  F8  55  C8  35  3A  EB 
 E7  1B  B7  5E  2F  13  05  59  44  69  41  AB  C5  07  ED  AC 
 FF  E2  90  83  B4  B5  79  73  6D  71  C9  36  A6  03  21  8E 
 1F  D8  EC  4E  EB  F1  A7  2F  5A  E8  DB  1F  F0  C8  CB  EF 
 AB  5C  72  5F  11  EB  D2  7E  5C  9B  B4  03  9F  D5  91  BE 
 AD  7D  0C  98  6E  B3  C8  C8  9C  A3  E7  8C  6B  B2  7B  16 
 0E  ED  75  1F  D9  48  9E  35  E3  52  38  82  28  C9  40  D5 
 46  4C  6E  B4  00  36  7C 
Read values:
 05  05  05  05  05  05  05  05  05  05  05  05  05  05  05  05 
 05  05  05  05  05  05  05  05  05  05  05  05  05  05  05  05 
 05  05  05  05  05  05  05  05  05  05  05  05  05  05  05  05 
 05  05  05  05  05  05  05  05  05  05  05  05  05  05  05  05 
 05  05  05  05  05  05  05  05  05  05  05  05  05  05  05  05 
 05  05  05  05  05  05  05  05  05  05  05  05  05  05  05  05 
 05  05  05  05  05  05  05  05  05  05  05  05  05  05  05  05 
 05  05  05  05  05  05  05  05  05  05  05  05  05  05  05  05 
 05  05  05  05  05  05  05  05  05  05  05  05  05  05  05  05 
 05  05  05  05  05  05  05  05  05  05  05  05  05  05  05  05 
 05  05  05  05  05  05  05  05  05  05  05  05  05  05  05  05 
 05  05  05  05  05  05  05  05  05  05  05  05  05  05  05  05 
 05  05  05  05  05  05  05  05  05  05  05  05  05  05  05  05 
 05  05  05  05  05  05  05  05  05  05  05  05  05  05  05  05 
 05  05  05  05  05  05  05  05  05  05  05  05  05  05  05  05 
 05  05  05  05  05  05  05  05  05  05  05  05  05  05  05  05 
 05  05  05  05  05  05  05  05  05  05  05  05  05  05  05  05 
 05  05  05  05  05  05  05  05  05  05  05  05  05  05  05  05 
 05  05  05  05  05  05  05  05  05  05  05  05  05  05  05  05 
 05  05  05  05  05  05  05  05  05  05  05  05  05  05  05  05 
 05  05  05  05  05  05  05  05  05  05  05  05  05  05  05  05 
 05  05  05  05  05  05  05  05  05  05  05  05  05  05  05  05 
 05  05  05  05  05  05  05  05  05  05  05  05  05  05  05  05 
 05  05  05  05  05  05  05  05  05  05  05  05  05  05  05  05 
 05  05  05  05  05  05  05  05  05  05  05  05  05  05  05  05 
 05  05  05  05  05  05  05  05  05  05  05  05  05  05  05  05 
 05  05  05  05  05  05  05  05  05  05  05  05  05  05  05  05 
 05  05  05  05  05  05  05  05  05  05  05  05  05  05  05  05 
 05  05  05  05  05  05  05  05  05  05  05  05  05  05  05  05 
 05  05  05  05  05  05  05  05  05  05  05  05  05  05  05  05 
 05  05  05  05  05  05  05  05  05  05  05  05  05  05  05  05 
 05  05  05  05  05  05  05  05  05  05  05  05  05  05  05  05 
 05  05  05  05  05  05  05  05  05  05  05  05  05  05  05  05 
 05  05  05  05  05  05  05  05  05  05  05  05  05  05  05  05 
 05  05  05  05  05  05  05  05  05  05  05  05  05  05  05  05 
 05  05  05  05  05  05  05  05  05  05  05  05  05  05  05  05 
 05  05  05  05  05  05  05  05  05  05  05  05  05  05  05  05 
 05  05  05  05  05  05  05  05  05  05  05  05  05  05  05  05 
 05  05  05  05  05  05  05  05  05  05  05  05  05  05  05  05 
 05  05  05  05  05  05  05  05  05  05  05  05  05  05  05  05 
 05  05  05  05  05  05  05  05  05  05  05  05  05  05  05  05 
 05  05  05  05  05  05  05  05  05  05  05  05  05  05  05  05 
 05  05  05  05  05  05  05  05  05  05  05  05  05  05  05  05 
 05  05  05  05  05  05  05  05  05  05  05  05  05  05  05  05 
 05  05  05  05  05  05  05  05  05  05  05  05  05  05  05  05 
 05  05  05  05  05  05  05  05  05  05  05  05  05  05  05  05 
 05  05  05  05  05  05  05  05  05  05  05  05  05  05  05  05 
 05  05  05  05  05  05  05  05  05  05  05  05  05  05  05  05 
 05  05  05  05  05  05  05  05  05  05  05  05  05  05  05  05 
 05  05  05  05  05  05  05  05  05  05  05  05  05  05  05  05 
 05  05  05  05  05  05  05  05  05  05  05  05  05  05  05  05 
 05  05  05  05  05  05  05  05  05  05  05  05  05  05  05  05 
 05  05  05  05  05  05  05  05  05  05  05  05  05  05  05  05 
 05  05  05  05  05  05  05  05  05  05  05  05  05  05  05  05 
 05  05  05  05  05  05  05  05  05  05  05  05  05  05  05  05 
 05  05  05  05  05  05  05  05  05  05  05  05  05  05  05  05 
 05  05  05  05  05  05  05  05  05  05  05  05  05  05  05  05 
 05  05  05  05  05  05  05  05  05  05  05  05  05  05  05  05 
 05  05  05  05  05  05  05 
Closing SPI communication interface
End of test for loragw_com.c

Note: The Read Values are a fixed value.

Also in /opt/ttn-gateway/packet_forwarder/lora_pkt_fwd, the reset pin is set as SX1302_RESET_PIN=17.

Is there a way to read any error codes from the sx1302 chip to understand what is the exact error ? Any specific register that could be read ?

mareksbb commented 2 years ago

SX1302_RESET_PIN=25 seems to solve the problem

gswebspace commented 2 years ago

@mareksbb Thanks for sharing ! It certainly is helping. The packet forwarder seems to be working fine now.

GPIO 25 seems to be connected to the GPS modules's RESET pin (on the RAK2287 Pi HAT). I have modified the reset_lgw.sh to do a GPS reset and then the sx1302 reset.

Starting longevity test to check stability.

The original cause of the issue is still unknown and needs investigation.

ahmed560 commented 2 years ago

this library is configured for raspberry pi os 32 bits. it's not compatible with 64 bits architecture

gswebspace commented 2 years ago

@ahmed560 I have tested sx1302_hal with 64 bit os on Rpi4B. It is compatible as far as I can see it.

ahmed560 commented 2 years ago

So, I did a cross-compilation with aarch64-linux-gnu toolchain for this project and i copied libraries and binary files in raspberry card the is worked but the RX test show this problem

Le ven. 3 juin 2022 à 07:58, Guinnes Singh @.***> a écrit :

@ahmed560 https://github.com/ahmed560 I have tested sx1302_hal with 64 bit os on Rpi4B. It is compatible as far as I can see it.

— Reply to this email directly, view it on GitHub https://github.com/Lora-net/sx1302_hal/issues/67#issuecomment-1145612499, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOIYQAFDAE52XT3JCMH4LWDVNGNHVANCNFSM5KP2OBQQ . You are receiving this because you were mentioned.Message ID: @.***>

gswebspace commented 2 years ago

@ahmed560 If you see the error Failed to set SX1250_0 in STANDBY_RC mode then so far the only solution is to try using GPIO25 , see : https://github.com/Lora-net/sx1302_hal/issues/67#issuecomment-1024326428

Exact cause of the issue is not yet known.

ahmed560 commented 2 years ago

Ok, I will check. thank you for your interraction

Le mar. 7 juin 2022 à 10:28, Guinnes Singh @.***> a écrit :

@ahmed560 https://github.com/ahmed560 If you see the error Failed to set SX1250_0 in STANDBY_RC mode then so far the only solution is to try using GPIO25 , see : #67 (comment) https://github.com/Lora-net/sx1302_hal/issues/67#issuecomment-1024326428

Exact cause of the issue is not yet known.

— Reply to this email directly, view it on GitHub https://github.com/Lora-net/sx1302_hal/issues/67#issuecomment-1148361077, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOIYQAEBFDCKAVSOTHEVO3LVN4B4FANCNFSM5KP2OBQQ . You are receiving this because you were mentioned.Message ID: @.***>

smtc-bot commented 1 year ago

Thank you for your inquiry.

Customers are encouraged to submit technical questions via our dedicated support portal at https://semtech.force.com/ldp/ldp_support.

We invite all users to visit the LoRa Developer Portal Forum at https://forum.lora-developers.semtech.com and to join the thriving LoRa development community!

chaudhariatul commented 1 year ago

I'm facing same issue:

"Failed to set SX1250_0 in STANDBY_RC mode"

Running on Raspberry Pi4B (4GB) with 64bit bullseye.


Update:

Changed the OS to 32bit bullseye and tried with SX1302_RESET_PIN=17 as well as SX1302_RESET_PIN=25.

Same error:

../util_chip_id/chip_id 
CoreCell reset through GPIO17...
SX1261 reset through GPIO17...
CoreCell power enable through GPIO18...
CoreCell ADC reset through GPIO13...
Opening SPI communication interface
Note: chip version is 0x0C (v0.12)
ERROR: Failed to set SX1250_0 in STANDBY_RC mode
ERROR: failed to setup radio 0
ERROR: failed to start the gateway
../util_chip_id/chip_id 
CoreCell reset through GPIO25...
SX1261 reset through GPIO25...
CoreCell power enable through GPIO18...
CoreCell ADC reset through GPIO13...
Opening SPI communication interface
Note: chip version is 0x10 (v1.0)
ERROR: Failed to set SX1250_0 in STANDBY_RC mode
ERROR: failed to setup radio 0
ERROR: failed to start the gateway
mcoracin commented 1 year ago

This issue is generally due to a bad SPI connection/configuration. You need to have test_loragw_com running with no error first. And of course, the the reset_lgw.sh script has to be executed.

chaudhariatul commented 1 year ago

@mcoracin Initially I had the same assumption that the SPI connection is bad.

However, I am able to use this setup with https://github.com/xoseperez/basicstation and able to connect it to ThingStack.

I've reached out to the rak forum for help too.

mcoracin commented 1 year ago

@chaudhariatul if the SPI is ok, I guess the issue would be around the reset_lgw.sh script, maybe the GPIO used on the RAK gateway are not the same ? I guess the RAK support should be able to help for that.

CoreCell reset through GPIO25...
SX1261 reset through GPIO25...
CoreCell power enable through GPIO18...
CoreCell ADC reset through GPIO13...
chaudhariatul commented 1 year ago

An update: Docker container based setup using https://github.com/RAKWireless/basicstation starts well but it fails after a couple hours

2022-11-29 15:17:20.168 [S00:INFO]  [STD]   8:    904.6MHz rf=0 freq=+300.0 datarate=8 bw=6 Explicit header
2022-11-29 15:17:20.168 [S00:INFO]  channel 9 disabled
2022-11-29 15:17:20.168 [S00:INFO] Station device: spi:/dev/spidev0.0 (PPS capture enabled)
2022-11-29 15:17:20.168 [S00:INFO] [lgw_com_open:84] Opening SPI communication interface
2022-11-29 15:17:20.168 [S00:INFO] [lgw_spi_open:88] Setting SPI speed to 8000000
2022-11-29 15:17:20.168 [S00:INFO] [lgw_connect:1192] chip version is 0x05 (v0.5)
2022-11-29 15:17:21.769 [S00:ERRO] [lgw_start:908] failed to setup radio 0
2022-11-29 15:17:21.769 [S00:ERRO] Concentrator start failed: lgw_start
2022-11-29 15:17:21.769 [S00:CRIT] Slave radio start up failed with status 0x08
ERROR: Failed to set SX1250_0 in STANDBY_RC mode
2022-11-29 15:17:21.761 [RAL:ERRO] Slave (0) - EOF
2022-11-29 15:17:21.761 [any:CRIT] Slave pid=32 idx=0: Fatal exit
mcoracin commented 1 year ago

I'm a bit surprised by the "chip version is 0x05 (v0.5)", I don't think this version exists. Could you try with SPI speed at 2MHz instead of 8MHz ?

chaudhariatul commented 1 year ago

Changing the speed to 2Mhz still shows chip version is 0x05 (v0.5)

basicstation    | 2022-11-29 17:01:03.910 [S00:INFO] Station device: spi:/dev/spidev0.0 (PPS capture enabled)
basicstation    | 2022-11-29 17:01:03.910 [S00:INFO] [lgw_com_open:84] Opening SPI communication interface
basicstation    | 2022-11-29 17:01:03.910 [S00:INFO] [lgw_spi_open:88] Setting SPI speed to 2000000
basicstation    | 2022-11-29 17:01:03.910 [S00:INFO] [lgw_connect:1192] chip version is 0x05 (v0.5)
basicstation    | 2022-11-29 17:01:03.787 [RAL:INFO] Region plan hwspec 'sx1301/1' mapped to 1 slaves 'sx1301/1'
basicstation    | 2022-11-29 17:01:03.787 [RAL:INFO] Master sending 645 bytes of JSON sx1301conf to slave (0)
basicstation    | 2022-11-29 17:01:03.788 [S2E:INFO] Configuring for region: US915 -- 923.0MHz..928.0MHz
basicstation    | 2022-11-29 17:01:03.788 [S2E:INFO]   DR0  SF10/BW125
basicstation    | 2022-11-29 17:01:03.788 [S2E:INFO]   DR1  SF9/BW125
basicstation    | 2022-11-29 17:01:03.788 [S2E:INFO]   DR2  SF8/BW125
basicstation    | 2022-11-29 17:01:03.788 [S2E:INFO]   DR3  SF7/BW125
basicstation    | 2022-11-29 17:01:03.788 [S2E:INFO]   DR4  SF8/BW500
basicstation    | 2022-11-29 17:01:03.788 [S2E:INFO]   DR5  FSK
basicstation    | 2022-11-29 17:01:03.788 [S2E:INFO]   DR6  FSK
basicstation    | 2022-11-29 17:01:03.788 [S2E:INFO]   DR7  FSK
basicstation    | 2022-11-29 17:01:03.788 [S2E:INFO]   DR8  SF12/BW500
basicstation    | 2022-11-29 17:01:03.788 [S2E:INFO]   DR9  SF11/BW500
basicstation    | 2022-11-29 17:01:03.788 [S2E:INFO]   DR10 SF10/BW500
basicstation    | 2022-11-29 17:01:03.788 [S2E:INFO]   DR11 SF9/BW500
basicstation    | 2022-11-29 17:01:03.788 [S2E:INFO]   DR12 SF8/BW500
basicstation    | 2022-11-29 17:01:03.788 [S2E:INFO]   DR13 SF7/BW500
basicstation    | 2022-11-29 17:01:03.788 [S2E:INFO]   DR14 FSK
basicstation    | 2022-11-29 17:01:03.788 [S2E:INFO]   DR15 FSK
basicstation    | 2022-11-29 17:01:03.788 [S2E:INFO]   TX power: 26.0 dBm EIRP
basicstation    | 2022-11-29 17:01:03.788 [S2E:INFO]   JoinEui list: 0 entries
basicstation    | 2022-11-29 17:01:03.788 [S2E:INFO]   NetID filter: FFFFFFFF-FFFFFFFF-FFFFFFFF-FFFFFFFF
basicstation    | 2022-11-29 17:01:03.788 [S2E:INFO]   Dev/test settings: nocca=1 nodc=1 nodwell=1
basicstation    | ERROR: Failed to set SX1250_0 in STANDBY_RC mode
basicstation    | 2022-11-29 17:01:05.512 [S00:ERRO] [lgw_start:908] failed to setup radio 0
basicstation    | 2022-11-29 17:01:05.512 [S00:ERRO] Concentrator start failed: lgw_start
basicstation    | 2022-11-29 17:01:05.512 [S00:CRIT] Slave radio start up failed with status 0x08
basicstation    | 2022-11-29 17:01:05.478 [RAL:ERRO] Slave (0) - EOF
basicstation    | 2022-11-29 17:01:05.478 [any:CRIT] Slave pid=34 idx=0: Fatal exit
mcoracin commented 1 year ago

Which gateway hardware are you using exactly, and which version of the HAL ? The version should be 1.0, 1.2 or 1.3 for the sx1302_hal. Are you sure that the power supply is ok ?

chaudhariatul commented 1 year ago

@mcoracin Gateway hardware : It's an used RakV2 helium miner that I got from ebay. It was on the deny list of Helium. I'm repurposing this for something else. Where should I look for the HAL details? Power supply seems to be ok, I connected it to another setup of RaspberryPi with RAK2287 and it works.


First run after power cycle (shutdown + wait 5mins + power on)

../util_chip_id/chip_id
CoreCell reset through GPIO17...
SX1261 reset through GPIO17...
CoreCell power enable through GPIO18...
CoreCell ADC reset through GPIO13...
Opening SPI communication interface
Note: chip version is 0x10 (v1.0)
INFO: using legacy timestamp
ARB: dual demodulation disabled for all SF
INFO: no temperature sensor found on port 0x39
INFO: no temperature sensor found on port 0x3B
INFO: no temperature sensor found on port 0x38
ERROR: no temperature sensor found.
ERROR: failed to start the gateway

Retrying after 10secs

../util_chip_id/chip_id
CoreCell reset through GPIO17...
SX1261 reset through GPIO17...
CoreCell power enable through GPIO18...
CoreCell ADC reset through GPIO13...
Opening SPI communication interface
Note: chip version is 0x10 (v1.0)
ERROR: Failed to set SX1250_0 in STANDBY_RC mode
ERROR: failed to setup radio 0
ERROR: failed to start the gateway

After 5 mins

../util_chip_id/chip_id
CoreCell reset through GPIO17...
SX1261 reset through GPIO17...
CoreCell power enable through GPIO18...
CoreCell ADC reset through GPIO13...
Opening SPI communication interface
Note: chip version is 0x05 (v0.5)
ERROR: Failed to set SX1250_0 in STANDBY_RC mode
ERROR: failed to setup radio 0
ERROR: failed to start the gateway
chaudhariatul commented 1 year ago

Update:

Changing reset port to 25 and disabling temperature checks as done here helped: https://github.com/brocaar/sx1302_hal

I will need to create or find a patch for BasicStation when using RAK2287 : https://github.com/lorabasics/basicstation

mcoracin commented 1 year ago

So, disabling the temperature sensor is to avoid the startup error I guess, right ? Then the issue you were getting was due to the sx1302 not being reset due to wrong pin, is that correct ?

chaudhariatul commented 1 year ago

Correct.

RAK2287 board which comes from the Helium miner seems to be slightly different than the one sold separately. I cant tell what are these differences but looking from the top there is no GPS on the RakV2.

So setting the reset port to 25 and disabling temperature check works. Here is the output:

CoreCell reset through GPIO25...
SX1261 reset through GPIO25...
CoreCell power enable through GPIO18...
CoreCell ADC reset through GPIO13...
Opening SPI communication interface
Note: chip version is 0x10 (v1.0)
INFO: using legacy timestamp
ARB: dual demodulation disabled for all SF
INFO: no temperature sensor found on port 0x39
INFO: no temperature sensor found on port 0x3B
INFO: no temperature sensor found on port 0x38
ERROR: no temperature sensor found.

INFO: concentrator EUI: 0x0016c001f103b3b3

Closing SPI communication interface
CoreCell reset through GPIO25...
SX1261 reset through GPIO25...
CoreCell power enable through GPIO18...
CoreCell ADC reset through GPIO13...

I'm able to use the the board with thingstack:

cat docker-compose.yml
version: '3.7'
services:
  basicstation:
    image: xoseperez/basicstation:v2.5.0
    container_name: basicstation
    restart: unless-stopped
    privileged: true
    network_mode: host
    environment:
      MODEL: "SX1302"
      DEVICE: "/dev/spidev0.0"
      INTERFACE: "SPI"
      MODEL: "SX1302"
      DESIGN: "CORECELL"
      GW_RESET_GPIO: 25
      SPI_SPEED: "8000000"
      GATEWAY_EUI: "________"
      USE_CUPS: 0
      SERVER: "______"
      TLS_SNI: "false"
      TC_URI: "wss://_____:8887"
      TC_TRUST: "-----BEGIN CERTIFICATE-----MIIDvjCCAqagAwIBAgIUFOEN1....-----END CERTIFICATE-----"
      TC_KEY: "NNSXS...."

So the next thing to identify is a patch required to disable temperature. I have these references and need to find a right solution:

  1. https://github.com/Lora-net/sx1302_hal/pull/63
  2. https://github.com/lorabasics/basicstation/issues/157
  3. https://github.com/lorabasics/basicstation/issues/125#issuecomment-934491017