Error : 96 when sending data threw Arduino Mega and RAK5205

Hi everybody, I need your help for a little issue I have in my project…

I wrote an Arduino code to send data from my RAK5205 (connected to an Arduino Mega), and unfortunately I have 1 packet / 2 which is not desserved due to this error 96… I don’t understand, I tried to put some delays between each sendings but still not work. If someone can help me I will be very grateful because I don’t find the solution !

void setup() { 

String response = ""; 
int incomingByte = 0;

void loop() { 

 for (int i=1; i<=10; i++){
 sendCommandData(":426f6e6a6f75722c2074657374207472616e736d6973\r\n", i);
 //set conn config 
 //setConnConfig("dev_eui", "60C5A8FFFE6D03DE"); 
 //setConnConfig("app_eui", "00137A1000000000"); 
 //setConnConfig("app_key", "5A6967426565416C6C69616E63653039"); 
 //join the connection 
 //send data too gateway 

* Function to send a command to the  
* lora node and wait for a response 

void sendCommand(String atComm){ 
response = ""; 
   char ch =; 
   response += ch; 

void sendCommandData(String atComm, int numPort){ 
response = ""; 
int port;
char cstr[16];
//itoa(numPort, cstr, 10);
Serial1.print((String)"at+send=lora:" + numPort + atComm);
Serial.println((String)"at+send=lora:" + numPort + atComm); 
   char ch =; 
   response += ch; 

void sendCommand2(String atCommand){
  if (Serial.available() > 0) {
    // read the incoming byte:
    incomingByte =;

    // say what you got:
    Serial.print("I received: ");
    Serial.println(incomingByte, HEX);    


* send the rak811 to sleep for time  
* specified in millis paramteer 

void sleep(unsigned long milliseconds=1000){ 
 //send any charcater to wakeup; 

* reset board after the specified time delay millisenconds 
* <mode> = 0 Reset and restart module 
= 1 Reset LoRaWAN or LoraP2P stack and Module will reload LoRa 
configuration from EEPROM 

void resetChip(int mode=1, unsigned long delaySec=0){ 
 String command = (String)"at+reset=" + mode + (String)"\r\n"; 

* Reload the default parameters of LoraWAN or LoraP2P setting 

void reload(unsigned long delaySec=1){ 

* Function to set module mode 
* <mode> = 0 LoraWAN Mode (default mode) 
= 1 LoraP2P Mode 
void setMode(int mode=1){ 
 String command = (String)"at+mode=" + mode + (String)"\r\n"; 

* Function to send data to a lora gateway; 
* <type> = 0 send unconfirmed packets 
= 1 send confirmed packets 
<port> = 1-223 port number from 1 to 223 
<data>= <hex value> hex value(no space). The Maximum length of <data> 64 bytes 

void sendData(int type, int port, String data){ 
 String command = (String)"at+send=" + type + "," + port + "," + data + (String)"\r\n"; 

* Function to send a join request 
* allowed methods "otaa" and "abp" 

void sendJoinReq(String method){ 
 String command = (String)"at+join=" + method + "\r\n"; 

* Function to set the connection config 
* < dev_addr >:<address> 
<address>-------------------4 bytes hex number representing the 
device address from 00000001 – 
<eui>-------------------------- 8-byte hexadecimal number 
representing the device EUI 
<eui>----------------------------8-byte hexadecimal number 
representing the application EUI 
- 11 - 
<key>----------------------------16-byte hexadecimal number 
representing the application key 
<key>-------------------------16-byte hexadecimal number 
representing the network session key 
<key>------------------------ 16-byte hexadecimal number representing 
the application session key 
<dbm>------------------- LoRaWAN Tx Power 
<status>----------------------------- string value representing 
the state, either “on” or “off”. 
<dr>:<data rate> 
<data rate>-----------------------decimal number representing the 
data rate, from 0 and 4, but within 
the limits of the data rate range for 
the defined channels. 
< public_net >:<status> 
<status>------------------- string value representing 
the state, either “on” or “off”. 
< rx_delay1 >:<delay> 
<delay>-------------------decimal number representing 
the delay between the transmission 
and the first Reception window 
in milliseconds, from 0 to 65535. 
void setConnConfig(String key, String value){ 
 sendCommand("at+set_config=" + key + ":" + value + "\r\n"); 

Welcome to RAK forum @xaviercunego :slight_smile:

The serial replies you got doesn’t match your code. I see sleep and wake up but you never executed any sleep command. I am suspecting your auto transmit is activated.

Can you run this AT command at+set_config=lora:send_interval:0:0 and try again? This will disable the automatic transmission mode if it is activated.

Thank you @carlrowan ! :slight_smile:

Indeed I am in automatic sending mode, but when I write the command you give me it changes nothing… :thinking:

Hi @xaviercunego ,

I think you are doing it right. But to be sure the auto-send is deactivated, you must send at+get_config=lora:status and check Auto send status: false parameter. If this is true, then it is not disabled yet.


It might be better if you try to do it in Serial Terminal first. Then if you got the intuition how the command works, you can implement a better algorithm/routine in your Arduino Mega code.

I can’t find the auto send status when I write this command, even on the RAK Serial Port Tool.

What FW version do you have?

The V3.0.0.14.H.R, I think this is the last one ?

Hi @xaviercunego ,

Yes, you are using the latest FW. I am not sure why you don’t a reply when at+get_config=lora:status is set. I tried it and it works.

I am also wondering why your device restarts. The serial output in yellow box only shows if your device restarts.

Hi @carlrowan,

I am going to install again the firmware and test the code tuesday, I’ll keep you informed.

Thank your for the help again !

Hi @carlrowan ! :slight_smile:

I installed the firmware again and I have the same problem… Do you have any other idea about the issue ?.. I screenshot the serial to show you that I have the right firmware version and that the device is still in automatic sendind data…image

Furthermore, I have an other question for you… In my project I have to transmitt some data from an ultrasound probe and I don’t know if my LoRa device can do the job while respecting the 30s per day ratio. This is the example of what I have to send, I would like to fragment it in order to send few packages and then group all the data with my application. Do you think it is feasible ?

Oh. Hmm. Just to clarify, when you send at+get_config=lora:status command, you don’t see any reply in whatever scenario like not joining yet, joining, joined or failure to join?

Can you try this:

  1. Connect to PC.
  2. Open serial terminal.
  3. Input at+set_config=device:restart
  4. Input at+get_config=lora:status

What is the reply or what will happen in your case?

Regarding the long payload, I see 640 samples. Are you planning to send all those? Like in what interval? At first impression, I am afraid LoRaWAN might not be the perfect technology for it. But if you will just need to send that burst of data once a day, could be possible.

LoRa can do it but our concern will be the dutycycle or dwell time limitation.

Here is the reply I have on my serial when I write your 2 instructions :

Yes the purpose is to send all this data each day. At this moment I don’t have any space constraints, I mean the gateway and the device are in the same room.

Edit : After I retry it on the RAK serial tool this time I have a longer reply :

Also then I asked him to stop autosend : image

But when I restart the device always the same problem… :

@xaviercunego , sorry i posted a wrong command in my last reply. it should be at+get_config=lora:status

Can you please try again?

1 Like

Opps. I am correct you are the one sending wrong command :sweat_smile:

I am not sure what that means.

But for us to know if LoRaWAN fits on your payload, we need to know how many bytes it is and if you can have a constant datarate since the air-time of your LoRaWAN signal also dependes on the spreading factor. If you can’t ensure a fix datarate, then we have to assume SF12 in the calculation. This means, the closer you are on the gateway, much better. But not too close. Please at least have a wall separation :grin:

I think I can have max 1 kilobyte :slight_smile: So if we assume I can provide a fix datarate do you think it’s possible ?

Are you sure at+set_config=lora:send_interval:0:0 is the only right command to disable auto send ?

Hmm. At 1000bytes, we can send it every hour with around 42 bytes size. That should still be allowable at SF7. But we need to consider packet loss specially if your gateway still uses the legacy packet forwarder(UDP) and not the lora basic station (TCP). UDP will introduce losses. If we send the data twice to compensate data loss, then we need to transmit 42bytes every 30minutes. I am not really familiar with the dwell time calculation in US915 but you can easily check that over the internet. But 42bytes every 30minutes might be possible at SF7.

Yes. That is the only command you need. But you need to check on the lora:status if it really take effect. Else, input it again.

Thank you for all your support, you help me so much to understand how the LoRa device is working!
I’m pretty sure my gateway is working on TCP so I saw that I can choose almost any datarate I want but what is the advantage to take a slower datarate like SF9 instead of SF7 ? The consumption ? The range ?

Yes that’s I did but it’s still don’t work…so mysterious I don’t get it… I have a RAK811 Trackerboard too, maybe I will try on this one…