# Unknown issue with LMIC / ESP32

**URL:** <https://www.thethingsnetwork.org/forum/t/unknown-issue-with-lmic-esp32/65574>\
**Category:** End Devices (Nodes)\
**Tags:** gateways, ttn-mapper, end-devices, esp32, lmic\
**Created:** [November 16, 2023, 7:16am UTC](https://www.thethingsnetwork.org/forum/t/unknown-issue-with-lmic-esp32/65574 "2023-11-16T07:16:59Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![suphika](https://www.thethingsnetwork.org/forum/letter_avatar_proxy/v4/letter/s/b5ac83/32.png) [@suphika](https://www.thethingsnetwork.org/forum/u/suphika)\
**Post date:** [November 16, 2023, 7:16am UTC](https://www.thethingsnetwork.org/forum/t/unknown-issue-with-lmic-esp32/65574/1 "2023-11-16T07:16:59Z")

</div>

I need help I use the library MCCI LoRaWAN LMIC Library With board ESP32-Wrover. The result is no data sent to TTN Application and when I apply that is used Arduino code Show results that the Unsupported Board. Do I have to fix it by changing the working board?

This is Arduino code that I use;

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

#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

static const PROGMEM u1\_t NWKSKEY[16] = { FILLMEIN };

static const u1\_t PROGMEM APPSKEY[16] = { FILLMEIN };

static const u4\_t DEVADDR = FILLMEIN;

void os\_getArtEui (u1\_t\* buf) { }  
void os\_getDevEui (u1\_t\* buf) { }  
void os\_getDevKey (u1\_t\* buf) { }

static uint8\_t mydata = “Hello, world!”;  
static osjob\_t sendjob;

const unsigned TX\_INTERVAL = 60;

const lmic\_pinmap lmic\_pins = {  
.nss = 9,  
.rxtx = LMIC\_UNUSED\_PIN,  
.rst = 3,  
.dio = {18, 19, LMIC\_UNUSED\_PIN},  
};

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”));  
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.println(F(“Received “));  
Serial.println(LMIC.dataLen);  
Serial.println(F(” bytes of payload”));  
}  
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:  
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;  
case EV\_TXSTART:  
Serial.println(F(“EV\_TXSTART”));  
break;  
case EV\_TXCANCELED:  
Serial.println(F(“EV\_TXCANCELED”));  
break;  
case EV\_RXSTART:  
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){  
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”));  
}  
}

void setup() {  
// pinMode(13, OUTPUT);  
// while (!Serial); // wait for Serial to be initialized  
Serial.begin(115200);  
delay(100); // per sample code on RF\_95 test  
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();

LMIC_reset();

#ifdef PROGMEM

uint8_t appskey[sizeof(APPSKEY)];
uint8_t nwkskey[sizeof(NWKSKEY)];
memcpy_P(appskey, APPSKEY, sizeof(APPSKEY));
memcpy_P(nwkskey, NWKSKEY, sizeof(NWKSKEY));
LMIC_setSession (0x13, DEVADDR, nwkskey, appskey);
#else
// If not running an AVR with PROGMEM, just use the arrays directly
LMIC_setSession (0x13, DEVADDR, NWKSKEY, APPSKEY);
#endif

#if defined(CFG_eu868)

LMIC_setupChannel(0, 868100000, DR_RANGE_MAP(DR_SF12, DR_SF7), BAND_CENTI); // g-band
LMIC_setupChannel(1, 868300000, DR_RANGE_MAP(DR_SF12, DR_SF7B), BAND_CENTI); // g-band
LMIC_setupChannel(2, 868500000, DR_RANGE_MAP(DR_SF12, DR_SF7), BAND_CENTI); // g-band
LMIC_setupChannel(3, 867100000, DR_RANGE_MAP(DR_SF12, DR_SF7), BAND_CENTI); // g-band
LMIC_setupChannel(4, 867300000, DR_RANGE_MAP(DR_SF12, DR_SF7), BAND_CENTI); // g-band
LMIC_setupChannel(5, 867500000, DR_RANGE_MAP(DR_SF12, DR_SF7), BAND_CENTI); // g-band
LMIC_setupChannel(6, 867700000, DR_RANGE_MAP(DR_SF12, DR_SF7), BAND_CENTI); // g-band
LMIC_setupChannel(7, 867900000, DR_RANGE_MAP(DR_SF12, DR_SF7), BAND_CENTI); // g-band
LMIC_setupChannel(8, 868800000, DR_RANGE_MAP(DR_FSK, DR_FSK), BAND_MILLI); // g2-band

#elif defined(CFG_us915) || defined(CFG_au915)

LMIC_selectSubBand(1);
#elif defined(CFG_as923)
#elif defined(CFG_kr920)
#elif defined(CFG_in866)
#else
# error Region not supported
#endif

// Disable link check validation
LMIC_setLinkCheckMode(0);

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

// Set data rate and transmit power for uplink
LMIC_setDrTxpow(DR_SF7,14);

// Start job
do_send(&sendjob);

```

}

void loop() {  
unsigned long now;  
now = millis();  
if ((now & 512) != 0) {  
Serial.print(now);  
digitalWrite(13, HIGH);  
}  
else {  
digitalWrite(13, LOW);  
}

```
os_runloop_once();

```

}

---

<div class="post-metadata">

**Author:** ![Piet\_Pillay](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/piet_pillay/32/35697_2.png) [@Piet\_Pillay](https://www.thethingsnetwork.org/forum/u/Piet_Pillay)\
**Post date:** [November 16, 2023, 9:29am UTC](https://www.thethingsnetwork.org/forum/t/unknown-issue-with-lmic-esp32/65574/2 "2023-11-16T09:29:01Z")

</div>

please format your post with \</\> tool using the post formatting tools read your own post and see if you can descript it

please reference to where you found what you are using

do you see anything in the console of you application or gateway

---

<div class="post-metadata">

**Author:** ![descartes](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/descartes/32/47220_2.png) [@descartes](https://www.thethingsnetwork.org/forum/u/descartes)\
**Post date:** [November 16, 2023, 9:49am UTC](https://www.thethingsnetwork.org/forum/t/unknown-issue-with-lmic-esp32/65574/3 "2023-11-16T09:49:25Z")

</div>

> [@suphika](#):
>
> when I apply that is used Arduino code Show results that the Unsupported Board

I appreciate that English may not be your first language, so it may be better for you to write out the problem in your own words and use Google Translate, as this phrase seems key to your issue but is not clear what you mean.

The topic title is misleading so I’ve changed it temporarily.

You’ve posted the generic ABP code for LMIC **without putting any of the settings** in.

Overall I’d suggest you start out with [LMIC-node](https://github.com/lnlp/LMIC-node) which has detailed instructions to get started with an ESP board.

And read the [Learn](https://www.thethingsnetwork.org/docs/lorawan/) section to understand the choices you are making - OTAA is preferable to ABP - these terms are explained in the learning docs.

---

<div class="post-metadata">

**Author:** ![suphika](https://www.thethingsnetwork.org/forum/letter_avatar_proxy/v4/letter/s/b5ac83/32.png) [@suphika](https://www.thethingsnetwork.org/forum/u/suphika)\
**Post date:** [November 20, 2023, 2:21am UTC](https://www.thethingsnetwork.org/forum/t/unknown-issue-with-lmic-esp32/65574/4 "2023-11-20T02:21:46Z")

</div>

I’m sorry. I’m new to using this platform. This is the result.

 ![image](https://www.thethingsnetwork.org/forum/uploads/default/original/3X/8/e/8e36c74caf0a3d810094cc1ede780d7ccff06d63.png)  
 ![image](https://www.thethingsnetwork.org/forum/uploads/default/original/3X/b/e/be61000515d47dd204ac020520cd6a56a3c5dcf0.png)

---

<div class="post-metadata">

**Author:** ![suphika](https://www.thethingsnetwork.org/forum/letter_avatar_proxy/v4/letter/s/b5ac83/32.png) [@suphika](https://www.thethingsnetwork.org/forum/u/suphika)\
**Post date:** [November 20, 2023, 2:38am UTC](https://www.thethingsnetwork.org/forum/t/unknown-issue-with-lmic-esp32/65574/5 "2023-11-20T02:38:52Z")

</div>

I thank you very much. I will try to write or explain to you to understand.  
At this time, I use the board ESP32-Wrover Install library MCCI LoRaWAN LMIC Library and use code examples. I only change the pin to the function const lmic\_pinmap lmic\_pins = {… }

The results that I got Serial monitor and console application.

Thank you very much  
Suphika

 ![image](https://www.thethingsnetwork.org/forum/uploads/default/original/3X/8/e/8e36c74caf0a3d810094cc1ede780d7ccff06d63.png)

![image](https://www.thethingsnetwork.org/forum/uploads/default/original/3X/f/e/fe3cabe012481b14828931696a14a7336f0fd130.png)

---

<div class="post-metadata">

**Author:** ![descartes](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/descartes/32/47220_2.png) [@descartes](https://www.thethingsnetwork.org/forum/u/descartes)\
**Post date:** [November 20, 2023, 12:19pm UTC](https://www.thethingsnetwork.org/forum/t/unknown-issue-with-lmic-esp32/65574/6 "2023-11-20T12:19:14Z")

</div>

This:

> [@descartes](#):
>
> You’ve posted the generic ABP code for LMIC **without putting any of the settings** in.

and did you follow this suggestion:

> [@descartes](#):
>
> Overall I’d suggest you start out with [LMIC-node](https://github.com/lnlp/LMIC-node) which has detailed instructions to get started with an ESP board.

and have you:

> [@descartes](#):
>
> And read the [Learn](https://www.thethingsnetwork.org/docs/lorawan/) section to understand the choices you are making - OTAA is preferable to ABP - these terms are explained in the learning docs.

because the device won’t work if you don’t put the settings in to it.

The Dev & JoinEUI are public data - it’s the AppKey you need to keep secret.

It does not help the forum to post the same images twice, we can all see the replies. And any text like serial output should be copied & pasted over, not as a screen shot.

Please as a minimum fill in the settings as it says at the top of the example sketch and ensure you familiar with the basics from the Learn section.

---

<div class="post-metadata">

**Author:** ![suphika](https://www.thethingsnetwork.org/forum/letter_avatar_proxy/v4/letter/s/b5ac83/32.png) [@suphika](https://www.thethingsnetwork.org/forum/u/suphika)\
**Post date:** [November 22, 2023, 1:57am UTC](https://www.thethingsnetwork.org/forum/t/unknown-issue-with-lmic-esp32/65574/7 "2023-11-22T01:57:13Z")

</div>

@descartes I will try to learn and try the suggestions. thank you very much.
