Replies: 3 comments 6 replies
-
First of all, you're using Also, are you sure you have things like frequency deviation and bit rate configured properly? You don't seem to be doing that in the |
Beta Was this translation helpful? Give feedback.
-
Also this seems more like a usage question than an actual issue, so until there's some problem in the library I'm converting this to discussion instead. |
Beta Was this translation helpful? Give feedback.
-
btw @jgromes, I am still not able to receive anything with the SX1278 in OOK mode.
Is the lib using the SX127X's continous mode (data sheet 4.2.12.) / package mode (4.2.13.)? // include the library
#include <RadioLib.h>
// SX1278 radio = new Module(NSS, DIO0, RESET, DIO1);
// SX1278 radio = new Module(10, 2, 9, 3); // arduino
// SX1278 radio = new Module(15, 4, 16, 5); // nodemcu esp8266 DIO2 11
// SX1278 radio = new Module(18, 26, 14, 4); // ttgo-lora-esp32 v1
SX1278 radio = new Module(18, 26, 33, 13); // ttgo-lora-esp32 v2
// nodemcu esp8266
// NSS: 15 D8
// DIO0: 5 D1
// RESET: 16 D0
// DIO1: 4 D2
// const int pin = 9; // DIO2: D11/SD2 GPIO9
// nodemcu ttgo-lora-esp32 v2
// NSS: 18
// DIO0: 26
// RESET: 14
// DIO1: 13
const int pin = 15; // DIO2: 15
// ESP32
void IRAM_ATTR readBit(void) {
// ESP8266
// void ICACHE_RAM_ATTR readBit(void) {
radio.readBit(pin);
}
void setup() {
Serial.begin(9600);
Serial.print(F("[SX1278] Initializing ... "));
// int state = radio.begin();
int state = radio.beginFSK();
if (state == ERR_NONE) {
Serial.println(F("success!"));
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while (true);
}
state = radio.setOOK(true);
state = radio.setFrequency(433.92);
state = radio.setBitRate(20);
// state = radio.setBitRate(8.494);
// state = radio.setBitRate(9);
state = radio.setFrequencyDeviation(100); // Though 10 kHz for a 5 kbps seems reasonable enough
state = radio.setRxBandwidth(200); // 50 kHz
// state = radio.setRxBandwidth(250); // 50 kHz
state = radio.setCRC(false); // errorCorrection
// state = radio.setOutputPower(17.0);
// state = radio.setCurrentLimit(100);
// state = radio.setOokThresholdType(SX127X_OOK_THRESH_AVERAGE);
// state = radio.disableAddressFiltering(); // address filtering is disabled by default - also it has no effect on direct mode
// state = radio.setPreambleLength(0); // in direct reception, preamble isn't processed
// state = radio.setDirectSyncWord(1101, 4); // schlafWhite
// state = radio.setDirectSyncWord(1000, 4); // schlafWhite
// state = radio.setDirectSyncWord(1001, 4); // interWhite
// state = radio.setDirectSyncWord(10000, 5); // interGrey
// state = radio.setDirectSyncWord(10000, 101); // interGrey
state = radio.setDirectSyncWord(1, 1); // XXX
// uint8_t syncWord[] = {0x45};
// state = radio.setSyncWord(syncWord, 1); // interGrey
if (state != ERR_NONE) {
Serial.println(F("[SX1278] Unable to start direct reception mode, code "));
Serial.println(state);
while (true);
} else if (state == ERR_NONE) {
Serial.println(F("[SX1278] Initialized!"));
}
radio.setDirectAction(readBit);
radio.receiveDirect();
Serial.println(F("[SX1278] Waiting for incoming transmission ... "));
}
void loop() {
int state = radio.receiveDirect();
if (state != ERR_NONE) {
Serial.println(F("[SX1278] Unable to start direct reception mode, code "));
Serial.println(state);
}
// if(radio.available() >= 15) {
// Serial.println("[SX1278] Received packet in direct mode!");
// while(radio.available()) {
// read a byte
byte b = radio.read();
// print it
Serial.print(b, HEX);
Serial.print('\t');
Serial.write(b);
Serial.println();
// }
// }
}
thank you for your effort and sry for highjacking your post @kuestess 😢 |
Beta Was this translation helpful? Give feedback.
-
@jgromes Thanks for the excellent library! I am using a Heltec Lora 32 (v2) in an attempt to receive Insteon packets. As you're probably aware, the Heltec Lora v2 is simply an SX1276 integrated with an ESP32 - pinout for the module is here: pinout. Insteon RF packets are 2-FSK packets of variable length, details of the packet format are here: Insteon packet information.
For now, I'm simply trying to receive packets and will work through the decoding later. I'm using the sketch below based upon the receive_direct example (which I think is the right place to start), but am unable to receive any packets. I've also tried sketches based upon the FSK modem example, but am unable to receive packets there as well. I am using RadioLib 4.5.0. Any help is very much appreciated!
Beta Was this translation helpful? Give feedback.
All reactions