RAK3172-E at+send problem

hello,

im using RAK3172 with esp32s3
im comminicate on uart2 rak3271 and esp32s3

i have a problem i sended AT+SEND=2:13344 example message but my message not arrived to chirpstack gateway

my code here :






#define Uart1BaudRate  115200

String comdata = "";
//char * buf1 = "AT+APPEUI=48FF000000000008\r\n";
//char * buf2 = "AT+DEVEUI=48E663FFFE300008\r\n";
//char * buf3 = "AT+APPSKEY=64A60D27D87E88D65BD7E0B734EDE2F0\r\n";
char * buf4 = "AT+JOIN=1:0:10:8\r\n";
char * buf5 = "AT+VER=?\r\n";

char * buf1 = "AT+APPEUI=5E9D1E0857CF25F1\r\n";
char * buf2 = "AT+DEVEUI=5E9D1E0857CF25F1\r\n";
char * buf3 = "AT+APPKEY=F921D50CD7D02EE3C5E6142154F274B2\r\n";

char * buf6 = "AT+APPEUI=?\r\n";
char * buf7 = "AT+DEVEUI=?\r\n";
char * buf8 = "AT+APPKEY=?\r\n";

char * buf9 = "AT+VER=?\r\n";
char * buf10 = "AT+CLASS=A\r\n";
char * buf11 = "AT+NJM=1\r\n";
char * buf12 = "AT+BAND=5\r\n";
char * buf13 = "AT+NWM=1\r\n";
char * buf14 = "AT+MASK=0002\r\n";
char * buf15 = "AT+CHE=2\r\n";
char * buf16 = "AT+CFM=0\r\n";
char * buf17 = "AT+SEND=2:12345678\r\n";
char * buf18 = "AT+RECV=?\r\n";

char * buf19 = "AT+DCS=0\r\n";
char * buf20 = "AT+CFS=?\r\n";
char * buf21 = "ATZ?\r\n";



// the setup routine runs once when you press reset:
void setup() {
  Serial.begin(115200);
//  Serial1.begin(115200);
    Serial1.begin(115200,SERIAL_8N1,18,17);
//  Serial1.begin(115200,RAK_CUSTOM_MODE)
//  Serial.setRxBufferSize(MaxUartRxBufferSize);//默认缓冲区位128 Byte,更改为 512 Byte
//  Serial1.setRxBufferSize(MaxUartRxBufferSize);//默认缓冲区位128 Byte,更改为 512 Byte
////  while(Serial0.read()>= 0){}//clear serialport
//  while(Serial1.read()>= 0){}//clear serialport
 

  Serial1.write(buf21); // 将数据发送到UART1
  delay(500);
  while (Serial1.available() > 0)  
  {
      comdata += char(Serial1.read());//readBytes
      delay(2);
  }
  
  if (comdata.length() > 0)
  {
     Serial.println(comdata);
     comdata = "";
  }
    delay(1000);

  Serial1.write(buf14); // 将数据发送到UART1
  delay(500);
  while (Serial1.available() > 0)  
  {
      comdata += char(Serial1.read());//readBytes
      delay(2);
  }
  
  if (comdata.length() > 0)
  {
     Serial.println(comdata);
     comdata = "";
  }
    delay(1000);
      Serial1.write(buf15); // 将数据发送到UART1
  delay(500);
  while (Serial1.available() > 0)  
  {
      comdata += char(Serial1.read());//readBytes
      delay(2);
  }
  
  if (comdata.length() > 0)
  {
     Serial.println(comdata);
     comdata = "";
  }
    delay(1000);

  Serial1.write(buf13); // 将数据发送到UART1
  delay(500);
  while (Serial1.available() > 0)  
  {
      comdata += char(Serial1.read());//readBytes
      delay(2);
  }
  
  if (comdata.length() > 0)
  {
     Serial.println(comdata);
     comdata = "";
  }
    delay(1000);


 Serial1.write(buf13); // 将数据发送到UART1
  delay(500);
  while (Serial1.available() > 0)  
  {
      comdata += char(Serial1.read());//readBytes
      delay(2);
  }
  
  if (comdata.length() > 0)
  {
     Serial.println(comdata);
     comdata = "";
  }
    delay(1000);

 Serial1.write(buf11); // 将数据发送到UART1
  delay(500);
  while (Serial1.available() > 0)  
  {
      comdata += char(Serial1.read());//readBytes
      delay(2);
  }
  
  if (comdata.length() > 0)
  {
     Serial.println(comdata);
     comdata = "";
  }
    delay(1000);



 Serial1.write(buf10); // 将数据发送到UART1
  delay(500);
  while (Serial1.available() > 0)  
  {
      comdata += char(Serial1.read());//readBytes
      delay(2);
  }
  
  if (comdata.length() > 0)
  {
     Serial.println(comdata);
     comdata = "";
  }
    delay(1000);


 Serial1.write(buf12); // 将数据发送到UART1
  delay(500);
  while (Serial1.available() > 0)  
  {
      comdata += char(Serial1.read());//readBytes
      delay(2);
  }
  
  if (comdata.length() > 0)
  {
     Serial.println(comdata);
     comdata = "";
  }
    delay(1000);



 Serial1.write(buf2); // 将数据发送到UART1
  delay(500);
  while (Serial1.available() > 0)  
  {
      comdata += char(Serial1.read());//readBytes
      delay(2);
  }
  
  if (comdata.length() > 0)
  {
     Serial.println(comdata);
     comdata = "";
  }
    delay(1000);

 Serial1.write(buf1); // 将数据发送到UART1
  delay(500);
  while (Serial1.available() > 0)  
  {
      comdata += char(Serial1.read());//readBytes
      delay(2);
  }
  
  if (comdata.length() > 0)
  {
     Serial.println(comdata);
     comdata = "";
  }
    delay(1000);


 Serial1.write(buf3); // 将数据发送到UART1
  delay(500);
  while (Serial1.available() > 0)  
  {
      comdata += char(Serial1.read());//readBytes
      delay(2);
  }
  
  if (comdata.length() > 0)
  {
     Serial.println(comdata);
     comdata = "";
  }
    delay(1000);

 Serial1.write(buf4); // 将数据发送到UART1
  delay(500);
  while (Serial1.available() > 0)  
  {
      comdata += char(Serial1.read());//readBytes
      delay(2);
  }
  
  if (comdata.length() > 0)
  {
     Serial.println(comdata);
     comdata = "";
  }
    delay(1000);


 Serial1.write(buf5); // 将数据发送到UART1
  delay(500);
  while (Serial1.available() > 0)  
  {
      comdata += char(Serial1.read());//readBytes
      delay(2);
  }
  
  if (comdata.length() > 0)
  {
     Serial.println(comdata);
     comdata = "";
  }
    delay(1000);


}

// the loop routine runs over and over again forever:
void loop() {
  
//  Serial.println("hello world !!!");

//  Serial1.write(buf4); // 将数据发送到UART1
//  delay(200);
  Serial1.write(buf17); // 将数据发送到UART1
    delay(500);
    while (Serial1.available() > 0)  
    {
        comdata += char(Serial1.read());//readBytes
        delay(2);
    }
    
    if (comdata.length() > 0)
    {
      Serial.println(comdata);
      comdata = "";
    }

  delay(1000);



    Serial1.write(buf18); // 将数据发送到UART1
    delay(500);
    while (Serial1.available() > 0)  
    {
        comdata += char(Serial1.read());//readBytes
        delay(2);
    }
    
    if (comdata.length() > 0)
    {
      Serial.println(comdata);
      comdata = "";
    }

  delay(1000);
  while (Serial1.available() > 0)  
  {
      comdata += char(Serial1.read());//readBytes
      delay(2);
  }
  
  if (comdata.length() > 0)
  {
     Serial.println(comdata);
     comdata = "";
  }
  delay(10000);        // delay in between reads for stability
}

cannot work.

The AT+SEND command expects the payload as HEX-ASCII code.
E.g. if your payload is a byte array of {1,3,8,4,4}, the AT+SEND command will look like

AT+SEND=2:0103080404

i still didnt get any message






#define Uart1BaudRate  115200

String comdata = "";
//char * buf1 = "AT+APPEUI=48FF000000000008\r\n";
//char * buf2 = "AT+DEVEUI=48E663FFFE300008\r\n";
//char * buf3 = "AT+APPSKEY=64A60D27D87E88D65BD7E0B734EDE2F0\r\n";
char * buf4 = "AT+JOIN=1:0:10:8\r\n";
char * buf5 = "AT+VER=?\r\n";

char * buf1 = "AT+APPEUI=48FF000000000008\r\n";
char * buf2 = "AT+DEVEUI=48E663FFFE300008\r\n";
char * buf3 = "AT+APPKEY=64A60D27D87E88D65BD7E0B734EDE2F0\r\n";

char * buf6 = "AT+APPEUI=?\r\n";
char * buf7 = "AT+DEVEUI=?\r\n";
char * buf8 = "AT+APPKEY=?\r\n";

char * buf9 = "AT+VER=?\r\n";
char * buf10 = "AT+CLASS=A\r\n";
char * buf11 = "AT+NJM=1\r\n";
char * buf12 = "AT+BAND=5\r\n";
char * buf13 = "AT+NWM=1\r\n";
char * buf14 = "AT+MASK=0002\r\n";
char * buf15 = "AT+CHE=1:2:3:4:5:6:7:8\r\n";
char * buf16 = "AT+CFM=0\r\n";
char * buf17 = "AT+SEND=2:1234\r\n";
char * buf18 = "AT+RECV=?\r\n";

char * buf19 = "AT+DCS=1\r\n";
char * buf20 = "AT+CFS=?\r\n";
char * buf21 = "ATR\r\n";
char * buf22 = "AT+ADR=1\r\n";




void sendCommand(const char* cmd) {
  Serial1.write(cmd);  // Komutu gönder
  delay(500);  // Yeterli zaman ver
  String response = "";  // Yanıtı tutacak string
  while (Serial1.available() > 0) {
    response += char(Serial1.read());  // Yanıtı oku
  }
  if (response.length() > 0) {
    Serial.println(response);  // Yanıtı seri porttan yazdır
  }
}

void setup() {
  Serial.begin(115200);
  Serial1.begin(115200, SERIAL_8N1, 18, 17);

 sendCommand("AT+DEBUG=1\r\n");
  delay(1500);
  //sendCommand(buf21); 
  sendCommand("ATE\r\n");
  delay(3000);
  sendCommand("AT+NWM=1\r\n");
  delay(1000);
  sendCommand("AT+NJM=1\r\n");
  delay(1000);
  sendCommand("AT+CLASS=A\r\n");
  delay(1000);
  sendCommand("AT+BAND=5\r\n");
  delay(1000);
  sendCommand(buf1);
  delay(1000);
  sendCommand(buf2);
  delay(1000);
  sendCommand(buf3);
  delay(1000);
  sendCommand("AT+MASK=0002\r\n");
  delay(1000);
  sendCommand("AT+CHE=1:2\r\n");
  delay(1000);
  sendCommand("AT+DR=4\r\n");
  delay(1000);
  sendCommand("AT+JOIN=1:0:10:8\r\n");
  delay(1000);



  // Diğer komutlarınızı da ekleyebilirsiniz
}

void loop() {
  // Yine komutları gönderebilirsiniz
 // sendCommand(buf17);  // AT+SEND komutunu gönder
  //delay(1000);  // Sabit bir gecikme ile tekrar gönderim yapabilirsiniz


 // sendCommand(buf17);
 // delay(10000);

  sendCommand("AT+SEND=2:0103080404\r\n");
  delay(15000);
   // sendCommand("AT+NJS=?\r\n");
 // UART üzerinden gelen veriyi oku
  if (Serial1.available() > 0) {
    comdata = "";
    while (Serial1.available() > 0) {
      comdata += char(Serial1.read()); // Veriyi oku
      delay(2);
    }

    if (comdata.length() > 0) {
      // Gelen veriyi konsola yazdır
      Serial.println("Received data: ");
      Serial.println(comdata);
    }
  }

  delay(100); // Delay, stabilite için

}

still same i didnt get any messeage

I am guessing you are missing some responses from the RAK3172.

Your implementation of void sendCommand() expects the RAK3172 to respond within 500ms. That is not guaranteed. Some commands can take longer before they respond.

I don’t see as well anywhere that you check the response. Beside of “OK” there can be errors.

Maybe you can have a look at the RUI3-AT-OTAA example. It is using a small (and not perfect) library to communicate from a host MCU with a RAK3172.

Thank you for answer @beegee

im using that library

but still not work

===========================================
Starting loop-through - exit with 'ESC' key
===========================================

Clear Serial1 RX buffer.
===========================================
Convert byte array to ASCII array
Result: 000102030405060708090A0B0C0D0E0F
===========================================
Convert ASCII array to byte array
Result: {00,01,02,03,04,05,06,07,08,09,0A,0B,0C,0D,0E,0F,}
===========================================
Get version
Ver: RUI_4.0.6_RAK3172-E
OK
LORAWAN mode set already
===========================================
Get LoRaWAN class
Class 0 (0=A, 1=B, 2=C)
===========================================
Get LoRaWAN region
Region 5
===========================================
Get DR
Datarate 4
===========================================
Get confirmed/unconfirmed mode
Mode 1 = Confirmed
===========================================
Get LPM
LPM 0 = off
===========================================
Get LPM level
LPM level 1
===========================================
Get Join mode
Join mode 1 = OTAA
===========================================
Get DevEUI
DevEUI: 48E663FFFE300008

===========================================
Get AppEUI
AppEUI: 48FF000000000008

===========================================
Get AppKey
AppKey: 64A60D27D87E88D65BD7E0B734EDE2F0

===========================================
Get Device Address
Device Address: 00000000
===========================================
Get App Session Key
AppSKey: 00000000000000000000000000000000

===========================================
Get Network Session Key
NwSKey: 00000000000000000000000000000000

OTAA mode set already
===========================================
Start Join request
Network join requested
===========================================
Wait for join
Network not yet joined
Network not yet joined
Network not yet joined
Network joined
===========================================
Set LPM
===========================================
Set LPM level
===========================================
Set Datarate
===========================================
Set confirmed packet mode
===========================================
Start send packet 1 failed: 0
Wait for TX/RX result
TX success - RX: , UserDataSize 19 PossibleDataSize 242 AdditionalFOptsSize 0
Frequency:902300000
Rx1Frequency:902500000
RxCFrequency:923300000
RxC Datarate:8
ChannelsDatarate:3
AdrAckCounter:0
ChannelsTxPower:0
OK
===========================================
Start send packet 2 failed: 0
Wait for TX/RX result
TX success - RX: , UserDataSize 19 PossibleDataSize 242 AdditionalFOptsSize 0
Frequency:902300000
Rx1Frequency:902500000
RxCFrequency:923300000
RxC Datarate:8
ChannelsDatarate:3
AdrAckCounter:1
ChannelsTxPower:0
OK
===========================================
Start send packet 3 failed: 0
Wait for TX/RX result
TX success - RX: , UserDataSize 19 PossibleDataSize 242 AdditionalFOptsSize 0
Frequency:902300000
Rx1Frequency:902500000
RxCFrequency:923300000
RxC Datarate:8
ChannelsDatarate:3
AdrAckCounter:2
ChannelsTxPower:0
OK
===========================================
Start send packet 4 failed: 0
Wait for TX/RX result
TX success - RX: , UserDataSize 19 PossibleDataSize 242 AdditionalFOptsSize 0
Frequency:902300000
Rx1Frequency:902500000
RxCFrequency:923300000
RxC Datarate:8
ChannelsDatarate:3
AdrAckCounter:3
ChannelsTxPower:0
OK
===========================================
Start send packet 5 failed: 0
Wait for TX/RX result
TX success - RX: , UserDataSize 19 PossibleDataSize 242 AdditionalFOptsSize 0
Frequency:902300000
Rx1Frequency:902500000
RxCFrequency:923300000
RxC Datarate:8
ChannelsDatarate:3
AdrAckCounter:4
ChannelsTxPower:0
OK
===========================================
Start send packet 6 failed: 0
Wait for TX/RX result
TX success - RX: , UserDataSize 19 PossibleDataSize 242 AdditionalFOptsSize 0
Frequency:902300000
Rx1Frequency:902500000
RxCFrequency:923300000
RxC Datarate:8
ChannelsDatarate:3
AdrAckCounter:5
ChannelsTxPower:0
OK
===========================================
Start send packet 7 failed: 0
Wait for TX/RX result
TX success - RX: , UserDataSize 19 PossibleDataSize 242 AdditionalFOptsSize 0
Frequency:902300000
Rx1Frequency:902500000
RxCFrequency:923300000
RxC Datarate:8
ChannelsDatarate:3
AdrAckCounter:6
ChannelsTxPower:0
OK
===========================================
Start send packet 8 failed: 0
Wait for TX/RX result
TX success - RX: , UserDataSize 19 PossibleDataSize 242 AdditionalFOptsSize 0
Frequency:902300000
Rx1Frequency:902500000
RxCFrequency:923300000
RxC Datarate:8
ChannelsDatarate:3
AdrAckCounter:7
ChannelsTxPower:0
OK
===========================================
Start send packet 9 failed: 0
Wait for TX/RX result
TX success - RX: , UserDataSize 19 PossibleDataSize 242 AdditionalFOptsSize 0
Frequency:902300000
Rx1Frequency:902500000
RxCFrequency:923300000
RxC Datarate:8
ChannelsDatarate:3
AdrAckCounter:8
ChannelsTxPower:0
OK
===========================================
Start send packet 10 failed: 0
Wait for TX/RX result
TX success - RX: , UserDataSize 19 PossibleDataSize 242 AdditionalFOptsSize 0
Frequency:902300000
Rx1Frequency:902500000
RxCFrequency:923300000
RxC Datarate:8
ChannelsDatarate:3
AdrAckCounter:9
ChannelsTxPower:0
OK
===========================================
Start send packet 11 failed: 0
Wait for TX/RX result
TX success - RX: , UserDataSize 19 PossibleDataSize 242 AdditionalFOptsSize 0
Frequency:902300000
Rx1Frequency:902500000
RxCFrequency:923300000
RxC Datarate:8
ChannelsDatarate:3
AdrAckCounter:10
ChannelsTxPower:0
OK
===========================================
Start send packet 12 failed: 0
Wait for TX/RX result
TX success - RX: , UserDataSize 19 PossibleDataSize 242 AdditionalFOptsSize 0
Frequency:902300000
Rx1Frequency:902500000
RxCFrequency:923300000
RxC Datarate:8
ChannelsDatarate:3
AdrAckCounter:11
ChannelsTxPower:0
OK
===========================================
Start send packet 13 failed: 0
Wait for TX/RX result
TX success - RX: , UserDataSize 19 PossibleDataSize 242 AdditionalFOptsSize 0
Frequency:902300000
Rx1Frequency:902500000
RxCFrequency:923300000
RxC Datarate:8
ChannelsDatarate:3
AdrAckCounter:12
ChannelsTxPower:0
OK
===========================================
Start send packet 14 failed: 0
Wait for TX/RX result
TX success - RX: , UserDataSize 19 PossibleDataSize 242 AdditionalFOptsSize 0
Frequency:902300000
Rx1Frequency:902500000
RxCFrequency:923300000
RxC Datarate:8
ChannelsDatarate:3
AdrAckCounter:13
ChannelsTxPower:0
OK
===========================================
Start send packet 15 failed: 0
Wait for TX/RX result
TX success - RX: , UserDataSize 19 PossibleDataSize 242 AdditionalFOptsSize 0
Frequency:902300000
Rx1Frequency:902500000
RxCFrequency:923300000
RxC Datarate:8
ChannelsDatarate:3
AdrAckCounter:14
ChannelsTxPower:0
OK

i dont see any message on Concentrator

You are using US915. Are you sure both the node and the gateway and you LNS are set to the same sub-channels?

 //sendCommand(buf21); 
  sendCommand("AT\r\n");
  delay(3000);
  sendCommand("ATE\r\n");
  delay(1000);
  sendCommand("AT+VER=?\r\n");
  delay(1500);
  sendCommand("AT+DEBUG=0\r\n");
  delay(1500);
  sendCommand("AT+NWM=1\r\n");
  delay(1000);
  sendCommand("AT+NJM=1\r\n");
  delay(1000);
  sendCommand("AT+CLASS=C\r\n");
  delay(1000);
  sendCommand("AT+BAND=5\r\n");
  delay(1000);
  sendCommand("AT+MASK=0002\r\n");
  delay(1000);
  sendCommand("AT+ADR=1\r\n");
  delay(1000);
  sendCommand("AT+CFM=1\r\n");
  delay(1000);
  sendCommand("AT+CHS=904900000\r\n");
  delay(1000);
  sendCommand("AT+JN1DL=5\r\n");
  delay(1000);
  sendCommand("AT+JN2DL=5\r\n");
  delay(1000);
  sendCommand("AT+RX1DL=5\r\n");
  delay(1000);
  sendCommand("AT+RX2DL=5\r\n");
  delay(1000);
  sendCommand("AT+RX2DR=8\r\n");
  delay(1000);
  sendCommand("AT+RX2FQ=923300000\r\n");
  delay(1000);
  //sendCommand("AT+TTX=4\r\n");
  //delay(1000);
  sendCommand("AT+DEVEUI=5E9D1E0857CF25F1\r\n");
  delay(1000);
  sendCommand("AT+APPEUI=5E9D1E0857CF25F1\r\n");
  delay(1000);
  sendCommand("AT+APPKEY=F921D50CD7D02EE3C5E6142154F274B2\r\n");
  delay(1000);
  sendCommand("AT+JOIN=1:0:10:8\r\n");
  delay(1000);

that working Class A with this settings. but Class C end node not receiving any message when i send hex on chirpstack