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
Multiple nodes failing on ESP32 resolved and FHSS Turned off #8
Comments
Do you mind share you whole script here? |
from machine import Pin, SPI #LoRa Pinout #LoRa2 Pinout LoRa_id = 1 payload = str(random.randint(100,65536))+ "I am Sharath 1" LoRa_id2 = 2 payload2 = str(random.randint(100,65536))+" I am Sharath 2" |
A simple question, may I have your MCU’s pin out map or the eBay/aliexpress
link you bought the MCU? meanwhile I am going to try your code on my setups
tonight.
…On Wed, Feb 1, 2023 at 1:26 AM SharathChandan ***@***.***> wrote:
from machine import Pin, SPI
import time, urandom as random
from lora import SX1276
#LoRa Pinout
RST_Pin1 = 26
CS_Pin1 = 5
SCK_Pin1 = 18
MOSI_Pin1 = 23
MISO_Pin1 = 19
DIO0_Pin1 = 2
DIO1_Pin1 = 35
SPI_CH = 1
#LoRa2 Pinout
RST_Pin2 = 27
CS_Pin2 = 15
SCK_Pin2 = 14
MOSI_Pin2 = 13
MISO_Pin2 = 12
DIO0_Pin2 = 0
DIO1_Pin2 = 34
SPI_CH2 = 2
LoRa_id = 1
random.seed(11)
channels2Hopping = [866_000_000+200_000 * random.randint(0,10) for i in
range(128)] # 914~916 MHz
lora = SX1276(RST_Pin1, CS_Pin1, SPI_CH, SCK_Pin1, MOSI_Pin1, MISO_Pin1,
DIO0_Pin1, DIO1_Pin1, LoRa_id, channels2Hopping)
payload = str(random.randint(100,65536))+ "I am Sharath 1"
print(payload)
lora.send(dst_id=3, msg=payload, pkt_type=lora.PKT_TYPE['REQ']) # Sender's
lora_id is 1 and receiver's is 0
LoRa_id2 = 2
random.seed(11)
channels2Hopping2 = [866_000_000+200_000 * random.randint(0,10) for i in
range(128)] # 914~916 MHz
lora2 = SX1276(RST_Pin2, CS_Pin2, SPI_CH2, SCK_Pin2, MOSI_Pin2, MISO_Pin2,
DIO0_Pin2, DIO1_Pin2, LoRa_id2, channels2Hopping2)
payload2 = str(random.randint(100,65536))+" I am Sharath 2"
print(payload2)
lora2.send(dst_id=4, msg=payload2, pkt_type=lora2.PKT_TYPE['REQ']) #
Sender's lora_id is 1 and receiver's is 0
—
Reply to this email directly, view it on GitHub
<https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_xg590_SX1276_issues_8-23issuecomment-2D1411530912&d=DwMCaQ&c=slrrB7dE8n7gBJbeO0g-IQ&r=68-jaezqLTx9tGFv4ExwCQ&m=EaPgsd3KkiiqvBdzIrYFChwnpgGuv_dYa_v6Uz88Qe9vnNeFxI22xuCVSwBpe7j3&s=juVUrVJ5MYp_W9r8rc_c62n0DZqvj0e_5WljaaoiLNo&e=>,
or unsubscribe
<https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_notifications_unsubscribe-2Dauth_AKJHY6HMMJLGVX75I6SCUZDWVH6YRANCNFSM6AAAAAAUNJKP5U&d=DwMCaQ&c=slrrB7dE8n7gBJbeO0g-IQ&r=68-jaezqLTx9tGFv4ExwCQ&m=EaPgsd3KkiiqvBdzIrYFChwnpgGuv_dYa_v6Uz88Qe9vnNeFxI22xuCVSwBpe7j3&s=6Y7rxsBf6FM1tlJ9FKaq9j5zwc9Tp6yAuIEix10_TnM&e=>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
good evening! have you tried the script on your setups? |
Hi, I got hardware problem to setup my development environment. I ordered a new RAM moments ago. Will try it tomorrow night. Sorry for the delay. |
It's fine. do it at your convenience. I have a doubt regarding the library. For class SX1276 can i remove a few arguments such as the DIO0 or DIO1 since i can accommodate more hardware on my MCU? kindly help in this regard. |
TLDR: you should not. Long explain. DIO0 and DIO1 are for interrupt. For example, how do your MCU knows SX1276 has sent out the REQ message so it should start listening for ACK packet? The SX1276 will interrupt MCU via DIO0 and DIO1 so MCU runs “interrupt service routine” to set off the Tx->Rx transition. |
Thanks. I will look into the library in detail. |
I made many comments about the interrupt at Section 4 of the library. _irq_handler (interrupt service routine) is also worthy of digging in. |
what is the significance of the RST_Pin in the scheme? kindly explain |
For example, during the code development, you may change the SX1276 class and need to re-instantiate this class (kill micropython script and re-run it). You use rst_pin to reset SX1276 chip at every time. If you can physically change the pin connection, you can repurpose the pin after SX1276 initiation. It is highly unlikely you want to mess with RST_PIN. |
Cannot run the second sx1276 because the software SPI is not working. Will try it later or use another MCU to test. |
Sure. kindly let me know once you are able to run it. |
is it possible to drive two spi devices simultaneously without multithreading in micropython? |
To the best of my knowledge, the short answer is yes. Each device would
interrupt the MCU if something happened (RxDone or TxDone or
FHSSchangeChannel) independently. Then the MCU will try to finish ISR as
soon as possible before the running of the main thread resumes.
I believe it can print out a received message via one SX1276 while it is
sending out a message through another SX1276. You cannot send two messages
via two interfaces simultaneously for obvious reasons.
…On Mon, Feb 6, 2023 at 4:05 AM SharathChandan ***@***.***> wrote:
is it possible to drive two spi devices simultaneously without
multithreading in micropython?
—
Reply to this email directly, view it on GitHub
<https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_xg590_SX1276_issues_8-23issuecomment-2D1418738324&d=DwMCaQ&c=slrrB7dE8n7gBJbeO0g-IQ&r=68-jaezqLTx9tGFv4ExwCQ&m=HmIKCiqt7vxz31MJggzXEJbLEUE3tZ8ZKHBaWEL6LCr0uK86enbdoQjFePQ6b0k1&s=Jp0OwjlQ7nhmqKCE6mgAhwJkVHVeonIQEtlr_PKs71o&e=>,
or unsubscribe
<https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_notifications_unsubscribe-2Dauth_AKJHY6GCC2CACDF2XEMQ46DWWC5GDANCNFSM6AAAAAAUNJKP5U&d=DwMCaQ&c=slrrB7dE8n7gBJbeO0g-IQ&r=68-jaezqLTx9tGFv4ExwCQ&m=HmIKCiqt7vxz31MJggzXEJbLEUE3tZ8ZKHBaWEL6LCr0uK86enbdoQjFePQ6b0k1&s=eLcekI0auCg9IkSBUGHO_6qFrgrAV68X_b8ryJDd1M4&e=>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
then will multi-threading using micropython achieve simultaneous transmission in the context of the above script? |
i mean sending without ack simultaneously |
|
Your coding is not for "simultaneous transmission", it is for sequential Tx. You send out one message via one SX1276 chip and send out another message via another SX1276 chip. I assume two chips working on difference frequencies. |
At this point, I suggest you to use Pico as the MCU to operate two SX1276 chips at the same time. You can find that two SPI interfaces are clearly marked on the pinout map of Pico. |
Great. It has cleared me all of my doubts. But i don't require frequency hopping can i let go FHSS and set a single frequency say 866.40 for a pair of transceivers and do simultaneous transmission on my SX1276. btw thank you once again for your efforts. |
Yeah but it works fine on my esp32s devkit and i will try it on Pico after a while. Please let me know if its possible to use specific frequencies on my LoRa. |
OK, I will update the library so that SX1276 will stay on one freq forever. |
Done. FHSS can be turned off by only specifying one Freq.
BTW, can you elaborate on "it works fine on my esp32s devkit"? Does two SX1276 chips works on your single esp32s? If so, may I have your pin mapping? I mean this is my pin mapping. What is yours?
|
Thank you for updating the library. I'll let you know after trying it on my setup. |
Yeah two SX1276 are working well now. I have figured out the hspi and vspi of my esp32 and it usually differs with different esp32 boards. |
,Hello! Can you elaborate on the coding rates you have adopted in the library..is the CR 5,6,7 and 8 correspond to 4/5, 4/6, 4/7 and 4/8 in LoRa or have you used a different way. is it possible to send data with lesser cr. is it possible to code it in my program or should i modify the library each time. |
Your guess is correct. In addition, you can choose any configuration (CR, SF, Freq) but there are [state] regulation or regional norms you better to follow. For example, you can ask the same chip to run on 433MHz in US or 915MHz in Europe but it is illegal. I mean, really, your 868MHz chip can run at 100MHz but the output signal is much weaker (even you use 100MHz antenna). Any configuration is possible. |
Great. I am planning to experiment different modulation on LoRa. while doing that the coding rate can be replaced with that of the respective modulation right. I just want to try out some stuff on LoRa. |
Can you let know how can i modify the spreading factor in my code itself? |
If you got another new problem, please reopen the issue or open a new one. I just noticed your question. Yes, it is very easy to choose another value for those radio parameters. Please refer to lines 101 ~ 106 of lora.py. For example, you can change both CR from 4/5 to 4/7 and bandwidth from 125KHz to 500kHz by modifying line 104 of https://github.com/xg590/SX1276/blob/8a0d7c4dda34454a5fadb04330c810e2b1990308/lora.py. From
to
|
sure i'll continue this on a new issue. |
I have connected multiple nodes to the ESP32 and Lora isn't getting initialized. The interfaces are working fine.
The text was updated successfully, but these errors were encountered: