"C:\Users\Administrator\Documents\Arduino\libraries\MCCI_LoRaWAN_LMIC_library\project_config\lmic_project_config.h"
// project-specific definitions
//#define CFG_eu868 1
//#define CFG_us915 1
//#define CFG_au915 1
//#define CFG_as923 1
// #define LMIC_COUNTRY_CODE LMIC_COUNTRY_CODE_JP /* for as923-JP; also define CFG_as923 */
//#define CFG_kr920 1
#define CFG_in866 1
//#define CFG_sx1276_radio 1
//#define CFG_sx1261_radio 1
#define CFG_sx1262_radio 1
//#define ARDUINO_heltec_wifi_lora_32_V3
//#define LMIC_USE_INTERRUPTS
// my ttn_otaa code
/*******************************************************************************
* LoRaWAN OTAA Example for Heltec WiFi LoRa 32 (V2) - India IN865 MHz
*
* Uses your device credentials from ChirpStack:
* AppEUI (LSB), DevEUI (LSB), AppKey (MSB).
*******************************************************************************/
#include <lmic.h>
#include <hal/hal.h>
#include <SPI.h>
// -----------------------------------------------------------------------------
// Device credentials (from ChirpStack / TTN)
// -----------------------------------------------------------------------------
// AppEUI in LSB (reverse order shown in ChirpStack)
static const u1_t PROGMEM APPEUI[8] = { 0x53, 0x25, 0x86, 0x16, 0x35, 0x94, 0x78, 0x15 };
void os_getArtEui (u1_t* buf) { memcpy_P(buf, APPEUI, 8); }
// DevEUI in LSB (reverse order shown in ChirpStack)
static const u1_t PROGMEM DEVEUI[8] = { 0xCA, 0x32, 0x07, 0xD0, 0x7E, 0xD5, 0xB3, 0x70};
void os_getDevEui (u1_t* buf) { memcpy_P(buf, DEVEUI, 8); }
// AppKey in MSB (as shown in ChirpStack)
static const u1_t PROGMEM APPKEY[16] = { 0xD7, 0x10, 0xA9, 0xAA, 0x08, 0x9E, 0xFA, 0xF7, 0x75, 0xC6, 0x90, 0x7D, 0xCC, 0x5A, 0x51, 0xB7};
void os_getDevKey (u1_t* buf) { memcpy_P(buf, APPKEY, 16); }
// -----------------------------------------------------------------------------
// LoRaWAN settings
// -----------------------------------------------------------------------------
static uint8_t mydata[] = "Hello, world!";
static osjob_t sendjob;
// Send interval (in seconds)
const unsigned TX_INTERVAL = 60;
// Heltec WiFi LoRa 32 V2 Pin mapping
const lmic_pinmap lmic_pins = {
.nss = 18,
.rxtx = LMIC_UNUSED_PIN,
.rst = 14,
.dio = {26, 35, 33},
};
// -----------------------------------------------------------------------------
// Utility
// -----------------------------------------------------------------------------
void printHex2(unsigned v) {
v &= 0xff;
if (v < 16)
Serial.print('0');
Serial.print(v, HEX);
}
// -----------------------------------------------------------------------------
// LMIC Event Handler
// -----------------------------------------------------------------------------
void onEvent (ev_t ev) {
Serial.print(os_getTime());
Serial.print(": ");
switch(ev) {
case EV_JOINING:
Serial.println(F("EV_JOINING: Joining..."));
break;
case EV_JOINED:
Serial.println(F("EV_JOINED: Successfully joined network!"));
LMIC_setLinkCheckMode(0); // Disable link check (optional)
break;
case EV_JOIN_FAILED:
Serial.println(F("EV_JOIN_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"));
}
os_setTimedCallback(&sendjob, os_getTime()+sec2osticks(TX_INTERVAL), do_send);
break;
case EV_TXSTART:
Serial.println(F("EV_TXSTART"));
break;
case EV_JOIN_TXCOMPLETE:
Serial.println(F("EV_JOIN_TXCOMPLETE: No JoinAccept received"));
break;
default:
Serial.print(F("Unknown event: "));
Serial.println((unsigned) ev);
break;
}
}
// -----------------------------------------------------------------------------
// Send Function
// -----------------------------------------------------------------------------
void do_send(osjob_t* j){
if (LMIC.opmode & OP_TXRXPEND) {
Serial.println(F("OP_TXRXPEND, not sending"));
} else {
LMIC_setTxData2(1, mydata, sizeof(mydata)-1, 0);
Serial.println(F("Packet queued"));
}
}
// -----------------------------------------------------------------------------
// Setup / Loop
// -----------------------------------------------------------------------------
void setup() {
Serial.begin(9600);
Serial.println(F("Starting"));
// LMIC init
os_init();
LMIC_reset();
// Set data rate and TX power for IN865
LMIC_setDrTxpow(DR_SF7,14);
// Start OTAA join
do_send(&sendjob);
}
void loop() {
os_runloop_once();
}
//My output
Starting
Packet queued
3240: EV_JOINING: Joining...
391039: EV_TXSTART
773476: EV_JOIN_TXCOMPLETE: No JoinAccept received
1069649: EV_TXSTART
1452084: EV_JOIN_TXCOMPLETE: No JoinAccept received
1961618: EV_TXSTART
2344054: EV_JOIN_TXCOMPLETE: No JoinAccept received
3062820: EV_TXSTART
3448471: EV_JOIN_TXCOMPLETE: No JoinAccept received
3803824: EV_TXSTART
4189474: EV_JOIN_TXCOMPLETE: No JoinAccept received
Hello everyone im using SX1302 LoRaWAN Gateway HAT connected TTN perfectly then im tring to add end device using WiFi LoRa 32(V2), ESP32 + SX1262 LoRa Node im getting this outputs



