arduino-LoRa icon indicating copy to clipboard operation
arduino-LoRa copied to clipboard

onRecive() method never triggered.

Open Alain-Godo opened this issue 2 years ago • 2 comments

Hi everyone!!! I have the following issue. When I receive the data in a sync way all is fine (using the loop for example) but the callback function is never triggered using the onReceive() method.

IDE: PlatformIO Board: ESP32 DOIT DEVKIT V1 Pin used: HSPI + 4 (Reset) + 2 (DIO0)

Setup code:

hspi = new SPIClass(HSPI); hspi->begin(); lora2.setSPI(*hspi);

lora2.setPins(15,4,2); Serial.println("Begining 2..."); Serial.println(lora2.begin(915E6)); lora2.onReceive(lora2Callback); lora2.receive();

Callback function:

void lora2Callback(int packet_size) { Serial.print("Received packet: '");

// read packet
while (lora2.available()) {
Serial.print((char)lora2.read());
}

// print RSSI of packet
Serial.print("' with RSSI ");
Serial.println(lora2.packetRssi());

}

Note:

I tried changing the DIO0 pin that is related to the interrupt but still doesn't work.

Alain-Godo avatar Aug 14 '23 01:08 Alain-Godo

Try to keep your callback extremely short. It's a system interrupt. This problem bugged me for days.

Read this issue to solve all your confusions: link

qiweimao avatar Jun 03 '24 06:06 qiweimao

@qiweimao thanks, you saved my day.

yahyatamim avatar Jan 12 '25 12:01 yahyatamim