sh123 / esp32_loraprs

LoRa ESP32 KISS Bluetooth modem (for APRSDroid or aprs.fi iOS) + APRS-IS RX/TX iGate over WiFi + Digipeater + DV (with Codec2 Walkie-Talkie)
https://github.com/sh123/esp32_loraprs
GNU General Public License v3.0
185 stars 37 forks source link

ESP32 hangs after getting package from lora Tracker! #27

Closed GabeHC closed 2 years ago

GabeHC commented 2 years ago

Hardware : ESP32 Lora board design by myself (BV5DJ) Lora : E22 SX1268 config: server mode (APRS-IS gate mode) ERR:

[INFO]_ sendPeriodicBeacon : Periodic beacon is sent Guru Meditation Error: Core 1 panic'ed (Coprocessor exception) Core 1 register dump: PC : 0x400d57c6 PS : 0x00060330 A0 : 0x800d2ec8 A1 : 0x3ffcfe60 A2 : 0x3ffc4a9c A3 : 0x00000001 A4 : 0x0000003f A5 : 0x00000000 A6 : 0x000000c0 A7 : 0x3ffcff48 A8 : 0x800d57c6 A9 : 0x3ffcff00 A10 : 0xc22c0000 A11 : 0x000000c0 A12 : 0x00000001 A13 : 0x00000001 A14 : 0x00060b20 A15 : 0x00000000 SAR : 0x0000001d EXCCAUSE: 0x00000004 EXCVADDR: 0x00000000 LBEG : 0x40092d59 LEND : 0x40092d69 LCOUNT : 0xfffffffe Core 1 was running in ISR context: EPC1 : 0x400d57c6 EPC2 : 0x00000000 EPC3 : 0x00000000 EPC4 : 0x40090db8 ELF file SHA256: 0000000000000000 Backtrace: 0x400d57c6:0x3ffcfe60 0x400d2ec5:0x3ffcff20 0x400d2ec5:0x3ffcff70 0x400d5acd:0x3ffcffe0 0x400d2939:0x3ffd0020 0x400e1904:0x3ffd0040 0x40094cf2:0x3ffd0060 Rebooting... ets...

sh123 commented 2 years ago

Seems that reading in ISR does not work for sx1268 module, I'll try to find some generic solution to that. Unfortunately, do not have this module to test.

sh123 commented 2 years ago

Please, try with this branch https://github.com/sh123/esp32_loraprs/tree/taskread, it will spawn separate reader task instead of reading in ISR, I'll merge it to master if it works for you.

GabeHC commented 2 years ago

Where are you located? I can get you one for testing. I try to run it on Lilygo T-Beam V1.1. nothing ever heard on it. not even get into ISR. what went wrong with it?

sh123 commented 2 years ago

Can you get working one of these? https://github.com/jgromes/RadioLib/tree/master/examples/SX126x (one board with transmit and one board with receive)

For sx126x you need to set config CFG_LORA_PIN_DIO0 pin to your DIO1 hardware pin and CFG_LORA_PIN_DIO1 pin to your BUSY hardware pin, as it constructs module this way for SX127x:

new Module(config_.LoraPinSs, config_.LoraPinDio0, config_.LoraPinRst, config_.LoraPinDio1)

and SX126x expects second argument to be DIO1 and last argument to be BUSY.

RadioLib is confusing, because it provides support for multiple modules, but there is no common interface (despite common naming), so each module usage requires some tweaks.

I've renamed these DIO0 and DIO1 to A and B, to make them more generic and added comments about SX126x pinouts, please try it out.

GabeHC commented 2 years ago

Yes, It work with RadioLib examples without any problem. Dio0/Dio1, getModemStatus(), getFrequencyError() are all fixed

sh123 commented 2 years ago

Where are your changes, can you point to the branch with your changes (or config file)? If it works with RadioLib examples and does not work with esp32_loraprs, then the only reason is some misconfiguration of pinouts or LoRa parameters mismatch between transmitter and receiver. I've ordered couple of these ebyte e22 SX1262 modules, will try them out, but will take some weeks until they arrive here.

sh123 commented 2 years ago

@GabeHC , received modules need to perform some soldering, will try them out, have you got them working or still having problems with receiving?

GabeHC commented 2 years ago

unfortunately no! I even try it on two TTGO T-Beam, still not working. Tracker uses this one my code is here

GabeHC commented 2 years ago

@GabeHC , received modules need to perform some soldering, will try them out, have you got them working or still having problems with receiving? I suspect it is the getModemStatus() that I have simply return not busy for all cases. It is not transmitting nor receiving!

sh123 commented 2 years ago

I think #if MODULE_NAME == SX1268 statement and others are not gonna work, because SX1268 is a class, I've made some changes to make correct compilation in master, will test when solder module.

Also, RXEN/TXEN switch pins should be specified, they are not 4 and 5, but should be set to real pinouts, I've moved their declaration to config.h, they need to be set to 2 and 4 based on your schematics, otherwise neither transmit, nor receive gonna work, because RadioLib will use wrong pinouts and module TX/RX won't be triggered. Built in LED uses gpio 2, so need to use another pinout or disable heartbeat blinking in main sketch or set to some unused pin.

GabeHC commented 2 years ago

Yes RXEN/TXEN were set to 2,4, and Builtin LED set to 12 in my case.

Following is my config.h

// change pinouts if not defined through native board LORA_* definitions

define USE_RADIOLIB

//

ifndef LORA_RST

pragma message("LoRa pin definitions are not found, redefining...")

define LORA_RST 14

define LORA_IRQ 33

endif

//

ifndef BUILTIN_LED

pragma message("BUILDIN_LED is not found, defining as 12")

define BUILTIN_LED 12

endif

//#define BUILTIN_LED 12

define CFG_IS_CLIENT_MODE false // false - server mode (APRS-IS gate mode)

/* // lora pinouts, CAD and ISR usage

define CFG_LORA_PIN_SS SS

define CFG_LORA_PIN_RST LORA_RST

define CFG_LORA_PIN_DIO0 LORA_IRQ

ifdef USE_RADIOLIB

define CFG_LORA_PIN_DIO1 LORA_IRQ // set to your DIO1 pin number if connected

define CFG_LORA_USE_ISR true // always ON for RadioLib

else

define CFG_LORA_PIN_DIO1 RADIOLIB_NC // not used in arduino-LoRa

define CFG_LORA_USE_ISR false // set to true for ISR usage in arduino-LoRa

endif

define CFG_LORA_USE_CAD false // set to true to utilize carrier detection

*/ // lora pinouts, CAD and ISR usage

define CFG_LORA_PIN_SS SS

define CFG_LORA_PIN_RST LORA_RST

define CFG_LORA_PIN_A LORA_IRQ // (sx127x - dio0, sx126x/sx128x - dio1)

ifdef USE_RADIOLIB

define CFG_LORA_PIN_B RADIOLIB_NC // (sx127x - dio1, sx126x/sx128x - busy)

define CFG_LORA_USE_ISR true // always ON for RadioLib

else

define CFG_LORA_PIN_DIO1 LORA_IRQ // not used in arduino-LoRa

define CFG_LORA_USE_ISR false // set to true for ISR usage in arduino-LoRa

endif

define CFG_LORA_USE_CAD false // set to true to utilize carrier detection

// USB

define CFG_USB_SERIAL_ENABLE false // true - enable communication over USB Serial

// // KISS protocol options

define CFG_KISS_EXTENSIONS true // true - enable modem control from application with KISS commands

define CFG_KISS_TCP_IP false // true - run as KISS TCP/IP server, no bluetooth operations performed

// // APRS-IS gateway options, valid in when CFG_IS_CLIENT_MODE = false

define CFG_PERSISTENT_APRS false // keep tcp/ip connection open (lot of traffic), otherwise connect on new packet (very rare traffic)

define CFG_DIGIREPEAT false // digirepeat incoming packets

define CFG_RF_TO_IS true // forward packets from radio to internet

define CFG_IS_TO_RF true // forward packets from internet to radio basedon CFG_APRS_FILTER

define CFG_BEACON true // enable perdiodc beacon from CFG_APRS_RAW_BKN

define CFG_TEXT_PACKETS false // enable aprs text packets instead of binary for interoperability with other projects (disables KISS+ax.25)

// // frequency correction for narrow band bandwidths

define CFG_FREQ_CORR false // true - correct own frequency based on received packet

define CFG_FREQ_CORR_DELTA 1000 // correct when frequency difference is larger than this value

// // PTT control

define CFG_PTT_ENABLE false // enable external ptt (relay) control (for amplifier)

define CFG_PTT_PIN 4 // PTT pin

define CFG_PTT_TX_DELAY_MS 50 // time between relay swited on and transmission

define CFG_PTT_TX_TAIL_MS 10 // time between stop transmission and relay off

sh123 commented 2 years ago

I think CFG_LORA_PIN_B needs to be set to BUSY GPIO pin number as in RadioLib examples instead of RADIOLIB_NC, I'll try later, still soldering module on prototype board.

// SX1262 has the following connections:
// NSS pin:   10
// DIO1 pin:  2
// NRST pin:  3
// BUSY pin:  9
SX1262 radio = new Module(10, 2, 3, 9);
GabeHC commented 2 years ago

Now it does transmit, but still nothing heard. no mater it is set to Text or Binary mode. seams ISR is not active.

[INFO] printConfig : Current mode: APRS-IS iGate [INFO] printConfig : Built with RadioLib library [INFO] printConfig : Using TNC2 text mode [INFO] printConfig : UsbSerialEnable: no [INFO] printConfig : EnableSignalReport: yes [INFO] printConfig : EnablePersistentAprsConnection: yes [INFO] printConfig : EnableRfToIs: yes [INFO] printConfig : EnableIsToRf: no [INFO] printConfig : EnableRepeater: no [INFO] printConfig : EnableBeacon: yes [INFO] setup : KISS extensions are disabled in TNC2 mode [INFO] setupLora : Initializing LoRa [INFO] setupLora : Frequency: 438200000 Hz [INFO] setupLora : Bandwidth: 125000 Hz [INFO] setupLora : Spreading: 12 [INFO] setupLora : Coding rate: 8 [INFO] setupLora : Power: 22 dBm [INFO] setupLora : Sync: 0x34 [INFO] setupLora : CRC: enabled [INFO] setupLora : Using SX126X module [INFO] setupLora : LoRa initialized [INFO] setupWifi : WIFI connecting to GabeAP [WARN] setupWifi : WIFI retrying 0 [WARN] setupWifi : WIFI retrying 1 [WARN] setupWifi : WIFI retrying 2 [WARN] setupWifi : WIFI retrying 3 [WARN] setupWifi : WIFI retrying 4 [INFO] setupWifi : WIFI connected to GabeAP [INFO] setupWifi : IP address: 10.0.0.152 [INFO] setupBt : BT init loraprs [INFO] setupBt : BT initialized [INFO] reconnectAprsis : APRSIS connecting to rotate.aprs2.net [INFO] reconnectAprsis : APRSIS connected [INFO] reconnectAprsis : APRSIS logged in [INFO] sendPeriodicBeacon : Periodic beacon is sent [INFO] onAprsisDataAvailable : # aprsc 2.1.10-gd72a17c [INFO] onAprsisDataAvailable : # logresp BV5DJ-10 verified, server T2ALBERTA [INFO] onAprsisDataAvailable : # aprsc 2.1.10-gd72a17c 19 Nov 2021 10:22:17 GMT T2ALBERTA 44.184.136.10:14580 [INFO] onAprsisDataAvailable : # aprsc 2.1.10-gd72a17c 19 Nov 2021 10:22:37 GMT T2ALBERTA 44.184.136.10:14580

sh123 commented 2 years ago

Soldered module, works fine for both RX/TX between E22 and RA-01 modules from master (and with master radiolib) when setting CFG_LORA_USE_ISR to false. Tested as APRS-IS RX/TX iGate, APRSDroid and also with Codec2 Walkie-Talkie app between two modems with digital voice.

Reading in ISR does not work for this module, so need to disable reading in ISR, causes exception, I'll probably completely remove reading is ISR in favor of reading in separate task.

Also, need to figure out how to use CAD on SX126X module, otherwise when there is heavy IS to RF traffic client transmits without checking if channel is busy, for now just set it to busy when reading current packet.

E22 module is so much better than RA-01 for APRS, more stable frequency (could be used on 20.8 kHz channel) and measured output power almost 30 dBm when powered from single cell USB power bank.

img

image

// comment out for arduino-Lora usage
#define USE_RADIOLIB

// Uncomment for SX126X module usage
#define USE_SX126X

// Check your module name at https://github.com/jgromes/RadioLib/wiki/Modules
#ifdef USE_SX126X
#define MODULE_NAME   SX1268
#else
#define MODULE_NAME   SX1278
#endif

#define LED_TOGGLE_PERIOD     1000

#define SERIAL_BAUD_RATE      115200

#define CFG_LOG_LEVEL         DebugLogLevel::LVL_INFO

// change pinouts if not defined through native board LORA_* definitions
#ifndef LORA_CS
#pragma message("LoRa pin definitions are not found, redefining...")
#ifdef USE_SX126X
#define LORA_RST              27
#define LORA_IRQ              12
#else
#define LORA_RST              26
#define LORA_IRQ              14
#endif
#endif

#ifndef BUILTIN_LED
#pragma message("BUILDIN_LED is not found, defining as 2")
#define BUILTIN_LED           2
#endif

#define CFG_IS_CLIENT_MODE    true

#define CFG_LORA_PIN_SS       SS
#define CFG_LORA_PIN_RST      LORA_RST
#define CFG_LORA_PIN_A        LORA_IRQ
#ifdef USE_RADIOLIB
#define CFG_LORA_PIN_B        14
#else
#define CFG_LORA_PIN_B        LORA_IRQ
#endif
#define CFG_LORA_PIN_RXEN     32           // (sx127x - unused, sx126x - RXEN pin number)
#define CFG_LORA_PIN_TXEN     33           // (sx127x - unused, sx126x - TXEN pin number)

#ifdef USE_SX126X
#define CFG_LORA_USE_ISR      false
#define CFG_LORA_USE_CAD      false
#else
#define CFG_LORA_USE_ISR      true
#define CFG_LORA_USE_CAD      true

#endif
GabeHC commented 2 years ago

Still not receiving. I have no problem with SX126x_Receive_Interrupt example.

// comment out for arduino-Lora usage
#define USE_RADIOLIB

// Uncomment for SX126X module usage
#define USE_SX126X

// Check your module name at https://github.com/jgromes/RadioLib/wiki/Modules
#ifdef USE_SX126X
#define MODULE_NAME   SX1268
#else
#define MODULE_NAME   SX1278
#endif

// generic options
#define LED_TOGGLE_PERIOD     1000
#define SERIAL_BAUD_RATE      115200
#define CFG_LOG_LEVEL         DebugLogLevel::LVL_INFO

// change pinouts if not defined through native board LORA_* definitions
#ifndef LORA_RST
#pragma message("LoRa pin definitions are not found, redefining...")
#define LORA_RST              14
#define LORA_IRQ              33
#endif

// redefine LED if not defined in Arduino to have module heartbeat indication
#ifdef BUILTIN_LED
#undef BUILTIN_LED
#endif
#pragma message("BUILTIN_LED defining as 12")
#define BUILTIN_LED           12

// select between client mode and APRS-IS gate mode
#define CFG_IS_CLIENT_MODE    false       // false - server mode (APRS-IS gate mode)

// lora generic pinouts
#define CFG_LORA_PIN_SS       SS
#define CFG_LORA_PIN_RST      LORA_RST
#define CFG_LORA_PIN_A        LORA_IRQ    // (sx127x - dio0, sx126x/sx128x - dio1)
#define CFG_LORA_PIN_B        39          // (sx127x - dio1, sx126x/sx128x - busy)

// lora pinouts, SX126X RXEN/TXEN usage
#ifdef USE_SX126X
#define CFG_LORA_PIN_RXEN     2           // (sx127x - unused, sx126x - RXEN pin number)
#define CFG_LORA_PIN_TXEN     4           // (sx127x - unused, sx126x - TXEN pin number)
#endif

// CAD and ISR usage selection
#ifdef USE_SX126X
#define CFG_LORA_USE_ISR      false       // reading in ISR does not work on sx126x
#define CFG_LORA_USE_CAD      true        // do not transmit if channel is busy
#else
#define CFG_LORA_USE_ISR      true        // true - read incoming data in ISR, false - do not read in ISR
#define CFG_LORA_USE_CAD      true        // set to true to utilize carrier detection
#endif
sh123 commented 2 years ago

IRQ pin is responsible for interrupt, maybe you have LORA_RST defined in arduino so it is not getting defined, try to set explicitly

#define CFG_LORA_PIN_RST    14
#define CFG_LORA_PIN_A         33 
#define CFG_LORA_PIN_B         39  

otherwise I do not know what's the problem, this module works fine for me with esp32 devboard

GabeHC commented 2 years ago

That is not it. I saw "LoRa pin definitions are not found, redefining..." during compile.

// lora generic pinouts
#define CFG_LORA_PIN_SS       5
#define CFG_LORA_PIN_RST      14
#define CFG_LORA_PIN_A        33          // (sx127x - dio0, sx126x/sx128x - dio1)
#define CFG_LORA_PIN_B        39          // (sx127x - dio1, sx126x/sx128x - busy)

also not working!

[INFO] printConfig : Current mode: APRS-IS iGate
[INFO] printConfig : Built with RadioLib library
[INFO] printConfig : Using TNC KISS and AX.25 mode
[INFO] printConfig : UsbSerialEnable: no
[INFO] printConfig : EnableSignalReport: yes
[INFO] printConfig : EnablePersistentAprsConnection: yes
[INFO] printConfig : EnableRfToIs: yes
[INFO] printConfig : EnableIsToRf: no
[INFO] printConfig : EnableRepeater: no
[INFO] printConfig : EnableBeacon: yes
[INFO] setupLora : Initializing LoRa
[INFO] setupLora : Frequency: 438200000 Hz
[INFO] setupLora : Bandwidth: 125000 Hz
[INFO] setupLora : Spreading: 12
[INFO] setupLora : Coding rate: 8
[INFO] setupLora : Power: 22 dBm
[INFO] setupLora : Sync: 0x34
[INFO] setupLora : CRC: enabled
[INFO] setupLora : Using SX126X module
[INFO] setupLora : LoRa initialized
[INFO] setup : Reading data on separate task
[INFO] setupWifi : WIFI connecting to GabeAP
[INFO] processIncomingDataTask : Incoming data process task started
[WARN] setupWifi : WIFI retrying 0
[WARN] setupWifi : WIFI retrying 1
[WARN] setupWifi : WIFI retrying 2
[WARN] setupWifi : WIFI retrying 3
[WARN] setupWifi : WIFI retrying 4
[INFO] setupWifi : WIFI connected to GabeAP
[INFO] setupWifi : IP address: 10.0.0.152
[INFO] setupBt : BT init loraprs
[INFO] setupBt : BT initialized
[INFO] reconnectAprsis : APRSIS connecting to rotate.aprs2.net
[INFO] reconnectAprsis : APRSIS connected
[INFO] reconnectAprsis : APRSIS logged in
[INFO] sendPeriodicBeacon : Periodic beacon is sent
[INFO] onAprsisDataAvailable : # aprsc 2.1.10-gd72a17c
[INFO] onAprsisDataAvailable : # logresp BV5DJ-10 verified, server T2STRAS
[INFO] onAprsisDataAvailable : # aprsc 2.1.10-gd72a17c 22 Nov 2021 07:43:49 GMT T2STRAS 51.210.15.145:14580
[INFO] onAprsisDataAvailable : # aprsc 2.1.10-gd72a17c 22 Nov 2021 07:44:10 GMT T2STRAS 51.210.15.145:14580
[INFO] onAprsisDataAvailable : # aprsc 2.1.10-gd72a17c 22 Nov 2021 07:44:30 GMT T2STRAS 51.210.15.145:14580
[INFO] onAprsisDataAvailable : # aprsc 2.1.10-gd72a17c 22 Nov 2021 07:44:50 GMT T2STRAS 51.210.15.145:14580
[INFO] onAprsisDataAvai

27680

sh123 commented 2 years ago

You cannot set power level to 22 dBm for this module, it sets amplification for sx1268 controller only without amp, amplification must be set to no more than 30 (all gain) dBm - 12 dBm (amplifier) = 18 dBm, I was testing with 2dBm (+ 12 dBm amp) = +14 dBm, https://github.com/jgromes/RadioLib/wiki/High-power-Radio-Modules-Guide

GabeHC commented 2 years ago

You cannot set power level to 22 dBm for this module, it sets amplification for sx1268 controller only without amp, amplification must be set to no more than 30 (all gain) dBm - 12 dBm (amplifier) = 18 dBm, I was testing with 2dBm (+ 12 dBm amp) = +14 dBm.

the problem is not receiving! I have no problem transmitting on power setting to 22 and measured power output at 1 watt

sh123 commented 2 years ago

Sorry, I cannot help if this problem is not reproducible for me, it works fine for me from RA-01 to E22, maybe try different ESP module. If it works with RadioLib example then maybe WiFi/Bluetooth initialization causes trouble.

[INFO] printConfig : Current mode: APRS-IS iGate
[INFO] printConfig : Built with RadioLib library
[INFO] printConfig : Using TNC KISS and AX.25 mode
[INFO] printConfig : UsbSerialEnable: no
[INFO] printConfig : EnableSignalReport: yes
[INFO] printConfig : EnablePersistentAprsConnection: yes
[INFO] printConfig : EnableRfToIs: yes
[INFO] printConfig : EnableIsToRf: no
[INFO] printConfig : EnableRepeater: no
[INFO] printConfig : EnableBeacon: no
[INFO] setupLora : Initializing LoRa
[INFO] setupLora : Frequency: 433750000 Hz
[INFO] setupLora : Bandwidth: 31250 Hz
[INFO] setupLora : Spreading: 10
[INFO] setupLora : Coding rate: 6
[INFO] setupLora : Power: 2 dBm
[INFO] setupLora : Sync: 0x34
[INFO] setupLora : CRC: enabled
[INFO] setupLora : Using SX126X module
[INFO] setupLora : LoRa initialized
[INFO] setup : Reading data on separate task
[INFO] setupWifi : WIFI connecting to homenet
[INFO] processIncomingDataTask : Incoming data process task started
[WARN] setupWifi : WIFI retrying 0
[WARN] setupWifi : WIFI retrying 1
[WARN] setupWifi : WIFI retrying 2
[WARN] setupWifi : WIFI retrying 3
[WARN] setupWifi : WIFI retrying 4
[INFO] setupWifi : WIFI connected to homenet
[INFO] setupWifi : IP address: 192.168.0.4
[INFO] setupBt : BT init loraprs_server
[INFO] setupBt : BT initialized
[INFO] reconnectAprsis : APRSIS connecting to rotate.aprs2.net
[INFO] reconnectAprsis : APRSIS connected
[INFO] reconnectAprsis : APRSIS logged in
[INFO] onAprsisDataAvailable : # aprsc 2.1.8-gf8824e8
.. cut
[INFO] processIncomingRawPacketAsServer : NOCALL-7>APDR15,WIDE2-2:=0000.00N/00000.00Eb
[INFO] processIncomingRawPacketAsServer : Packet sent to APRS-IS
... cut
[INFO] onAprsisDataAvailable : # aprsc 2.1.10-gd72a17c 22 Nov 2021 07:44:50 GMT T2STRAS 51.210.15.145:14580
[INFO] onAprsisDataAvai

Is this last line a hang? Looks like module just freezes if it cuts the log line. Try to build in client mode without WiFi initialization and receive packets with APRSDroid over Bluetooth, use latest ESP Arduino library, try to swap with different ESP32 dev board, enable "Core Debug Level" to "Verbose" in Arduino ESP options.

GabeHC commented 2 years ago

that is incomplete copy and paste. it kept running but not hearing anything from TTGO tracker.

this is how I setup on "SX126x_Receive_Interrupt" and it works.

SX1268 radio = new Module(5, 33, 14, 39);

and in setup

  radio.begin(438.2, 125.0, 12, 8, SX126X_SYNC_WORD_PRIVATE, 22, 32, 1.8, false);
  radio.setRegulatorDCDC(); 
  radio.autoLDRO();
  radio.setCurrentLimit(140);
  radio.setDio2AsRfSwitch(false);
  radio.explicitHeader();
  radio.setCRC(2);
  radio.setRfSwitchPins(2, 4);
  // set the function that will be called
  // when new packet is received
  radio.setDio1Action(setFlag);
  // start listening for LoRa packets0
  Serial.print(F("LORA Starting to listen ... "));

this is what I got from TTGO tracker

[SX1268] Received packet!
Got 1 Packages
<�BX4ACP-7>APLO02,WIDE1-1:!0000.00N/00000.00E[Lora Tracker Batt=4.09V
package length= 70/70 
[SX1268] RSSI:  0.00 dBm
[SX1268] SNR:   6.25 dB

Do you spot anything?

sh123 commented 2 years ago
  radio.setCRC(2);

They need to match between devices. Currently, I'm using setCRC(true) ( = 1) also I don't set explicit header mode, I think it should be default, but I can add this call and move some parameters to config so they can be specified.

also sync word is different RADIOLIB_SX126X_SYNC_WORD_PRIVATE is 0x12, but it is set to 0x34, which is RADIOLIB_SX126X_SYNC_WORD_PUBLIC

with current parameters it is not going to work need to change them, next parameters need to match:

I'll update code, so they can be specified from config.

sh123 commented 2 years ago

added config.h parameters for these values

GabeHC commented 2 years ago

added config.h parameters for these values

Great, it is working now, Sync word is the problem. Thank you so much for the help.

it works for our tracker now, TTGO tracker has a non AX.25 payload warning. Do you know why?

image

sh123 commented 2 years ago

Good news! I'll change default sample value to 0x12 as it seems to be more correct. 0x34 is used for LoRaWAN networks.

This warning indicates that incoming packet could not be parsed. To be able to process incoming non AX.25 text packets need to set CFG_TEXT_PACKETS to true. Unfortunately, it won't be able to work correctly with both AX.25 and text packets. It can gate both formats, but only one format is supported for transmission, such as digirepeating and IS to RF gating.

AX25 is much more efficient especially with compressed packets than text packets, but other projects do not use AX25 for some reason with AX25 it is possible to use full stack of Linux AX.25 tools.

If you are already using text mode, but it fails for some packets then enable verbose logging, in this case it will print packets char by char, maybe some formats could not be parsed, I did not spend much time on text packet testing as I do not have TTGO tracker and was testing only with APRSDroid text packets.

GabeHC commented 2 years ago

Polling mode works fine, for interrupt to work, ISR should only set flags, then process incoming data in the main loop.

could you email me your contact information? I would like to provide one of our hardware for you to test with.

sh123 commented 2 years ago

Yes, when setting CFG_LORA_USE_ISR to false it will spawn separate ESP task for flag polling, which is set in ISR. Unfortunately, it is sub-optimal for battery powered applications and there is a risk of data loss if polling task blocks for longer period of time. Reading data in ISR works in RA-01 module, but not with E22 module. I talked to RadioLib maintainer about possibility to read and queue data in ISR, but he said that there is no guarantee for all boards and ESP32 flavors. I would like to read and queue data immediately when ISR handles and then process this queue in main or secondary task. Another approach is not to use flag, but use events instead so that polling is not needed.

For me it is easier if you will post verbose packet output from the board, hardware delivery will take weeks and I have to fill form and pay to customs.

sh123 commented 2 years ago

I'm closing it for now, as this problem seems to be solved, please, open another task for other issues.