Arduino LMIC "OP_TXRXPEND, not sending" error in serial monitor

Hello developers,

I am using Arduino pro mini and RA-01H containing SX1276 to develop a LoRa node device. The library I am using is MCCI Arduino Lora WAN library (latest version). I successfully connected the node with the TTN and sent a payload "Hello" to the server. But the communication stopped after 1/2 successful transmission and there is an error "OP_TXRXPEND, not sending" in the serial monitor.

On the TTN side, the LORAWAN setting parameters for the node are given below

Frequency plan > ASIA 920-923 Mhz
Lorawan version >LoraWan Specification 1.0.2
Regional Parameters Version > RP001 Regional Parameters 1.0.2 revision B

my payload is simple "Hello"
I am using OTAA from the example.
my TX interval is 238 s
My Pin configuration that follows the code is given below:

SX1276----Arduino pro mini
NSS> 10
RST> 9
DIO0> 2
DIO1> 3
DIO2> LMIC_UNUSED_PIN

This is the output of the serial monitor:

Starting
Packet queued
2926: EV_JOINING
331672: EV_TXSTART
696245: EV_JOINED
netid: 55
devaddr: 6E9B539F
AppSKey: 4E-CD-43-AA-7C-4A-2A-83-90-D8-A0-D7-46-7F-10-CE
NwkSKey: 0D-5F-AA-5F-89-A5-82-3A-94-53-0F-6D-9E-7E-51-09
703499: EV_TXSTART
808562: EV_TXCOMPLETE (includes waiting for RX windows)
2763586: EV_TXSTART
OP_TXRXPEND, not sending

Here is my spreading factor details which i copied from lorabase.h file

what is the host microcontroller and how have you connected the Ra-01 to it?
have a look at https://cinterfacing-ra-01-ra-02-sx1278-lora-modules-with-esp32-using-arduino

i am using Arduino pro mini as controller and RA 01H LoRa Module
RA 01H ----Arduino pro mini
NSS> 10
RST> 9
DIO0> 2
DIO1> 3
DIO2> LMIC_UNUSED_PIN

connection looks OK - the fact that it OTTA joined shows the SPI connections is OK
just check DIO0 is conncted correctly - It is probably used the signal TX/RX sucess similar to the RFM95W
I assume you are powering the Ra-01 from the pro mini 3.3V supply - I wonder if has sufficient current output to support the Ra-01 during transmission - try a large capacitor across the 3.3V line
can you post the code using code tags </>

/*******************************************************************************
 * Copyright (c) 2015 Thomas Telkamp and Matthijs Kooijman
 * Copyright (c) 2018 Terry Moore, MCCI
 *
 * Permission is hereby granted, free of charge, to anyone
 * obtaining a copy of this document and accompanying files,
 * to do whatever they want with them without any restriction,
 * including, but not limited to, copying, modification and redistribution.
 * NO WARRANTY OF ANY KIND IS PROVIDED.
 *
 * This example sends a valid LoRaWAN packet with payload "Hello,
 * world!", using frequency and encryption settings matching those of
 * the The Things Network.
 *
 * This uses OTAA (Over-the-air activation), where where a DevEUI and
 * application key is configured, which are used in an over-the-air
 * activation procedure where a DevAddr and session keys are
 * assigned/generated for use with all further communication.
 *
 * Note: LoRaWAN per sub-band duty-cycle limitation is enforced (1% in
 * g1, 0.1% in g2), but not the TTN fair usage policy (which is probably
 * violated by this sketch when left running for longer)!

 * To use this sketch, first register your application and device with
 * the things network, to set or generate an AppEUI, DevEUI and AppKey.
 * Multiple devices can use the same AppEUI, but each device has its own
 * DevEUI and AppKey.
 *
 * Do not forget to define the radio type correctly in
 * arduino-lmic/project_config/lmic_project_config.h or from your BOARDS.txt.
 *
 *******************************************************************************/

#include <lmic.h>
#include <hal/hal.h>
#include <SPI.h>

//
// For normal use, we require that you edit the sketch to replace FILLMEIN
// with values assigned by the TTN console. However, for regression tests,
// we want to be able to compile these scripts. The regression tests define
// COMPILE_REGRESSION_TEST, and in that case we define FILLMEIN to a non-
// working but innocuous value.
//
#ifdef COMPILE_REGRESSION_TEST
# define FILLMEIN 0
#else
# warning "You must replace the values marked FILLMEIN with real values from the TTN control panel!"
# define FILLMEIN (#dont edit this, edit the lines that use FILLMEIN)
#endif

// This EUI must be in little-endian format, so least-significant-byte
// first. When copying an EUI from ttnctl output, this means to reverse
// the bytes. For TTN issued EUIs the last bytes should be 0xD5, 0xB3,
// 0x70.
static const u1_t PROGMEM APPEUI[8]={ 0xFE, 0x20, 0x40, 0x66, 0x0F, 0xEF, 0x0D, 0xD7 };
void os_getArtEui (u1_t* buf) { memcpy_P(buf, APPEUI, 8);}

// This should also be in little endian format, see above.
static const u1_t PROGMEM DEVEUI[8]={ 0x95, 0x8B, 0x05, 0xD0, 0x7E, 0xD5, 0xB3, 0x70 };
void os_getDevEui (u1_t* buf) { memcpy_P(buf, DEVEUI, 8);}

// This key should be in big endian format (or, since it is not really a
// number but a block of memory, endianness does not really apply). In
// practice, a key taken from ttnctl can be copied as-is.
static const u1_t PROGMEM APPKEY[16] = { 0x57, 0xBD, 0x38, 0x9B, 0xEE, 0xD6, 0xA7, 0x6A, 0xF1, 0x3C, 0xF5, 0x57, 0x0D, 0xB9, 0x1C, 0x6E };
void os_getDevKey (u1_t* buf) {  memcpy_P(buf, APPKEY, 16);}

static uint8_t mydata[] = "hello";
static osjob_t sendjob;

// Schedule TX every this many seconds (might become longer due to duty
// cycle limitations).
const unsigned TX_INTERVAL = 238;

// Pin mapping
const lmic_pinmap lmic_pins = {
    .nss = 10,
    .rxtx = LMIC_UNUSED_PIN,
    .rst = 9,
    .dio = {2, 3, LMIC_UNUSED_PIN},
};

void printHex2(unsigned v) {
    v &= 0xff;
    if (v < 16)
        Serial.print('0');
    Serial.print(v, HEX);
}

void onEvent (ev_t ev) {
    Serial.print(os_getTime());
    Serial.print(": ");
    switch(ev) {
        case EV_SCAN_TIMEOUT:
            Serial.println(F("EV_SCAN_TIMEOUT"));
            break;
        case EV_BEACON_FOUND:
            Serial.println(F("EV_BEACON_FOUND"));
            break;
        case EV_BEACON_MISSED:
            Serial.println(F("EV_BEACON_MISSED"));
            break;
        case EV_BEACON_TRACKED:
            Serial.println(F("EV_BEACON_TRACKED"));
            break;
        case EV_JOINING:
            Serial.println(F("EV_JOINING"));
            break;
        case EV_JOINED:
            Serial.println(F("EV_JOINED"));
            {
              u4_t netid = 0;
              devaddr_t devaddr = 0;
              u1_t nwkKey[16];
              u1_t artKey[16];
              LMIC_getSessionKeys(&netid, &devaddr, nwkKey, artKey);
              Serial.print("netid: ");
              Serial.println(netid, DEC);
              Serial.print("devaddr: ");
              Serial.println(devaddr, HEX);
              Serial.print("AppSKey: ");
              for (size_t i=0; i<sizeof(artKey); ++i) {
                if (i != 0)
                  Serial.print("-");
                printHex2(artKey[i]);
              }
              Serial.println("");
              Serial.print("NwkSKey: ");
              for (size_t i=0; i<sizeof(nwkKey); ++i) {
                      if (i != 0)
                              Serial.print("-");
                      printHex2(nwkKey[i]);
              }
              Serial.println();
            }
            // Disable link check validation (automatically enabled
            // during join, but because slow data rates change max TX
	    // size, we don't use it in this example.
            LMIC_setLinkCheckMode(0);
            break;
        /*
        || This event is defined but not used in the code. No
        || point in wasting codespace on it.
        ||
        || case EV_RFU1:
        ||     Serial.println(F("EV_RFU1"));
        ||     break;
        */
        case EV_JOIN_FAILED:
            Serial.println(F("EV_JOIN_FAILED"));
            break;
        case EV_REJOIN_FAILED:
            Serial.println(F("EV_REJOIN_FAILED"));
            break;
        case EV_TXCOMPLETE:
            Serial.println(F("EV_TXCOMPLETE (includes waiting for RX windows)"));
            
            if (LMIC.txrxFlags & TXRX_ACK)
              Serial.println(F("Received ack"));
            if (LMIC.dataLen) {
              Serial.print(F("Received "));
              Serial.print(LMIC.dataLen);
              Serial.println(F(" bytes of payload"));
            }
            // Schedule next transmission
            os_setTimedCallback(&sendjob, os_getTime()+sec2osticks(TX_INTERVAL), do_send);
            break;
        case EV_LOST_TSYNC:
            Serial.println(F("EV_LOST_TSYNC"));
            break;
        case EV_RESET:
            Serial.println(F("EV_RESET"));
            break;
        case EV_RXCOMPLETE:
            // data received in ping slot
            Serial.println(F("EV_RXCOMPLETE"));
            break;
        case EV_LINK_DEAD:
            Serial.println(F("EV_LINK_DEAD"));
            break;
        case EV_LINK_ALIVE:
            Serial.println(F("EV_LINK_ALIVE"));
            break;
        /*
        || This event is defined but not used in the code. No
        || point in wasting codespace on it.
        ||
        || case EV_SCAN_FOUND:
        ||    Serial.println(F("EV_SCAN_FOUND"));
        ||    break;
        */
        case EV_TXSTART:
            Serial.println(F("EV_TXSTART"));
            break;
        case EV_TXCANCELED:
            Serial.println(F("EV_TXCANCELED"));
            break;
        case EV_RXSTART:
            /* do not print anything -- it wrecks timing */
            break;
        case EV_JOIN_TXCOMPLETE:
            Serial.println(F("EV_JOIN_TXCOMPLETE: no JoinAccept"));
            break;

        default:
            Serial.print(F("Unknown event: "));
            Serial.println((unsigned) ev);
            break;
    }
}

void do_send(osjob_t* j){
    // Check if there is not a current TX/RX job running
    if (LMIC.opmode & OP_TXRXPEND) {
        Serial.println(F("OP_TXRXPEND, not sending"));
    } else {
        // Prepare upstream data transmission at the next possible time.
        LMIC_setTxData2(1, mydata, sizeof(mydata)-1, 0);
        Serial.println(F("Packet queued"));
    }
    // Next TX is scheduled after TX_COMPLETE event.
}

void setup() {
    Serial.begin(9600);
    Serial.println(F("Starting"));

    #ifdef VCC_ENABLE
    // For Pinoccio Scout boards
    pinMode(VCC_ENABLE, OUTPUT);
    digitalWrite(VCC_ENABLE, HIGH);
    delay(1000);
    #endif

    // LMIC init
    os_init();
    // Reset the MAC state. Session and pending data transfers will be discarded.
    LMIC_reset();

    // Start job (sending automatically starts OTAA too)
    do_send(&sendjob);
}

void loop() {
    os_runloop_once();
}

what frequency are you using?

I don't have a Ra-01 but as a test I connected a Arduino Pro Mini 3.3V to a Lora/GPS HAT which has a RFM95W (with SX1276/SX1278 transceiver) which communicates with the host microcontrooller using SPI (similar to Ra-01)
tested with Examples>MCCI_LoRaWAN_LMIC_library>ttn-otaa-feather-us915 modified to use the pro mini pins and 868MHz frequency - connections

// Lora/GPS HAT connected to Arduino pro mini
// Lora hat 3.3v to pro_mini VCC 3.3V
// Lora hat GND  to pro_mini  GND
// Lora hat MOSI to pro_mini  MOSI pin 11
// Lora hat MISO to pro_mini  MISO pin 12
// Lora hat SCK  to pro_mini  SCK  pin 13
// Lora hat NSS  to pro_mini  pin 10
// Lora hat DIO0 to pro_mini  pin 2
// Lora hat DIO1 to pro_mini  pin 3
// Lora Hat Lora Reset to pro_mini  pin 4

const lmic_pinmap lmic_pins = {  
   .nss = 10,
   .rxtx = LMIC_UNUSED_PIN,
   .rst = 4,  
   .dio = {2,3,LMIC_UNUSED_PIN}, //DIO0, DIO1 connected
};

works OK connecting to TTN V3 server uplinking and downlinking data
serial monitor displays

884851: EV_JOINED
netid: 19
devaddr: 260B5826
AppSKey: xxxxxxxxxxxxxxxxxx
NwkSKey: xxxxxxxxxxxxxxxxxxxxxxxxxxxx
886488: EV_TXSTART
1205586: EV_TXCOMPLETE (includes waiting for RX windows)
1303076: EV_TXSTART
1684639: EV_TXCOMPLETE (includes waiting for RX windows)
5435623: EV_TXSTART
Packet queued 32
5824660: EV_TXCOMPLETE (includes waiting for RX windows)
Received 4 bytes of payload
Data Received:  0x11 0x22 0x33 0x44  in ASCII = "3D
9576014: EV_TXSTART
Packet queued 33
9958691: EV_TXCOMPLETE (includes waiting for RX windows)
13709674: EV_TXSTART
Packet queued 34
14092358: EV_TXCOMPLETE (includes waiting for RX windows)
17843343: EV_TXSTART
Packet queued 35
18226027: EV_TXCOMPLETE (includes waiting for RX windows)
21977177: EV_TXSTART
Packet queued 36
22359860: EV_TXCOMPLETE (includes waiting for RX windows)
26110850: EV_TXSTART
Packet queued 37
26430943: EV_TXCOMPLETE (includes waiting for RX windows)
Received 9 bytes of payload
Data Received:  0x99 0x88 0x77 0x66 0x55 0x44 0x33 0x22 0x11  in ASCII = ��wfUD3"
30182478: EV_TXSTART
Packet queued 38
30565162: EV_TXCOMPLETE (includes waiting for RX windows)

will try it with your code of post 5

Edit: updated your code of post 5 editing APPKEY etc, setting frequency to 868MHz
connects to TTN V3 OK uplinking and downlinking
serial monitor displays

Starting
CFG_eu868
Packet queued
2854: EV_JOINING
240129: EV_TXSTART
561216: EV_JOINED
netid: 19
devaddr: 260BB204
AppSKey: 3E-0B-28-C9-63-FE-F9-5F-BF-A8-52-EB-C0-F4-20-0D
NwkSKey: 6F-FD-D6-4F-9A-88-49-CD-6B-5A-0A-40-42-C2-A2-07
562664: EV_TXSTART
944374: EV_TXCOMPLETE (includes waiting for RX windows)
15820344: EV_TXSTART
Packet queued
16138981: EV_TXCOMPLETE (includes waiting for RX windows)
Received 3 bytes of payload
31014873: EV_TXSTART
Packet queued
31396594: EV_TXCOMPLETE (includes waiting for RX windows)

and the TTN displays

no idea what is causing your OP_TXRXPEND - try a web search for OP_TXRXPEND ?

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.