Compile the example
Open the Arduino IDE and go to File->Examples->IBM LMIC framework->ttn abp.
Around line 64, change the pin-mapping block of code. Replace the original with the following:
const lmic_pinmap lmic_pins = {
.mosi = 27,
.miso = 19,
.sck = 5,
.nss = 17,
.rxtx = LMIC_UNUSED_PIN,
.rst = 18,
.dio = {23, 23, 23}, //workaround to use 1 pin for all 3 radio dio pins
};
At the top of the sketch, change NWKSKEY, APPSKEY and DEVADDR to your keys, as from the TTN console.
// LoRaWAN NwkSKey, network session key
static const PROGMEM u1_t NWKSKEY[16] = { 0x2B, 0x7E, 0x15, 0x16, 0x28, 0xAE, 0xD2, 0xA6, 0xAB, 0xF7, 0x15, 0x88, 0x09, 0xCF, 0x4F, 0x3C };
// LoRaWAN AppSKey, application session key
static const u1_t PROGMEM APPSKEY[16] = { 0x2B, 0x7E, 0x15, 0x16, 0x28, 0xAE, 0xD2, 0xA6, 0xAB, 0xF7, 0x15, 0x88, 0x09, 0xCF, 0x4F, 0x3C };
// LoRaWAN end-device address (DevAddr)
static const u4_t DEVADDR = 0x03FF0001;
In the Arduino IDE go to Tools->Board->ESP32 Dev Module.
Click on Verify. If you installed and change everything correctly, this should succeed.
If you get the following error, it means you forgot to change the pin-mapping block:
sorry, unimplemented: non-trivial designated initializers not supported
exit status 1
Error compiling for board ESP32 Dev Module.
If you get the following error, you need to change the radio type LMIC is expecting:
Starting
FAILURE
…/Documents/Arduino/libraries/<wbr>arduino-lmic-master/src/lmic/<wbr>radio.c:689
To change the setting go to …/Documents/Arduino/libraries/arduino-lmic-master/src/lmic/config.h and change the lines about the radio to:
// This is the SX1272/SX1273 radio, which is also used on the HopeRF
// RFM92 boards.
#define CFG_sx1272_radio 1
// This is the SX1276/SX1277/SX1278/SX1279 radio, which is also used on
// the HopeRF RFM95 boards.
//#define CFG_sx1276_radio 1