forked from sbiermann/Lora-TTNMapper-ESP32
-
Notifications
You must be signed in to change notification settings - Fork 46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
OTAA activation not working on TTN #22
Comments
OTAA is confirmed not working: #21 (comment) only ABP ! |
Yeah indeed, does somebody has an answer to the code? |
Hum not sure to understand what is your problem as you stated it works fine in ABP mode no ? Which version of board do you have ? mine is 1.1 and not working with that code (no TTN connection and OLED display doesn't work too :( |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi,
when i am activating over OTAA the Activation frame gets recognized, but the payload frames are not transmitted because it's not connected on the TTN network. APB activation does work without any problems.
Theory, does the low RSSI of -119 mean something?
Here you can find my code.
`
#include <HardwareSerial.h>
#include <TinyGPS++.h>
#include <lmic.h>
#include <hal/hal.h>
#include <SPI.h>
#include "WiFi.h"
#include <CayenneLPP.h>
#define BUILTIN_LED 25
char s[32]; // used to sprintf for Serial output
TinyGPSPlus gps;
static u1_t DEVEUI[8] = {0xF3, 0x4B, 0x37, 0x43, 0x98, 0x3B, 0xAC, 0x00};
static u1_t APPEUI[8] = {0x9C, 0x03, 0x03, 0xD0, 0x7E, 0xD5, 0xB3, 0x70};
static u1_t APPKEY[16] = {0x71, 0x3B, 0x80, 0x81, 0xB0, 0xA1, 0x7A, 0xEA, 0x5D, 0xD8, 0xBA, 0xCC, 0xCF, 0x13, 0xE6, 0x10};
RTC_NOINIT_ATTR int RTCseqnoUp, RTCseqnoDn;
RTC_NOINIT_ATTR u4_t otaaDevAddr;
RTC_NOINIT_ATTR u1_t otaaNetwKey[16];
RTC_NOINIT_ATTR u1_t otaaApRtKey[16];
void os_getDevEui(u1_t *buf)
{
memcpy_P(buf, DEVEUI, 8);
}
void os_getArtEui(u1_t *buf) { memcpy_P(buf, APPEUI, 8); }
void os_getDevKey(u1_t *buf) { memcpy_P(buf, APPKEY, 16); }
static osjob_t sendjob;
const unsigned TX_INTERVAL = 30;
const lmic_pinmap lmic_pins = {
.nss = 18,
.rxtx = LMIC_UNUSED_PIN,
.rst = 14,
.dio = {26, 33, 32},
};
unsigned long last_update = 0;
String toLog;
uint8_t txBuffer[] = "Hey mo alles goed.";
void storeFrameCounters()
{
RTCseqnoUp = LMIC.seqnoUp;
RTCseqnoDn = LMIC.seqnoDn;
sprintf(s, "Counters stored as %d/%d", LMIC.seqnoUp, LMIC.seqnoDn);
Serial.println(s);
}
void restoreFrameCounters()
{
LMIC.seqnoUp = RTCseqnoUp;
LMIC.seqnoDn = RTCseqnoDn;
sprintf(s, "Restored counters as %d/%d", LMIC.seqnoUp, LMIC.seqnoDn);
Serial.println(s);
}
void setOrRestorePersistentCounters()
{
esp_reset_reason_t reason = esp_reset_reason();
if ((reason != ESP_RST_DEEPSLEEP) && (reason != ESP_RST_SW))
{
Serial.println(F("Counters both set to 0"));
LMIC.seqnoUp = 0;
LMIC.seqnoDn = 0;
}
else
{
restoreFrameCounters();
}
}
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
{
}
void onEvent(ev_t ev)
{
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"));
// Disable link check validation (automatically enabled
// during join, but not supported by TTN at this time).
LMIC_setLinkCheckMode(0);
break;
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;
break;
case EV_TXCOMPLETE:
Serial.println(F("EV_TXCOMPLETE (includes waiting for RX windows)"));
digitalWrite(BUILTIN_LED, LOW);
if (LMIC.txrxFlags & TXRX_ACK)
{
Serial.println(F("Received ack"));
}
if (LMIC.dataLen)
{
Serial.println(F("Received "));
Serial.println(LMIC.dataLen);
Serial.println(F(" bytes of payload"));
}
storeFrameCounters();
}
void setup()
{
Serial.begin(115200);
//Turn off WiFi and Bluetooth
WiFi.mode(WIFI_OFF);
btStop();
}
void loop()
{
os_runloop_once();
}`
The text was updated successfully, but these errors were encountered: