nopnop2002 / esp-idf-sx126x

SX1262/SX1268/LLCC68 Low Power Long Range Transceiver driver for esp-idf
MIT License
82 stars 18 forks source link

RA01S: WaitForIdle Timeout timeout=5000 #23

Closed pluzmedia closed 4 months ago

pluzmedia commented 4 months ago

Hi,

Encountered the "RA01S: WaitForIdle Timeout timeout=5000" error randomly during operation. How to restart it?

Thanks

nopnop2002 commented 4 months ago

Please check if your wiring is correct.

If it occurs with a code other than the sample code I provided, there is a problem with your usage.

If it occurs with a code I provided, please share all logging.

pluzmedia commented 4 months ago

The problem appears randomly and i have checked the wring and there was no conflict.

nopnop2002 commented 4 months ago

If it occurs with a code I provided, please share all your logging.

If it happens in your own code, I don't know what's wrong. You're probably using it incorrectly.

pluzmedia commented 4 months ago

Will it cause issues when sending and receiving data every 50 milliseconds?

nopnop2002 commented 4 months ago

A problem may occur with the single-core ESP32-C series. This is a multitasking constraint.

In the ESP-IDF environment, many tasks run in parallel in the background. The main task is only one of them. You need to understand CPU dispatch in a multitasking environment.

pluzmedia commented 4 months ago

I am using a dual-core series, and apart from the error message E (68985) RA01S: WaitForIdle Timeout timeout=10000, no logs were printed.

nopnop2002 commented 4 months ago

The main task may not have core execution privileges assigned for a long time.

pluzmedia commented 4 months ago

Are there any workarounds for cases like restarting or resetting the LoRa module or something similar?

nopnop2002 commented 4 months ago

There is no reset function for the LoRa module only.

ESP-IDF has an API for esp_restart, but even if you restart or reset, the problem will not be resolved.

Tasks that using SX126X may not have core execution privileges assigned for a long time, and this needs to be resolved.

pluzmedia commented 4 months ago

Tasks (using SX126X) may not have core execution privileges assigned for a long time, and this needs to be resolved. throwing some light would be helpful.

nopnop2002 commented 4 months ago

throwing some light would be helpful.

I can't understand your English.

pluzmedia commented 4 months ago

Any ideas on how to resolve the issue you mentioned earlier would be helpful.

nopnop2002 commented 4 months ago

for example....

Check the priority of each task. Find out how much time each task is consuming. Find out how much idle time a CPU core has.

pluzmedia commented 4 months ago

Thanks, I will look into it.

nopnop2002 commented 4 months ago

Note that in ESP-IDF each task occupies at least 10ms of CPU. This cannot be shortened.

Please also note that ESP-IDF has many background tasks running. Each background task occupies at least 10ms of CPU time.

Will it cause issues when sending and receiving data every 50 milliseconds?

This is a very strict condition in the ESP-IDF environment.

pluzmedia commented 4 months ago

I increased the delay of other tasks; let's see how it works. It's a complicated project. Thank you for your valuable insight.

nopnop2002 commented 4 months ago

Since ESP-IDF is a multitasking environment, it is necessary to pay attention to the CPU occupation time and priority of each task, which may affect operation.

I wish you good luck.

pluzmedia commented 4 months ago

I removed the WaitForIdleTimeout, and it works fine. Thanks for your timely support. I also have one more question: What does a bandwidth of 4 mean? Which kHz does it correspond to?

nopnop2002 commented 4 months ago

What does a bandwidth of 4 mean?

Everything is in the datasheet.

This is the data sheet for SX127X, but SF, BW, and CR are common to LoRa.

https://github.com/jgromes/RadioLib/files/8646997/DS_SX1276-7-8-9_W_APP_V7.pdf

lora

pluzmedia commented 4 months ago

Thank you, Will txPowerInDbm has any impact on range? I changed the value from 1 to 22 but it has zero impact on range.

nopnop2002 commented 4 months ago

txPowerInDbm() updates register 0x8E. Please check the data sheet of the module you are using to determine the operation of this register.

pluzmedia commented 4 months ago

Thanks to your support, I was able to achieve my goal. Initially, using SF7, I obtained a range of 200 meters in an urban area, which was disappointing. I decided to increase the TX power, but it had no impact. After increasing the SF to 11, I achieved a range of 700 meters in an urban area densely surrounded by buildings. However, the problem with SF11 is the restriction on sending data in a single packet. To overcome this, I chunked the data into smaller bytes and transmitted them to the receiver side. At the receiver side, the data is reassembled and decrypted to obtain the complete data, which I was previously sending using SF7. The only tradeoff between SF7 and SF11 is the airtime, which is about one second. This setup works well for communication with five nodes. Thank you for your kind and timely support in helping me achieve this. Without your assistance, it would have been very difficult to complete on time.

nopnop2002 commented 4 months ago

In LoRa modulation mode, the communication speed (bps) and maximum reception sensitivity (RSSI) are determined by a combination of spreading factor (SF), bandwidth (BW), and coding rate (CDR).