How to pass AT commands to Lora from ESP32 UART?

Hello, I have connected "Reyax RYLR998" Lora module to ESP32 UART2, but AT commands passed through Hardware serial not working.

#define RXD2 16
#define TXD2 17

void setup() 
{
  Serial.begin(115200);
  Serial2.begin(115200, SERIAL_8N1, RXD2, TXD2);
  
  Serial.print("\nSetting Lora Module \n");
  
  Serial2.print("AT+IPR=9600\r\n");
  if (Serial2.available()) 
	  Serial.println(Serial2.read());
  delay(1000); 
  
  Serial2.print("AT+BAND=865000000\r\n");
    if (Serial2.available()) 
		Serial.println(Serial2.read());
  delay(1000);

  Serial2.print("AT+ADDRESS=1\r\n");
    if (Serial2.available()) S
	erial.println(Serial2.read());
  delay(1000);
  
  Serial2.print((String)"AT+NETWORKID=5\r\n");
  if (Serial2.available()) 
	  Serial.println(Serial2.read());
  delay(1000); 
}

void loop() 
{ 
  while (Serial2.available()) 
  {
    Serial.print(char(Serial2.read()));
  }
}

I tried

  1. Serial2.print((String)"AT+NETWORKID=5\n");
  2. Serial2.println((String)"AT+NETWORKID=5\r");
  3. Serial2.print((String)"AT+NETWORKID=5\r");
    Nothing worked, no response from AT command,
    Please help me I have been working on same problem for 2days.

Maybe its faulty.

However, you seem to be sending a command to the RYLR998 at 115200 baud to change the module baud rate to 9600;

Serial2.print("AT+IPR=9600\r\n");

But then attempt to read characters from Serial2 at the original 115200 baud rate.

No its, not faulty, it receives data when I use all default parameters of RYLR998.
I agree, but Serial2.print("AT+IPR=9600\r\n"); never succedd and set BAUD rate to 9600, it use default of RYLR998

How to know response from AT command we provide from above Serial2? I want error code at least, so can you please share me code which will show response from AT command on serial port monitor

I hope you understand what that means, I aint got a clue.

I got your point, but the AT command which change BAUD rate is not succeeding, it still use 115200, I confirmed it by sending data from other Lora node whose BAUD rate is 115200.
Only problem I am facing is, I am not able to pass AT command to Lora module from ESP32.

No luck even today, completely stuck

why do you keep using it then?
Using this command increases the number of possible sources of problems. Your task at this stage is to make the number of these sources as small as possible.

You need to concentrate on the actual problem.

If the module is, apparently, not accepting AT commands, then hook it up direct to a USB to Serial adapter and use a Serial terminal program, or the Arduino IDE, to send the AT commands and see what, if any, the reply from the RYLR998 is.

Did you contact the supplier of your modules for assistance ?

Why did you choose this LoRa module in particular, there are many other LoRa modules out there that are well supported with Libraries and heaps of working examples.

Thanks for replying.
When i connect this lora module to USB then it accepts AT commands and response each command.
Only issue with when connected to esp32.

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