jgromes / RadioLib

Universal wireless communication library for embedded devices
https://jgromes.github.io/RadioLib/
MIT License
1.58k stars 395 forks source link

complete wiring information for SPX1276 LoRa #1181

Closed alehvalelabs closed 3 months ago

alehvalelabs commented 3 months ago

I cannot find a sample wiring diagram for LoRa SPX1276 to correctly connect to a MEGA.

The sample sketch: SX127x_Transmit makes no mention of the SPI connections. Are these also required? if so does the SPI.h library also need to be added to the sample sketch.

This sketch also uses pin 0 which is the RX0 pin for UART0.

jgromes commented 3 months ago

I cannot find a sample wiring diagram for LoRa SPX1276 to correctly connect to a MEGA.

Then I would suggest proceeding in the following order:

  1. Finding out which communication interface the SX1276 has.
  2. Locating said interface on your board - Google is your friend here.
  3. Connecting them, keeping in mind that the logic voltage of your board and the SX1276 will likely be different. If you connect them without some level conversion, you may damage the SX1276.

The sample sketch: SX127x_Transmit makes no mention of the SPI connections. Are these also required?

Obviously so, the sketch does not mention them since on every microcontroller they will be at different pins, and sometimes even configurable. It seems pointless to state in every example "Make sure you have the SPI pins connected"; if you need such a note I would highly suggest to start with a simpler project.

if so does the SPI.h library also need to be added to the sample sketch.

No, it is added by RadioLib. Compilation of all example sketches is checked automatically on every release, which would have caught a missing library.

This sketch also uses pin 0 which is the RX0 pin for UART0.

Where?

alehvalelabs commented 3 months ago

Thanks for answering my questions.

I am using an Arduino MEGA. I am following the pin numbers that are quoted in the sample sketch:

// SX1276 requires the following connections:

int pin_cs = 41;

int pin_dio0 = 0; // was 0

int pin_nrst = 33;

int pin_dio1 = 34;

SX1276 radio = new Module(pin_cs, pin_dio0, pin_nrst, pin_dio1);

I used these pin numbers on the MEGA. This is where I used MEGA pin 0 to connect to SPX1276 di0. On the MEGA, pin0 is the UART0 RX.

With the information that you have provided, I will investigate more correct wiring details.

From: Jan Gromeš @.> Sent: Tuesday, August 6, 2024 2:56 PM To: jgromes/RadioLib @.> Cc: alehvalelabs @.>; Author @.> Subject: Re: [jgromes/RadioLib] complete wiring information for SPX1276 LoRa (Issue #1181)

I cannot find a sample wiring diagram for LoRa SPX1276 to correctly connect to a MEGA.

Then I would suggest proceeding in the following order:

  1. Finding out which communication interface the SX1276 has.
  2. Locating said interface on your board - Google is your friend here.
  3. Connecting them, keeping in mind that the logic voltage of your board and the SX1276 will likely be different. If you connect them without some level conversion, you may damage the SX1276.

The sample sketch: SX127x_Transmit makes no mention of the SPI connections. Are these also required?

Obviously so, the sketch does not mention them since on every microcontroller they will be at different pins, and sometimes even configurable. It seems pointless to state in every example "Make sure you have the SPI pins connected"; if you need such a note I would highly suggest to start with a simpler project.

if so does the SPI.h library also need to be added to the sample sketch.

No, it is added by RadioLib. Compilation of all example sketches is checked automatically on every release, which would have caught a missing library.

This sketch also uses pin 0 which is the RX0 pin for UART0.

Where?

— Reply to this email directly, view it on GitHub https://github.com/jgromes/RadioLib/issues/1181#issuecomment-2270381654 , or unsubscribe https://github.com/notifications/unsubscribe-auth/AOEZGFIYMDSMA7EBERCJNK3ZQBJMRAVCNFSM6AAAAABMBKBQWSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENZQGM4DCNRVGQ . You are receiving this because you authored the thread. https://github.com/notifications/beacon/AOEZGFIBBSNSD5WQE63NFBDZQBJMRA5CNFSM6AAAAABMBKBQWSWGG33NNVSW45C7OR4XAZNMJFZXG5LFINXW23LFNZ2KUY3PNVWWK3TUL5UWJTUHKNDFM.gif Message ID: @. @.> >

jgromes commented 3 months ago

This is where I used MEGA pin 0 to connect to SPX1276 di0

That will not work - it will interfere with your Serial port and also prevent you from using interrupt driven transmission and reception. Seems quite pointless on the Mega which has some 50 other digital pins, 6 of which support interrupts.

Since this is not actually an issue, I will convert this to a discussion instead.