Rak811: work_mode problem

Issue: Can’t get any response from at+set_config=lora:work_mode:0 when using RAK SERIAL PORT TOOL or get strange output with Arduino.


  • SAMD51 Board with Arduino IDE.
  • RAK811 Breakout Board for end-node.
  • RAK2247 for gateway.

Server: TTN

Details: I’m testing it using the WisNode-Arduino-Library running the Join Network OTAA Example. But when running it, I’ve a problem with this part:

if(!RAKLoRa.rk_setWorkingMode(0))  //set WisNode work_mode to LoRaWAN.
    DebugSerial.println(F("set work_mode failed, please reset module."));

This command RAKLoRa.rk_setWorkingMode(0) gives me the output:

LoRa (R) is a registered trademark or service mark of Semtech Corporation or its affiliates. LoRaWAN (R) is a licensed mark.

RAK811 Version:
UART1 wo

I got this message by printing the res variable on the RAK811.cpp

    ret = rk_recvData();
    Serial.print("Ret: ");

And when trying to use the same command with the RAK SERIAL PORT TOOL I got absolutely no reply from this command, the others (like status and version) works just fine before using this one, after it they also stop responding until I remove and insert the USB again.

So, I got the code working by removing the verification, but this problem isn’t solved, just bypassed. Does anyone knows how to handle this?

  //if(!RAKLoRa.rk_setWorkingMode(0))  //set WisNode work_mode to LoRaWAN.
  //  DebugSerial.println(F("set work_mode failed, please reset module."));
  //  while(1);

Yes, yes I do.

This is a long standing issue with the library - the device only every needs this doing ONCE, not every time you start it up, nor does it need all the keys etc setting up every time you start it up. But that’s what the library does.

The wrinkle is that you have to reset the module after issuing the working mode command and there is no reset line, so the script just hangs as soon as the the command is issued.

Just comment it out.

Maybe one day I’ll have time to sort out a git clone / pull request. Or someone at RAK could just remove it.

1 Like


I’m not using arduino library, but encountered on the same issue on RAK811 on custom board - hang up when trying to set work_mode.
I also tried “at+set_config=device:restart” and it also hanged up waiting hardware reset.

I have WisNode board that work properly and automatically reset itself.

The investigation shown that in custom board I set RST pin to “strong” 3.3V using my MCU.
When RAK811 wants to reset itself after these at commands it set RST pin to the ground, but it can’t overcome external MCU - there is around 2.6V on the pin.

So the simple solution is not set RST pin at all, RAK811 already internally pull up RST pin to 3.3V.

@SWoto in your current state try send “at+set_config=device:restart” command and if it hangs same way, I think you have the same issue with RST, it better to fix it with correct configure of external MCU, of course you can eliminate setting mode every time, but not worked “at+set_config=device:restart” is the bug after all.

Either way, use something to setup the module, cycle the power and then use it for your application.

Thank you @nmcc, I did comment it and worked fine.

It would be really good for Rak to fix this issue so new people can avoid the problem.

I’ll check latter if I’ve any arm based board nearby to use their example code changing only the needed part to create a pull request with this.

1 Like

@SWoto I replicate your case using WisNode v1.2 board and it seems to be working fine. I can get replies via Rak serial tool and I can directly use the arduino library with no modification.

We also have the same FW - https://downloads.rakwireless.com/LoRa/RAK811/Firmware/.

Is that a custom board for of SAMD51 with RAK811? Or you only connect the uart lines for testing?

Sorry @carlrowan, that’s not replicating it - you HAVE to use an Arduino and the released library to see the problem.

However, good news, I can replicate what you did, which is why it was a puzzler when I first came across the problem - the serial tool worked, the Arduino just stopped.

It may be as simple as looking for the correct startup string in the library, I didn’t look that hard when I first diagnosed the problem as I didn’t see the point in setting up the module each and every time the sketch started. So I have a provisioning setup and the actual device sketch. This rather solves the problem of embedding keys in to the sketch or having some layer on the Arduino over serial to set the keys to then pass them on to the module.

1 Like

Yes @nmcc, I did replicate it on actual Arduino uno board. I wasn’t able to post the photo though. I did use v3.0.0.13 and v3.0.0.14 to be sure. @SWoto and I have the same and most updated firmware that’s why I am interested to see his hardware setup. It seems that the RAK811 can’t reset properly on his case.

I’ve WisDuino v1.2 boards plus breakout boards and they lock up. I’ve updated firmware so much of late I can’t recall which ones are running what, but I can check again.

@carlrowan, I’m currently without a windows computer at this moment so i can’t use the RAK SERIAL PORT TOOL to check it again. I’ll try to do it as soon as i find one xD

Also, i did test it on a custom board with SAMD51 not the actual Arduino board. I will test it on Arduino Due (because of the 3.3V logic) and let you know the results.

@carlrowan, I did the test with the following setup:

My result was the same as before, the code got stuck when trying to set the work_mode it doesn’t receive the OK.

  • Result:
WisDuino Evaluation Board - RAK811- JoinNetworkOTAA Sample
Arduino<->RAK811 Serial is Working
set work_mode failed, please reset module.
  • Code:
void setup() {
  DebugSerial.println("WisDuino Evaluation Board - RAK811- JoinNetworkOTAA Sample");
  ATSerial.begin(9600); //set ATSerial baudrate:This baud rate has to be consistent with  the baud rate of the WisNode device.
  DebugSerial.println("Arduino<->RAK811 Serial is Working");

  if(!RAKLoRa.rk_setWorkingMode(0))  //set WisNode work_mode to LoRaWAN.
    DebugSerial.println(F("set work_mode failed, please reset module."));
  RAKLoRa.rk_getVersion();  //get RAK811 firmware version
  DebugSerial.println(RAKLoRa.rk_recvData());  //print version number

  DebugSerial.println(F("Start init RAK811 parameters..."));
  if (!InitLoRaWAN())  //init LoRaWAN
    DebugSerial.println(F("Init error,please reset module.")); 

  DebugSerial.println(F("Start to join LoRaWAN..."));
  while(!RAKLoRa.rk_joinLoRaNetwork(60))  //Joining LoRaNetwork timeout 60s
    DebugSerial.println(F("Rejoin again after 5s..."));
  DebugSerial.println(F("Join LoRaWAN success"));

  if(!RAKLoRa.rk_isConfirm(0))  //set LoRa data send package type:0->unconfirm, 1->confirm
    DebugSerial.println(F("LoRa data send package set error,please reset module.")); 

bool InitLoRaWAN(void)
  if(RAKLoRa.rk_setJoinMode(JOIN_MODE))  //set join_mode:OTAA
    if(RAKLoRa.rk_setRegion(5))  //set region EU868
      if (RAKLoRa.rk_initOTAA(DevEui, AppEui, AppKey))
        DebugSerial.println(F("RAK811 init OK!"));  
        return true;    
  return false;

void loop() {
  DebugSerial.println(F("Start send data..."));
  if (RAKLoRa.rk_sendData(1, buffer))
    for (unsigned long start = millis(); millis() - start < 90000L;)
      String ret = RAKLoRa.rk_recvData();
      if(ret != NULL)
        DebugSerial.println(F("Go to Sleep."));
        RAKLoRa.rk_sleep(1);  //Set RAK811 enter sleep mode
        delay(10000);  //delay 10s
        RAKLoRa.rk_sleep(0);  //Wakeup RAK811 from sleep mode

As soon as i find a windows computer, I’ll do the other test.

I can’t validate yet on Arduino Mega. I’ll check if I can get one later.

How did you setup your DebugSerial and ATSerial? If you use the default from the library, ATSerial is configured to softwareserial that is connected to pin 10 and 11. But if you setup it to ArduinoMega hardware serial, it might work as well though I still need to validate this. It seems on your photo the TX and RX of WisNode is connected to RX1/TX1 of Arduino Mega.

Yes, i ended used the RX1/TX1 for serial communication with the RAK811 and RX/TX for debug serial, didn’t use any part of the SoftwareSerial.

#define TXpin 11   // Set the virtual serial port pins
#define RXpin 10
#define DebugSerial Serial
SoftwareSerial ATSerial(RXpin,TXpin);    // Declare a virtual serial port
#define ATSerial Serial1
#define DebugSerial Serial

I’ll get an Arduino Uno and update here of what happened.

I use 9600 on software serial with no troubles at all - and as I said, I don’t have the sketch set the work mode if I don’t have a reset line, which on newer builds, I do, just to be sure.

It’s good to hear you got some progress :100:

Also, with hardware serial, you don’t need to use 9600 baud. 115200 baud limit is only for the softwareserial library.