Heltec V3 Lora.h

is it possible to use the lora.h library to send data using the new heltec V3.

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

#define SCK 18
#define MISO 11
#define MOSI 10
#define SS 14
#define RST 12
#define DIO0 14

#define BAND 915E6

//packet counter
int counter = 0;

void setup() {
//initialize Serial Monitor
Serial.begin(115200);

Serial.println(“LoRa Sender Test”);

//SPI LoRa pins
SPI.begin(SCK, MISO, MOSI, SS);
//setup LoRa transceiver module
LoRa.setPins(SS, RST, DIO0);

if (!LoRa.begin(BAND)) {
Serial.println(“Starting LoRa failed!”);
while (1);
}
Serial.println(“LoRa Initializing OK!”);

}
void loop() {

Serial.print("Sending packet: ");
Serial.println(counter);

//Send LoRa packet to receiver
LoRa.beginPacket();
LoRa.print("hello ");
LoRa.print(counter);
LoRa.endPacket();

counter++;

delay(10000);
}

I don’t think so—the sketch I used to use, which used the original LoRa library, compiles OK, but you’re told that “Starting LoRa failed!” when you try to execute it.

I reasoned that the previous libraries, like the Sandeep Mistry LoRa library, do not support the SX1262 LoRa Node chip on the new boards. On that basis, I switched to using the LoRaWan_APP library that I had been using for the Cubecell boards I had, which also use the SX1262. That uses the Radio library, which then requires a bit of rejigging of your sketch (see Examples > Heltec-Example > LoRaBasic). I had previously had to fiddle around a bit to sort out all the appropriate settings for the new library to get my CubeCell boards communicating with my WiFi LoRa V2 ‘gateway’, but I think that’s all pretty straightforward these days.

I originally used the LoRa_APP library to support MCUs with the SX1262, which I assumed was just a cut down version of the LoRaWan_APP library (I only use the LoRa bit, I don’t use LoRaWan) but, for some reason, that library no longer seems to be available. I don’t think this is a big deal though because, as I understand the compilation process, it only extracts the code it needs from a library in any case.

Thank Pete But could it be that I haven’t defined the pins correctly. Have I defined the correct Lora pins for the V3?

Well, I don’t think your pin definitions are correct for the V3 module, but I don’t think it would make any difference if they were. I did check my own pin definitions when I originally looked at this problem, and they work with the LoRaWan_APP library that I currently use:

#define CS			GPIO10
#define MOSI		GPIO11
#define MISO		GPIO13
#define SCK		    GPIO12
#define RST		    GPIO14
#define DIO0		GPIO26

I’m pretty sure, though, that you’ll find that the problem is that the LoRa library simply doesn’t support the SX1262 chip. While I have not seen any ‘official’ comment from Heltec on the subject, this has been explicitly stated to be the case with the Sandeep Mistry LoRa library.

Heltec V3 uses a newer LoRa module, old Libraries will not work, see my post for this and other issues solutions.

Just for the record, the pin definitions in my previous post, which are not the same as those posted by @macedo123, were taken from the Heltec 0.0.7 library WiFi_LoRa_32_V3/pins_arduino.h file. These pin definitions, however, are not consistent with the WiFi LoRa 32 V3 schematic diagram provided by Heltec, which shows the pin definitions precisely as @macedo123 has indicated.

Fortunately for me, the code I am using doesn’t actually use any ‘local’ pin definitions for the LoRa radio, the [Heltec] LoRaWan_APP radio library just uses default pin assignments (which must be correct, however they are assigned, because my code works). But working through the library code suggests that these default pin assignments are taken from the pins_arduino.h file (as per the assignments noted in my previous post above). Based on the present discussion, however, it’s difficult to see how this could be.

It has been previously noted (by Heltec) that the pins_arduino.h file is not ‘current’, but the current Github version has still not been updated, and is still inconsistent with the board schematic in relation to the LoRa pins discussed here. Surely it can’t be that hard to get this stuff right…

1 Like

thanks so much Pete and Macedo123 for you help. far better support than Heltec is willing to provide even though it is their product and change that has caused all this.

1 Like

For whatever it’s worth, I switched to using https://github.com/beegee-tokyo/SX126x-Arduino and it has worked pretty well for me so far.

+1. You can’t use the Sandeep version because the sx1262 has a different interface.

However it is a much nicer chip overall.

I posted patches to make the tcxo control in the beegee-tokyo library work with heltec v3 and they were committed this weekend, so update if you want the tcxo to work right