SX1262 LoRa Node with Portenta H7

Hi there,

Has anyone managed to get a LoRa SX1262 node to work with the Arduino Portenta H7? I have tried numerous code examples and I just cant get it to initialise...

Should be easy enough, the LoRa devices are SPI based and fairly standard pin connections.

Could be a problem with your code or connections, so maybe post your code and a schematic of the connections ?

Which LoRa module are you using ?

It's an SX1262 HF module. I'll post a schematic of the connections in my next reply. Basically got the connections as follows:

NSS connected to CS (D7)
MOSI connected to COPI (D8)
CLK connected to CK (D9)
MISO connected to CIPO (D10)
3v3 connected to 3v3
Gnd connected to Gnd
RST connected to D5
D1O0 connected to D5

I have tried to run example code with the inclusion of LoRa.h and SPI.h from the respective libraries. Example of which:

#include <SPI.h>
#include <LoRa.h>

#define NSS 7
#define RST 5
#define DIO0 6
#define BAND 868E6 // Adjust to your region's frequency (e.g., 868E6 for EU)

void setup() {
Serial.begin(115200);
while (!Serial);

Serial.println("LoRa Transmitter");

// Initialize LoRa
LoRa.setPins(NSS, RST, DIO0);

if (!LoRa.begin(BAND)) {
Serial.println("Starting LoRa failed!");
while (1);
}

Serial.println("LoRa initialization successful");
}

void loop() {
Serial.println("Sending packet...");

LoRa.beginPacket();
LoRa.print("Hello from Portenta H7");
LoRa.endPacket();

Serial.println("Packet sent!");

delay(5000); // Wait 5 seconds before sending the next packet
}

I have tried a few other libraries and other code examples but no luck so far.

I don't know if that LoRa library supports the SX1262. I was going to try the RadioLib library but at first glance, looked a bit more advanced/involved

The LoRa library you are using is probably the one that is for SX127X LoRa devices only.

A SX1262 does not have a DIO0 pin.
A SX1262 has a BUSY pin which needs to be connected.

The RadioLib library does support SX126X or try this one;

In addition to the errors mentioned above, assigning two different functions to the same pin is usually a bad idea.

1 Like

Here is a photo of the wiring. Not sure if I am making it more confusing by adding the pink arrows.

Apologies on the reset and D1O1 pins, I was looking at the PWM numbering. These two connections are in fact on D0 and D1.

So from your reply @srnet , I should change the D1O1 wire onto the BUSY pin?

Any other errors you can see from the wiring? I was meant to check the continuity of each with a multimeter, but I haven't got around to it... just to rule out its not a dodgy connection from my rather poor soldering skills.

I'll see if I can try the SX12XX-LoRa library once I have confirmation on the wiring.

also check for short circuits between adjacent pins and make sure you connect an antenna
I assume you have two LoRa SX1262 modules
after loading the SX12XXLT_LoRa_library library try
File>Examples>SX12XXLT_LoRa_library>SX126x_examples>Basics>3_LoRa_Transmitter
File>Examples>SX12XXLT_LoRa_library>SX126x_examples>Basics>4_LoRa_Receiver

For an SX126X you need to connect DIO1 and BUSY to separate GPIO pins.

Your SX126X module also has TXEN (TXENABLE) and RXEN (RXENABLE) pins, not all S126X modules have these pins. You need to check the datasheet for your module to see if they need to be connected.