RAK3172-T not responding after 4 days

Hi Everyone,

Greetings,

We have recently purchased the new RAK3172**-T** modules. Three of them were already onsite at our client. I have noticed that after 4 days of continuous operations, all the 3 RAK3172-T modules stopped working (nearly at the same time). The modules have the same firmware and use the same code based on RUI3 API. Below are the device parameters.

  • Lorawan, EU868
  • ADR - ON
  • DR - defined by the network
  • Default module tx power.
  • send messages based on events.

21:31:36.503 → AT+SN=AC1F09FFFE0AED44
21:31:36.503 → OK
21:31:44.583 → AT+VER=RUI_4.0.5_RAK3172-T
21:31:44.583 → OK
21:31:50.384 → AT+CLIVER=1.5.10
21:31:50.384 → OK
21:31:56.155 → AT+APIVER=3.2.6
21:31:56.155 → OK
21:32:03.803 → AT+HWMODEL=rak3172T
21:32:03.803 → OK
21:32:12.530 → AT+HWID=stm32wle5xx
21:32:12.530 → OK
21:32:21.681 → AT+BOOTVER=RUI_BOOT_0.7_STM32WLE5CC
21:32:21.681 → OK

On Arduino IDE: *Additional Board Manager URLS:

https://raw.githubusercontent.com/RAKWireless/RAKwireless-Arduino-BSP-Index/main/package_rakwireless.com_rui_index.json*

I was onsite today to intervene, I tried resetting the module with No success. I then powerOFF and then powerON the device and only this time the RAK3172-T was able to connect to TTN.

Note: I have already deployed some of the devices in different locations it’s been 2 days already, and 1 of them already stopped working.

I don’t know if this is related to Timer Mode, correct me if wrong, code as shown below.

unsigned long TIME_INTERVAL=1800000;

    if(api.system.timer.create(RAK_TIMER_0, (RAK_TIMER_HANDLER)heartBeat, RAK_TIMER_PERIODIC) != true){Serial.printf("LoRaWan- Creating timer failed.\r\n");return;}
    if(api.system.timer.start(RAK_TIMER_0, TIME_INTERVAL, NULL) != true){Serial.printf("LoRaWan- Starting timer failed.\r\n");return;}

Can someone please shed some light on this issue.

Thanks,

Hi @Avishek

Can I have a few more details?
I guess the RAK3172-T is running as stand-alone MCU on a custom PCB?

Can you share more details of your code? You say event driven, so I guess your loop() is empty?
Is it only waking up on the timer events or are there other events that can wake up the device (external interrupts)?

I have multiple RAK3172 (not -T) running for weeks only waking up by external interrupt (door open/close) and timer. I will try to run a test with your 30 minutes timer settings.

The firmware of the RAK3172 and RAK3172-T are basically the same, the difference is only in the setup for TCXO and oscillator.

Your timer setup looks ok, I don’t see a problem there.

Test started. System is only waking up on timer events. Same type of timer call, set to 30 minutes interval.

2 Likes

Hi Bernd,

Greetings, thanks for your swift response as usual :slightly_smiling_face:

Yes, you are right, the RAK3172-T module is running as standalone (without a host MCU) on a custom PCB.

I am using both the timer and external interrupt, but my devices are configured as class C which is always ON. so in my case there is no wake-up from deep sleep.

I don’t have much in the loop() it is very simple. below is the extract of the loop().

unsigned long TIME_INTERVAL=1800000;

void interruptEvent(){
  mcp23017_interruptCounter=mcp23017_interruptCounter+1;
  mcp23017_pinAB_next=get_InterruptPin();
  clear_Interrupt();
}

void setup(){
  /*
  Variable declaration has been removed
  */
    if(api.system.timer.create(RAK_TIMER_0, (RAK_TIMER_HANDLER)heartBeat, RAK_TIMER_PERIODIC) != true){Serial.printf("LoRaWan- Creating timer failed.\r\n");return;}
    if(api.system.timer.start(RAK_TIMER_0, TIME_INTERVAL, NULL) != true){Serial.printf("LoRaWan- Starting timer failed.\r\n");return;}
}

void loop(){
  new_int_counter=mcp23017_interruptCounter;
  new_pinAB=mcp23017_pinAB_next;
  
  while(new_int_counter!=0){
    Serial.printf("DBG> Counter: %d\n\r",new_int_counter);
    new_int_counter=new_int_counter-1;
    mcp23017_interruptCounter=mcp23017_interruptCounter-1;
    if(mcp23017_pinAB_prev!=new_pinAB){
      mcp23017_pinAB_prev=new_pinAB;
      construct_lora_pkt(0x03); //prepare payload to be sent
      api.lorawan.send(sizeof(lora_payload), lora_payload, 129,true, 4);
      //sent_flag=false;
    //while(sent_flag==false){}
    delay(10000);   
    }else{Serial.println("DBG> --same");}
  }
}

Many thanks,
Best Regards,

Hi Bernd,

I have other devices in remote site already facing this issue. see snapshot below 2 devices are already having this issue.

I have also set a device under test on my side.

Thanks,

Hi Bernd,

Greetings and Good day,

I am constantly monitoring the same on my side, see the below snapshot I have another device that is currently down after 4 days of continuous operation (it’s been 2 hours since the device is down).

Thanks,
Best Regards,

My RAK3172 was sending the last 4 days without problems. But I had to take it down today for another test.

I should get some RAK3172-T modules.

But I can as well test only on AS923-3, I have no working EU868 setup at the moment. It might be related to the LoRaWAN region.

I was thinking it might be the DutyCycle limitation in EU868, but with your send interval of 1800 ms that should be not the problem.

When the devices stop sending, can you still access them over UART with AT commands?

1 Like

@Avishek I think I am experiencing the same problem as you do with the RAK3172. I had mine not respond after 156 cycles (4 minutes) and I am 90% sure that the timer failed to create or start.

In my application, I am using 2 timers with fixed IDs to run

  1. A periodic sample timer at 100 Hz
  2. A one shot sampling duration timer with 60 seconds duration
    Both set a flag in ISR which gets processed by the main loop.

Additionally, I added a blink of the LED in the main loop.

What I observed is a blinking LED that lasts longer than 60 seconds and no output on Serial from the periodic sampling timer. Looks like the flags are never set and the system is stuck in the main loop.

I implemented some retry and recovery logic now. Hopefully this fixes the problem.

Welcome to the forum @TomStein

Is your code based on RUI3 API or STM32CubeIDE?

If RUI3, what RUI3 version do you use?

Can you share your code?

Hey @beegee,

I am using RUI3 Firmware version 4.2.0 with the following setup with PlatformIO:

[env:rak3172_evalboard]
platform = https://github.com/maxgerhardt/platform-ststm32.git#rak3172
board = rak3172_evalboard
framework = arduino
monitor_speed = 115200
lib_deps = 
	beegee-tokyo/RAKwireless RAK12034@^1.0.0
	adafruit/SdFat - Adafruit Fork@^2.2.54

; additional compiler flags like DREGION_EU868
build_flags = 
	-DREGION_EU868
	-DSUPPORT_LORA
	-DCFG_DEBUG=0

Let me gather some more insights on this problem. If there is a problem at all. Maybe I am doing something wrong here and some other wakeup source is causing this problem.
I am working on removing as much as possible to make a minimal example.

Hello Tom,

You are NOT using RUI3, you are using STM32 Arduino framework.

platform = https://github.com/maxgerhardt/platform-ststm32.git#rak3172

RUI3 BSP is not supported by PlatformIO. If you want to use VSC to write code, you need VSC + Arduino Extension. Guide is in our Documentation Center

Hi @beegee,

I see what you mean but from my understanding this is RAK RUI3. After all I am using the rui3 api in my code.

maxgerhardt did some things to make RUI3 work with PIO:

  1. forked the maxgerhardt/RAK-STM32-RUI core, wrote a builder and ymodem upload script for PIO
  2. integrated the RAK3172 evaluation board into pio boards list Comparing platformio:develop...maxgerhardt:rak3172 · platformio/platform-ststm32 · GitHub

So this is all based on a recent (latest) version of RAKWireless/RAK-STM32-RUI. Please correct me if I am wrong.

However, he specified some build flags here and there -DLORA_STACK_104 -DLORA_IO_SPI_PORT=2 -DSYS_RTC_COUNTER_PORT=2 -DATCMD_CUST_TABLE_SIZE=64 -DWAN_TYPE=0 -DLORA_STACK_VER=0x040700 -DSOFT_SE -DSECURE_ELEMENT_PRE_PROVISIONED -DLORAMAC_CLASSB_ENABLED -DSUPPORT_SPI -DSUPPORT_AT -DRUI_SDK" which I still need to check.

Not sure what Max is doing, he never asked for support for this.

I will give it a try.

1 Like

Installed.
Seems Max is doing a great job here.

Back to your problem @TomStein, The RUI3 timers may have a problem with 100Hz (10ms if I didn’t forget the conversion function).

There was another discussion about timer limitations here in the forum ==> Limitations on RUI3 Timers

Max’s work looks like a good toolchain for PlatformIO but work in progress (I guess?).

I deployed a node with RAK3172 and RUI3 4.2.0 on it which has been running fine for a week.

I could not investigate this issue any further. I am using this code right now to retry timer creation and starting. Although, I don’t know if it is actually being used or not since I did not integrate monitoring for this.

void createAndStartTimerWithRetries(RAK_TIMER_ID timerID, RAK_TIMER_HANDLER handler, RAK_TIMER_MODE type, uint32_t period, void *arg)
{
    const int maxRetries = 5;     // Maximum number of retry attempts
    const int retryDelayMs = 100; // Delay between retries in milliseconds
    int retryCount = 0;           // Current retry attempt
    bool timerStarted = false;    // Flag to track success

    while (retryCount < maxRetries && !timerStarted)
    {
        // Attempt to create the timer
        if (api.system.timer.create(timerID, handler, type) == true)
        {
            // Attempt to start the timer
            if (api.system.timer.start(timerID, period, arg) == true)
            {
                timerStarted = true; // Success, exit the loop
            }
            else
            {
                Serialport.printf("[%d] Starting timer #%d failed on attempt %d.\n",
                                  millis(), timerID, retryCount + 1);
                // If start fails, the timer will be recreated on the next iteration
            }
        }
        else
        {
            Serialport.printf("[%d] Creating timer #%d failed on attempt %d.\n",
                              millis(), timerID, retryCount + 1);
        }

        if (!timerStarted)
        {
            retryCount++;
            if (retryCount < maxRetries)
            {
                delay(retryDelayMs); // Wait before the next attempt
            }
        }
    }

    // Check if all retries failed
    if (!timerStarted)
    {
        Serialport.printf("[%d] Failed to create and start timer #%d after %d attempts. Rebooting...\n",
                          millis(), timerID, maxRetries);
        Serialport.flush();
        delay(100);
        api.system.reboot(); // Reboot the system
    }
}