Lms_send fail - causes and how to recover? RAK4631

Hi, I finally got my RAK4631 to integrate with the Helium network and packets are traveling through the Helium console into my google spreadsheet. Unfortunately after sending between 10 - 200 good packets of data I get the lms_send fail messages which continue until I restart the unit.

I’ve tried several different data rates and power levels, some are stable longer than others but always within a few hours the system enters a failing lms_send state. Any hints on how to determine root cause of the issue, and/or how to recover after a failure occurs. I’m sending out packets about every 20 seconds, which are 13 bytes in length, basic environmental sensor readings (temp, pressure, humidity and gas level).

As always, thanks in advance for all the great advice I get from forum users/admins!! :heart_eyes:

Below are some of my config values:

//#define LORAWAN_DATERATE DR_3 /LoRaMac datarates definition, from DR_0 to DR_5/

//#define LORAWAN_DATERATE DR_0 /LoRaMac datarates definition, from DR_0 to DR_5/

//#define LORAWAN_TX_POWER TX_POWER_5 /LoRaMac tx power definition, from TX_POWER_0 to TX_POWER_15/


#define JOINREQ_NBTRIALS 3 /**< Number of trials for the join request. */

DeviceClass_t g_CurrentClass = CLASS_A; /* class definition*/

LoRaMacRegion_t g_CurrentRegion = LORAMAC_REGION_US915;

//LoRaMacRegion_t g_CurrentRegion = LORAMAC_REGION_EU868; /* Region:EU868*/

lmh_confirm g_CurrentConfirm = LMH_CONFIRMED_MSG; /* confirm/unconfirm packet definition*/

uint8_t gAppPort = LORAWAN_APP_PORT; /* data port*/

/**@brief Structure containing LoRaWan parameters, needed for lmh_init()



Hello Frank,

Which example code are you using? Is it from our WisBlock repo?
What is the version of the SX126x-Arduino library. It should be V2.0.11
What is the version of the RAK4631 Arduino BSP? It should be V1.0.1

I have a WisBlock running and sending a packet every 5 minutes since November 2021 without any problems.

Hi @beegee :slight_smile:

I just setup Platform IO on a brand new PC with fresh install of Win10. I haven’t installed the Arduino IDE as it everything seems to work using just Platform IO (and so much better/faster etc without the Arduino IDE installed I might add).

Yes, basically running the code from the Wisblock repo.

Where do I find the RAK4631 Arduino BSP version? I’ve combed through the files and am not seeing this referenced (although I’m sure its there somewhere).

Below are some of the values I found from the compile output.


CONFIGURATION: https://docs.platformio.org/page/boards/nordicnrf52/wiscore_rak4631.html
PLATFORM: Nordic nRF52 (9.2.0) > WisCore RAK4631 Board
HARDWARE: NRF52840 64MHz, 243KB RAM, 796KB Flash
DEBUG: Current (jlink) External (jlink, stlink)

  • framework-arduinoadafruitnrf52 1.10200.0 (1.2.0)
  • framework-cmsis 2.50700.210515 (5.7.0)
  • tool-adafruit-nrfutil 1.503.0 (5.3)
  • tool-sreccat 1.164.0 (1.64)
  • toolchain-gccarmnoneeabi 1.70201.0 (7.2.1)
    LDF: Library Dependency Finder → Library Dependency Finder (LDF) — PlatformIO latest documentation
    LDF Modes: Finder ~ chain, Compatibility ~ soft
    Found 19 compatible libraries
    Scanning dependencies…
    Dependency Graph
    |-- SX126x-Arduino 2.0.10
    | |-- SPI 1.0
    | | |-- Adafruit TinyUSB Library
    |-- Adafruit BME680 Library 2.0.1
    | |-- Adafruit BusIO 1.11.2
    | | |-- Wire 1.0
    | | | |-- Adafruit TinyUSB Library
    | | |-- SPI 1.0
    | | | |-- Adafruit TinyUSB Library
    | |-- Wire 1.0
    | | |-- <Adafruit TinyUSB Library
    | |-- SPI 1.0
    | | |-- Adafruit TinyUSB Library
    | |-- Adafruit Unified Sensor 1.1.5
    |-- Adafruit Unified Sensor 1.1.5
    |-- SPI 1.0
    | |-- Adafruit TinyUSB Library
    |-- 1.0
    | |-- Adafruit TinyUSB Library
    Building in release mode

Ah, I didn’t know you are using PlatformIO. Then it would be the Nordic nRF52 platform version 9.2.0, that’s what I am running and that’s what I see in your configuration.

Can you change the send part from

	lmh_error_status error = lmh_send(&m_lora_app_data, g_CurrentConfirm);
	if (error == LMH_SUCCESS)
		Serial.printf("lmh_send ok count %d\n", count);
		Serial.printf("lmh_send fail count %d\n", count_fail);


	lmh_error_status error = lmh_send(&m_lora_app_data, g_CurrentConfirm);
	switch (error)
		Serial.printf("lmh_send ok count %d\n", count);
	case LMH_BUSY:
		Serial.printf("lmh_send fail <BUSY> count %d\n", count_fail);
	case LMH_ERROR:
		Serial.printf("lmh_send fail <SIZE_ERROR> count %d\n", count_fail);

That will give more info about the error occured.

And can you try to switch

lmh_confirm g_CurrentConfirm = LMH_CONFIRMED_MSG


lmh_confirm g_CurrentConfirm = LMH_UNCONFIRMED_MSG

Not sure what’s happening.

Good news:
Sending frame now…
lmh_send ok count 2190

lmh_confirm g_CurrentConfirm = LMH_UNCONFIRMED_MSG seems to have made the difference. I’m curious as to why turning off confirmations suddenly made it work flawlessly?

I may try LORAWAN_ADR_ON to see if that works as I might hope.

Thank you (again) @beegee :heartbeat: