Vraag

no JoinAccept probleem Adafruit Feather M0 RFM95 LoRa Radio - 900 MHz

  • 1 December 2022
  • 8 reacties
  • 110 keer bekeken

 Dag ,

Om te starten ik ben redelijk nieuw tot IOT. Maar wil er meer ervaring mee opdoen voor een interne PoC om apparaat onderhoud te voorspellen.

Ik heb een Adafruit Feather M0 RFM95 LoRa - 900 MHz hier liggen maar krijg deze niet verbonden met KPN IOT.

Kan iemand mij een stappen plan geven wat er moet uitgevoerd worden om dit succesvol te maken.

Wat ik toe nu toe heb gedaan:

  •  ik heb een draad verbinding gemaakt tussen io1 en pin 6 en een 82mm ant aangesloten
  • Device bij de KPN IOT hub aangemaakt
  • in adruino heb ik een sketch gebruikt welke van de LMIC library komt
  • ik heb de appeui , deveui en appkey aangepast in de sketch
  • ik heb in de lmic_project_config.h aangepast naar #define CFG_eu868 1

Als ik de sketch upload dan krijg in onderstaande debug output

Starting
Packet queued
314783: EV_JOINING
524020: EV_TXSTART
917816: EV_JOIN_TXCOMPLETE: no JoinAccept
4632366: EV_TXSTART
5026163: EV_JOIN_TXCOMPLETE: no JoinAccept

Mijn DEVEUI is 0059AC00001B193F

Hopelijk kan iemand mij verder helpen.

Groet,

Michel

 


8 reacties

Reputatie 7
Badge +6

Goedemiddag @michel.kamp

Welkom bij de IoT Community! 
Tof om te lezen dat je hiermee aan de slag gaat. We denken graag met je mee! 

Ik heb jouw account in de Things Portal opgezocht en ik zie dit device naar voren komen. Het eerste dat me opvalt is dat device nog niet aan een flow gekoppeld is. Dat kun je dus nog even doen. Vervolgens vind je op de LoRa Devices meer informatie over mogelijke oorzaken voor wanneer je geen Join Requests en/of Accepts in de LoRa Data History ziet verschijnen. 

 

Hopelijk kom je hier verder mee! 

Dag @Rick S. ,

 

Dank voor de snelle reactie. Ik heb de flow gekoppeld . Maar zie nog niets binnen komen.

Heb jij een sketch voorbeeld voor een Adafruit Feather M0 RFM95 LoRa liggen dat je kunt delen ?

Ik gebruik nu deze onderstaande code. Heb ondertussen ook een M0_1 device aangemaakt waar ik de MAC die bij t device zat heb neer gezet met 0xff en 0xfe in t midden omdat t MAC maar 6 bytes is  (is dit de juiste methode?). Dus de code met M0_1 loopt nu actief .  

/*******************************************************************************
* 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. It's pre-configured for the Adafruit
* Feather M0 LoRa.
*
* 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.
//

// 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.

// devive KPN: MO_1
// Own LoRa device (preset connectivity)
static const u1_t PROGMEM APPEUI[8] = { 0x00,0x59,0xAC,0x00,0x00,0x0F,0xFF,0xFF }; // general appeui https://docs.kpnthings.com/gs/lora/marvin
static const u1_t PROGMEM DEVEUI[8] = { 0x98,0x76,0xb6, 0xff,0xfe ,0x12,0x29,0xfa }; // MAC from adafuit M0 box if ,0xff,0xfe in the middle http://www.infwin.com.cn/docs/lorawan-deveui-appeui-and-appkey
static const u1_t PROGMEM APPKEY[16] = {xxxxxx};

// device kpn: M0
// Own LoRa device (programmable)
//static const u1_t PROGMEM APPEUI[8] = { 0x00,0x59,0xAC,0x00,0x00,0x01,0x0B,0xD0 }; // MO
//static const u1_t PROGMEM DEVEUI[8] = { 0x00,0x59,0xAC,0x00,0x00,0x1B,0x19,0x3F };
//static const u1_t PROGMEM APPKEY[16] = {xxxxxx};

void os_getArtEui (u1_t* buf) { memcpy_P(buf, APPEUI, 8);}

// This should also be in little endian format, see above.
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 the TTN console can be copied as-is.
void os_getDevKey (u1_t* buf) { memcpy_P(buf,APPKEY, 16);}

static uint8_t mydata[] = "Hello, world!";
static osjob_t sendjob;

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

// Pin mapping
//
// Adafruit BSPs are not consistent -- m0 express defs ARDUINO_SAMD_FEATHER_M0,
// m0 defs ADAFRUIT_FEATHER_M0
//
// Pin mapping for Adafruit Feather M0 LoRa, etc.
// /!\ By default Adafruit Feather M0's pin 6 and DIO1 are not connected.
// Please ensure they are connected.

const lmic_pinmap lmic_pins = {
.nss = 8,
.rxtx = LMIC_UNUSED_PIN,
.rst = 4,
.dio = {3, 6, LMIC_UNUSED_PIN},
.rxtx_rx_active = 0,
.rssi_cal = 8, // LBT cal for the Adafruit Feather M0 LoRa, in dB
.spi_freq = 8000000,
};

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;
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.println(F("Received "));
Serial.println(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() {
delay(5000);
while (! Serial)
;
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();

// LMIC_setClockError(MAX_CLOCK_ERROR * 3 / 100); // mka

LMIC_setLinkCheckMode(0);

// TTN uses SF9 for its RX2 window.
//LMIC.dn2Dr = DR_SF9; // added mka

LMIC_setDrTxpow(DR_SF7,14);


//LMIC_selectSubBand(1);

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

void loop() {
os_runloop_once();
}

 

Reputatie 7
Badge +6

Goedemiddag Michel, 

Jammer genoeg heb ik geen sketch voorbeeld voor een Adafruit Feather M0 RFM95 LoRa die ik met je kan delen. Maar natuurlijk kijken we verder hoe we dit op kunnen lossen. Ik ga intern ook wat hulplijnen inschakelen. 

Voor de zekerheid, na het koppelen van de flow heb je opnieuw een Join Request gestuurd, toch? Heb je gecheckt of de Join Request via het juiste kanaal en op SF12 verstuurd wordt?

 @Rick S. , dank,

Zoals ik aangaf ben ik nieuw mbt IOP kpn. Dus wat help zou heel mooi zijn. 

Ik heb idd een nieuwe join geprobeerd . Zelfde resultaat en ook geen enkele log aan de KPN kant. 

Hoe zet ik eigenlijk de logging aan in mijn LMIC sketch ? 

De code hierboven gebruikt ik voor alles.

Met SF12 bedoel je daar dit onderstaande mee ?

LMIC_setDrTxpow(DR_SF12,14);

Kun jij onderstaande verifiëren:

Ik gebruik nu deze onderstaande code. Heb ondertussen ook een M0_1 device aangemaakt waar ik de MAC die bij t device zat heb neer gezet met 0xff en 0xfe in t midden omdat t MAC maar 6 bytes is  (is dit de juiste methode?). Dus de code met M0_1 loopt nu actief .  

 

Dank,

Michel

 

@Rick S. enige help zou welkom zijn.

Reputatie 7
Badge +6

Goedemorgen Michel,

Ik wil je ook heel graag helpen. 
Ik heb alleen nog geen inhoudelijke terugkoppeling mogen ontvangen van de specialisten. Natuurlijk heb ik gelijk weer gevraagd wanneer we antwoord kunnen verwachten. Excuses dat het zo lang duurt! 

@Rick S.  , ik ben er achter . het lijkt te werken.

DEVEUI moest in LSB formaat !!!

en de APPEUI de default van KPN general appeui 0x00,0x59,0xAC,0x00,0x00,0x01,0x0B,0xD0 Zie https://docs.kpnthings.com/gs/lora/marvin

 

Misschien dat ik hiermee anderen ook geholpen zijn.

 

Michel

Reputatie 7
Badge +6

Hey @michel.kamp,

Bedankt voor de update! 
En wat super dat het lek boven is en dat het nu werkt. Hier hebben anderen zeker wat aan. 

Nogmaals mijn excuses dat je nog geen inhoudelijk antwoord van ons hebt gekregen. 

Reageer