Radiolib with RP2040-Lora Waveshare module

Hello,

I'm trying to use the Waveshare RP2040-Lora module with the RadioLib library GitHub - jgromes/RadioLib: Universal wireless communication library for embedded devices. This module uses the Lora SX1262 chip on the RP2040 SPI1. During Radiolib initialization I have a return code « 707 » indicating a problem with the TCXO reference. If I'm not mistaken, is not used by default ; I tried to force the TCX0 to 0v without success via the call to the “setTCXO(0)” function. Do you have any idea of ​​the problem? Have you already used the waveshare RP2040-Lora successfully?

Tristan.

#include <SPI.h>
#include <RadioLib.h>

// SPI definition
#define LORA_SCK     14  // GP10
#define LORA_MISO    24   // GP8
#define LORA_MOSI    15  // GP11
#define LORA_SS      13  // GP9
#define LORA_RST     23  // GP23
#define LORA_DIO1    16  // GP16
#define LORA_BUSY    18  // GP18
#define LORA_ANT_SW  17  // GP17


SX1262 radio = new Module(LORA_SS, LORA_DIO1, LORA_RST, LORA_BUSY, SPI1);


//----------------------------------
void setup() {
  Serial.begin(9600);
  while (!Serial);

  // SPI configuration
  SPI1.setRX(LORA_MISO);
  SPI1.setTX(LORA_MOSI);
  SPI1.setSCK(LORA_SCK);
  SPI1.begin();
  
 
  // SX1262 init ------
  int state = radio.begin(868.0, 125.0, 12, 5, RADIOLIB_SX126X_SYNC_WORD_PRIVATE, 17, 14);
  if (state != RADIOLIB_ERR_NONE) {
    Serial.print("LoRa init failed, Error code : ");
    Serial.println(state);
    while (true);
  }

  radio.setTCXO(1.8);

  Serial.println("LoRa Ok.");
}

void loop() {
  Serial.println("Send message...");
  int state = radio.transmit("Hello, LoRa!");
  
  if (state == RADIOLIB_ERR_NONE) {
    Serial.println("Transmission ok.");
  } else {
    Serial.print("Transmission error: ");
    Serial.println(state);
  }

  delay(5000);
}

1 Like

Hi,
This module doesn't have a TCXO and they don't even mention it on the wiki so i'm not sure how you're supposed to know that. In any case, you need to remove the radio.setTCXO(1.8);
line and modify this line int state = radio.begin(868.0, 125.0, 12, 5, RADIOLIB_SX126X_SYNC_WORD_PRIVATE, 17, 14); to int state = radio.begin(868.0, 125.0, 12, 5, RADIOLIB_SX126X_SYNC_WORD_PRIVATE, 17, 14, 0); By the way i was having problems with SPI on my module and your code helped me fix it so thank you for posting it.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.