Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error (RA01S: SetRx Illegal Status) while using RA01S library for Heltec LoRa V3 #20

Open
Surbhidk opened this issue Jul 24, 2023 · 22 comments

Comments

@Surbhidk
Copy link

Hello ,
I am also facing same issue regarding SX1262 lora library.
I am using Heltec Wi-Fi esp32 Lora V3 .
For IDE I am using : VS-code ESP IDF Extension
Here is my logs
I (280) cpu_start: Starting scheduler on PRO CPU.
I (0) cpu_start: Starting scheduler on APP CPU.
I (300) RA01S: CONFIG_MISO_GPIO=11
I (300) RA01S: CONFIG_MOSI_GPIO=10
I (300) RA01S: CONFIG_SCLK_GPIO=9
I (310) RA01S: CONFIG_NSS_GPIO=8
I (310) RA01S: CONFIG_RST_GPIO=12
I (320) RA01S: CONFIG_BUSY_GPIO=13
I (320) RA01S: CONFIG_TXEN_GPIO=-1
I (320) RA01S: CONFIG_RXEN_GPIO=-1
I (330) gpio: GPIO[8]| InputEn: 0| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0
I (340) gpio: GPIO[12]| InputEn: 0| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0
I (350) gpio: GPIO[13]| InputEn: 0| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0
I (360) RA01S: spi_bus_initialize=0
I (360) RA01S: spi_bus_add_device=0
I (400) RA01S: Reset
I (400) RA01S: ReadRegister: REG=0x740
I (400) RA01S: DataIn:14
I (400) RA01S: DataIn:24
I (410) RA01S: syncWord=0x1424
I (410) RA01S: SX126x installed
I (410) RA01S: WriteCommand: CMD=0x80
I (420) RA01S: 00 --> aa
W (420) RA01S: WriteCommand2 status=0a retry=1
I (430) RA01S: WriteCommand: CMD=0x80
I (430) RA01S: 00 --> a2
I (430) RA01S: WriteCommand: CMD=0x9d
I (440) RA01S: 01 --> a2
I (440) RA01S: tcxoVoltage=0.000000
I (450) RA01S: WriteCommand: CMD=0x89
I (450) RA01S: 7f --> a2
I (450) RA01S: useRegulatorLDO=0
I (460) RA01S: WriteCommand: CMD=0x96
I (460) RA01S: 01 --> aa
W (460) RA01S: WriteCommand2 status=0a retry=1
I (470) RA01S: WriteCommand: CMD=0x96
I (470) RA01S: 01 --> a2
I (480) RA01S: WriteCommand: CMD=0x8f
I (480) RA01S: 00 --> a2
I (490) RA01S: 00 --> a2
I (490) RA01S: WriteCommand: CMD=0x95
I (490) RA01S: 04 --> a2
I (500) RA01S: 07 --> a2
I (500) RA01S: 00 --> a2
I (500) RA01S: 01 --> a2
I (510) RA01S: WriteRegister: REG=0x8e7
I (510) RA01S: 18 --> a2
I (510) RA01S: WriteCommand: CMD=0x8e
I (520) RA01S: 16 --> a2
I (520) RA01S: 04 --> a2
I (520) RA01S: WriteCommand: CMD=0x98
I (530) RA01S: a2 --> a2
I (530) RA01S: 00 --> a2
I (540) RA01S: WriteCommand: CMD=0x86
I (540) RA01S: 00 --> aa
W (540) RA01S: WriteCommand2 status=0a retry=1
I (550) RA01S: WriteCommand: CMD=0x86
I (550) RA01S: 00 --> a2
I (560) RA01S: 00 --> a2
I (560) RA01S: 00 --> a2
I (560) RA01S: 00 --> a2
I (560) MAIN: LoRaBegin=0
I (570) RA01S: SetStopRxTimerOnPreambleDetect enable=0
I (570) RA01S: WriteCommand: CMD=0x9f
I (580) RA01S: 00 --> a2
I (580) RA01S: WriteCommand: CMD=0xa0
I (590) RA01S: 00 --> a2
I (590) RA01S: WriteCommand: CMD=0x8a
I (590) RA01S: 01 --> a2
I (600) RA01S: WriteCommand: CMD=0x8b
I (600) RA01S: 07 --> a2
I (600) RA01S: 04 --> a2
I (610) RA01S: 01 --> a2
I (610) RA01S: 00 --> a2
I (610) RA01S: ReadRegister: REG=0x736
I (620) RA01S: DataIn:0d
I (620) RA01S: WriteRegister: REG=0x736
I (630) RA01S: 0d --> a2
I (630) RA01S: WriteCommand: CMD=0x8c
I (630) RA01S: 00 --> a2
I (640) RA01S: 08 --> a2
I (640) RA01S: 00 --> a2
I (640) RA01S: ff --> a2
I (650) RA01S: 01 --> a2
I (650) RA01S: 00 --> a2
I (650) RA01S: WriteCommand: CMD=0x08
I (660) RA01S: 03 --> a2
I (660) RA01S: ff --> a2
I (660) RA01S: 00 --> a2
I (670) RA01S: 00 --> a2
I (670) RA01S: 00 --> a2
I (670) RA01S: 00 --> a2
I (680) RA01S: 00 --> a2
I (680) RA01S: 00 --> a2
I (680) RA01S: ----- SetRx timeout=16777215
I (690) RA01S: WriteCommand: CMD=0x80
I (690) RA01S: 00 --> a2
I (700) RA01S: SetRxEnable:SX126x_TXEN=-1 SX126x_RXEN=-1
I (700) RA01S: WriteCommand: CMD=0x82
I (710) RA01S: ff --> a2
I (710) RA01S: ff --> a2
I (710) RA01S: ff --> a2
I (720) RA01S: ReadCommand: CMD=0xc0
I (720) RA01S: DataIn:2a
I (720) RA01S: ReadCommand: CMD=0xc0
I (730) RA01S: DataIn:2a
I (730) RA01S: ReadCommand: CMD=0xc0
I (730) RA01S: DataIn:2a
I (740) RA01S: ReadCommand: CMD=0xc0
I (740) RA01S: DataIn:2a
I (750) RA01S: ReadCommand: CMD=0xc0
I (750) RA01S: DataIn:2a
I (750) RA01S: ReadCommand: CMD=0xc0
I (760) RA01S: DataIn:2a
I (760) RA01S: ReadCommand: CMD=0xc0
I (760) RA01S: DataIn:2a
I (770) RA01S: ReadCommand: CMD=0xc0
I (770) RA01S: DataIn:2a
I (780) RA01S: ReadCommand: CMD=0xc0
I (780) RA01S: DataIn:2a
I (780) RA01S: ReadCommand: CMD=0xc0
I (790) RA01S: DataIn:2a
I (790) RA01S: ReadCommand: CMD=0xc0
I (790) RA01S: DataIn:2a
E (800) RA01S: SetRx Illegal Status
E (800) RA01S: LoRaErrorDefault=18

Please suggest me the possible solution

@Surbhidk Surbhidk changed the title Error (RA01S: SetRx Illegal Status) while using RA01S library using for Heltec LoRa V3 Error (RA01S: SetRx Illegal Status) while using RA01S library for Heltec LoRa V3 Jul 24, 2023
@nopnop2002
Copy link
Owner

nopnop2002 commented Jul 24, 2023

Option with SX1262/1268

LoRa modules with SX1262/1268 have several options.

  • Using TCXO(Temperature-Compensated Crystal Oscillator)
    SX1262/1268 can use the TCXO.
    If the TCXO is used, the XTB pin is not connected.
    However, the 6th pin (DIO3) of the SX1262/1268 can be used to power the TCXO.
    Explanation for TXCO and antenna control is here.
    Ra-01S / Ra-01SH does not use TCXO.

  • Power supply modes
    SX1262/1268 has two power supply modes.
    One is that only LDO used in all modes.
    Another is that DC_DC+LDO used for STBY_XOSC,FS, RX and TX modes.
    Explanation for LDO and DCDC selection is here.
    Ra-01S / Ra-01SH use only LDO in all modes.

  • RF-Switching
    In general, use DIO2 to switch the RF-Switch.
    However, some tranceiver use an external gpio to switch the RF-Switch.
    Ra-01S / Ra-01SH use the SC70-6 integrated load switch to switch between RFO and RFI.
    Ra-01S / Ra-01SH use DIO2 to control this.
    DIO2 = 1, CTRL = 0, RFC for SC70-6 goes to RF1 --> Switch to Tx Mode.
    DIO2 = 0, CTRL = 1, RFC for SC70-6 gose to RF2 --> Switch to Rx Mode.

You need to look at the schematic to set these options properly, but it's very esoteric.
The default settings for this library are for Ra-01S / Ra-01SH.
When using other than Ra-01S / Ra-01SH, you need to set them appropriately.

@Surbhidk
Copy link
Author

yeah.. got it . now its working for me
Changes i have done :-
Kconfig.projbuild:

config USE_TCXO
	bool "Enable TCXO"
	default false
	help
		Enable TCXO.
		
LoRaInit();
//int ret = LoRaBegin(915000000, 22, 0.0, false);
int8_t txPowerInDbm = 22;
float tcxoVoltage = 0.0; // don't use TCXO
bool useRegulatorLDO = false; // use only LDO in all modes

#if CONFIG_USE_TCXO // Use external tcxo at 3.3v alimentation.
tcxoVoltage = 3.3; // use TCXO
useRegulatorLDO = true; // use TCXO
#endif

//LoRaDebugPrint(true);
int ret = LoRaBegin(frequencyInHz, txPowerInDbm, tcxoVoltage, useRegulatorLDO);
ESP_LOGI(TAG, "LoRaBegin=%d", ret);			

@Surbhidk
Copy link
Author

Now, I have one more question: How do I create a mesh connection in this?

@nopnop2002
Copy link
Owner

nopnop2002 commented Jul 26, 2023

Unfortunately this library does not support meshes.

Your PR is welcome.

@Surbhidk
Copy link
Author

Surbhidk commented Jul 31, 2023

In lora chip SX1276 , it can receive multiple device data. Is there any changes to make for SX1262
library for SX1276 is https://github.com/nopnop2002/esp-idf-sx127x

My logs for SX1272 :
I (209458) task_tx: 11 byte packet sent...
Sent data=456!! 20910
Received Data :123!! 21322
Received Data :894 7768
I (211518) task_tx: 11 byte packet sent...
Sent data=456!! 21116
Received Data :123!! 21528
Received Data :894 7972
I (213578) task_tx: 11 byte packet sent...
Sent data=456!! 21322
Received Data :123!! 21734
Received Data :894 8176
I (215638) task_tx: 11 byte packet sent...
Sent data=456!! 21528
Received Data :123!! 21940
Received Data :894 8380

Could you please check the Lora receive function of both lora chip and inform me about the respective changes?

@nopnop2002
Copy link
Owner

I don't quite understand your problem.

@Surbhidk
Copy link
Author

I am using two LoRa chips, SX1276 and SX1262. In the SX1276 code, it can receive data from two devices simultaneously, as shown in the above logs. However, when I try the same with the SX1262, it only receives data from one device at a time.

@nopnop2002
Copy link
Owner

I will investigate.

@Surbhidk
Copy link
Author

Surbhidk commented Sep 5, 2023

Hello , Do you how to convert rssi to distance . Any formula?

@nopnop2002
Copy link
Owner

nopnop2002 commented Sep 5, 2023

@Surbhidk

rssi has nothing to do with distance.

RSSI changes depending on antenna performance, etc.

@Surbhidk
Copy link
Author

Surbhidk commented Sep 6, 2023

Then how to calculate distance between two lora device ? Can we do that ?

@nopnop2002
Copy link
Owner

nopnop2002 commented Sep 6, 2023

We can't.

@ABHITHLALC
Copy link

ABHITHLALC commented Jan 9, 2024

@nopnop2002 I'm facing the same issue trying to use this code with my SX1262 LoRa module, the Waveshare Core SX1262-868, and an ESP32 using the ESP-IDF framework. Can I use this library for my module? If yes, how can I adapt it? What should be the pin configuration? Any help would be greatly appreciated.

@nopnop2002
Copy link
Owner

nopnop2002 commented Jan 9, 2024

Can I use this library for my module?

I don't have Waveshare Core SX1262-868.
I'm not sure if this repository will work properly.

What should be the pin configuration?

Check the documentation provided by the manufacturer.

LoRa modules with SX1262/1268 have several options.

  • Using TCXO(Temperature-Compensated Crystal Oscillator)
    SX1262/1268 can use the TCXO.
    If the TCXO is used, the XTB pin is not connected.
    However, the 6th pin (DIO3) of the SX1262/1268 can be used to power the TCXO.
    Explanation for TXCO and antenna control is here.
    Ra-01S / Ra-01SH does not use TCXO.

  • Power supply modes
    SX1262/1268 has two power supply modes.
    One is that only LDO used in all modes.
    Another is that DC_DC+LDO used for STBY_XOSC,FS, RX and TX modes.
    Explanation for LDO and DCDC selection is here.
    Ra-01S / Ra-01SH use only LDO in all modes.

  • RF-Switching
    In general, use DIO2 to switch the RF-Switch.
    However, some tranceiver use an external gpio to switch the RF-Switch.
    Ra-01S / Ra-01SH use the SC70-6 integrated load switch to switch between RFO and RFI.
    Ra-01S / Ra-01SH use DIO2 to control this.
    DIO2 = 1, CTRL = 0, RFC for SC70-6 goes to RF1 --> Switch to Tx Mode.
    DIO2 = 0, CTRL = 1, RFC for SC70-6 gose to RF2 --> Switch to Rx Mode.

You need to look at the schematic to set these options properly, but it's very esoteric.

@ABHITHLALC
Copy link

Is this intended for point-to-point LoRa communication or communication between LoRa nodes and gateways? or both?

@nopnop2002
Copy link
Owner

nopnop2002 commented Jan 9, 2024

Both.

@ABHITHLALC
Copy link

Thank you for the clarification. Do you know what modifications needed to use this library for communicating the device to the gateway?

@nopnop2002
Copy link
Owner

Do you know what modifications needed to use this library for communicating the device to the gateway?

These act as gateways.

https://github.com/nopnop2002/esp-idf-sx126x/tree/main/http
https://github.com/nopnop2002/esp-idf-sx126x/tree/main/mqtt

@ABHITHLALC
Copy link

I apologize for any confusion. I was wondering if this is intended for the connection of LoRa devices to a LoRaWAN network server through LoRa gateway . Your clarification would be greatly appreciated. Thank you

@nopnop2002
Copy link
Owner

This repository does not support LoRaWAN.

@ABHITHLALC
Copy link

ABHITHLALC commented Jan 9, 2024 via email

@udayalawa
Copy link

i stumbled across same problem and idk why but by setting
lora.DebugPrint(true);
my errors were resolved and one more thing to mention use voltage level shifter (it might be a issue too)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants