Join accepted but nothing else

fweijers
Tue, 25 Mar 2025 21:50:11 +0000
Hardware

Hi there
I am using a Heltec CubeCell-Board（HTCC-AB01)
I successfully sent a message to the TTN network, I see my message in the console but nothing afterwards (no webhook is called).
According to CHATGPT my node continually tries to join, this request is correctly received bij TTN, but the Join Accept is not sent, received or processed correctly by my node.

Here is my TTN logging (json export)
And I have my code below.

TTN export:

{
    "name": "as.up.join.forward",
    "time": "2025-03-25T21:10:00.263607529Z",
    "identifiers": [
      {
        "device_ids": {
          "device_id": "heltec",
          "application_ids": {
            "application_id": "boat-readings"
          },
          "dev_eui": "0700B30D5xxxx00",
          "join_eui": "AA2EAC40xxxx8701",
          "dev_addr": "260xxxx51"
        }
      }
    ],
    "data": {
      "@type": "type.googleapis.com/ttn.lorawan.v3.ApplicationUp",
      "end_device_ids": {
        "device_id": "heltec",
        "application_ids": {
          "application_id": "boat-readings"
        },
        "dev_eui": "0700B30DxxxxxD00",
        "join_eui": "AA2EAC4xxxxx88701",
        "dev_addr": "260xxxx51"
      },
      "correlation_ids": [
        "gs:uplink:01JQ7J80GS42MxxxxY0TNRH"
      ],
      "received_at": "2025-03-25T21:10:00.240180261Z",
      "join_accept": {
        "session_key_id": "AZXPJxxxxs9wG+XxL0bA==",
        "received_at": "2025-03-25T21:09:58.426314320Z"
      }
    },
    "correlation_ids": [
      "gs:uplink:01JQ7J80GS42M8xxxxxY0TNRH"
    ],
    "origin": "ip-10-100-12-124.eu-west-1.compute.internal",
    "context": {
      "tenant-id": "CgN0dG4="
    },
    "visibility": {
      "rights": [
        "RIGHT_APPLICATION_TRAFFIC_READ"
      ]
    },
    "unique_id": "01JQ7J82Axxxxx9PBP46TBFE"
  },
  {
    "name": "ns.up.join.process",
    "time": "2025-03-25T21:09:58.633216679Z",
    "identifiers": [
      {
        "device_ids": {
          "device_id": "heltec",
          "application_ids": {
            "application_id": "boat-readings"
          },
          "dev_eui": "0700B30xxxxxD00",
          "join_eui": "AA2EAC4054xxxxxxx01",
          "dev_addr": "260Bxxxx"
        }
      }
    ],
    "data": {
      "@type": "type.googleapis.com/ttn.lorawan.v3.UplinkMessage",
      "raw_payload": "AAGHuFRArC6xxxxxAAfIm0x5rtE=",
      "payload": {
        "m_hdr": {},
        "mic": "THmu0Q==",
        "join_request_payload": {
          "join_eui": "AA2EAC40xxxxx1",
          "dev_eui": "0700B30DxxxxD00",
          "dev_nonce": "9BC8"
        }
      },
      "settings": {
        "data_rate": {
          "lora": {
            "bandwidth": 125000,
            "spreading_factor": 7,
            "coding_rate": "4/5"
          }
        },
        "frequency": "868100000",
        "timestamp": 4023655843,
        "time": "2025-03-25T21:09:48.406743049Z"
      },
      "rx_metadata": [
        {
          "gateway_ids": {
            "gateway_id": "ttn-gw-nieuwvennep",
            "eui": "B827EBxxxxx16473"
          },
          "time": "2025-03-25T21:09:48.406743049Z",
          "timestamp": 4023655843,
          "rssi": -117,
          "channel_rssi": -117,
          "snr": -0.25,
          "location": {
            "latitude": 52.2673550827753,
            "longitude": 4.62064858520747,
            "source": "SOURCE_REGISTRY"
          },
          "uplink_token": "CiAKHgoSdHRuLWd3LW5pZXVxxxxxx/mFkcxCju9D+DhoMCKa3jL8GExxxx6SN5Fk=",
          "received_at": "2025-03-25T21:09:58.409923299Z"
        }
      ],
      "recei

Mycode:

#include <LoRaWan_APP.h>
#include <Arduino.h>
#include <Seeed_BME280.h>
#include <Wire.h>
#include "ttnparams.h"


uint32_t appTxDutyCycle = 300000; // the frequency of readings, in milliseconds(set 300s)

uint16_t userChannelsMask[6]={ 0x00FF,0x0000,0x0000,0x0000,0x0000,0x0000 };
LoRaMacRegion_t loraWanRegion = ACTIVE_REGION;
DeviceClass_t  loraWanClass = LORAWAN_CLASS;
bool overTheAirActivation = LORAWAN_NETMODE;
bool loraWanAdr = LORAWAN_ADR;
bool keepNet = LORAWAN_NET_RESERVE;
//bool isTxConfirmed = LORAWAN_UPLINKMODE;
bool isTxConfirmed = true;

uint8_t appPort = 2;
uint8_t confirmedNbTrials = 4;

int temperature, humidity, batteryVoltage, batteryLevel;
long pressure;

BME280 bme280;

static void prepareTxFrame( uint8_t port )
{
  // This enables the output to power the sensor
  pinMode(Vext, OUTPUT);
  digitalWrite(Vext, LOW);
  delay(500);

  if(!bme280.init()){

      Serial.println("Device error!");

  }

  // This delay is required to allow the sensor time to init
  delay(1000);

  temperature = bme280.getTemperature() * 100;
  humidity = bme280.getHumidity();
  pressure = bme280.getPressure();

  Wire.end();

  // Turn the power to the sensor off again
  digitalWrite(Vext, HIGH);

  batteryVoltage = getBatteryVoltage();
  batteryLevel = (BoardGetBatteryLevel() * 100) / 254;


  appDataSize = 12;
  appData[0] = highByte(temperature);
  appData[1] = lowByte(temperature);

  appData[2] = highByte(humidity);
  appData[3] = lowByte(humidity);

  appData[4] = (byte) ((pressure & 0xFF000000) >> 24 );
  appData[5] = (byte) ((pressure & 0x00FF0000) >> 16 );
  appData[6] = (byte) ((pressure & 0x0000FF00) >> 8  );
  appData[7] = (byte) ((pressure & 0X000000FF)       );

  appData[8] = highByte(batteryVoltage);
  appData[9] = lowByte(batteryVoltage);

  appData[10] = highByte(batteryLevel);
  appData[11] = lowByte(batteryLevel);


    Serial.print("Temperature: ");
    Serial.print(temperature / 100);
    Serial.print("C, Humidity: ");
    Serial.print(humidity);
    Serial.print("%, Pressure: ");
    Serial.print(pressure / 100);
    Serial.print(" mbar, Battery Voltage: ");
    Serial.print(batteryVoltage);
    Serial.print(" mV, Battery Level: ");
    Serial.print(batteryLevel);
    Serial.println(" %");

}



void McpsIndication(McpsIndication_t *mcpsIndication) {
    Serial.println("Incoming LoRa packet detected!");
    if (mcpsIndication->Status != LORAMAC_EVENT_INFO_STATUS_OK) {
        Serial.println("Uplink failed!");
        return;
    }
    Serial.println("Uplink successfully received by TTN!");
}


void setup()
{
    boardInitMcu();  // Initialiseer de Heltec board MCU

    Serial.begin(115200);
    delay(2000);  // Wacht even zodat de serial monitor goed opstart

    LoRaWAN.ifskipjoin();  // Controleert of join moet worden overgeslagen

    deviceState = DEVICE_STATE_INIT;
}


void loop()
{
  switch( deviceState )
  {
    case DEVICE_STATE_INIT:
    {
      printDevParam();
      LoRaWAN.init(loraWanClass,loraWanRegion);
      deviceState = DEVICE_STATE_JOIN;
      break;
    }
    case DEVICE_STATE_JOIN:
    {
      LoRaWAN.join();
      Serial.println("Trying to join TTN...");
      LoRaWAN.setDataRateForNoADR(3); // Stel RX2 in op SF9BW125 (betere ontvangst)
      break;
    }
    case DEVICE_STATE_SEND:
    {
      prepareTxFrame( appPort );
      Serial.println("Sending data...");
      LoRaWAN.send();
      deviceState = DEVICE_STATE_CYCLE;
      break;
    }
    case DEVICE_STATE_CYCLE:
    {
      // Schedule next packet transmission
      txDutyCycleTime = appTxDutyCycle + randr( 0, APP_TX_DUTYCYCLE_RND );
      LoRaWAN.cycle(txDutyCycleTime);
      deviceState = DEVICE_STATE_SLEEP;
      break;
    }
    case DEVICE_STATE_SLEEP:
    {
      LoRaWAN.sleep();
      break;
    }
    default:
    {
      deviceState = DEVICE_STATE_INIT;
      break;
    }
  }
}

16 posts - 3 participants