I need some help trying to connect my Helltec board to my RAK 831 Gatway.
I’m using the Lmic source in the Arduino environment.
Here is my code
Hi I was wondering if you know of a working Heltec configuration on the AUS915 spectrum.
I set up a gateway in Mount Kuring Gai and it is connected to the The Thingsnetwork.
But I’m having a bit of a hard time to get the node I have configured.
I have a Helltec board and using the Arduino Core Lmic.
However I fail to register EV_JOIN_FAILD.
Find the code and the serial window output from the Arduino IDE.
May thanks for your help.
Here is the code I’m using:
// This should also be in little endian format, see above.
static const u1_t PROGMEM DEVEUI[8] = { 0x9B, 0xF6, 0x59, 0x64, 0x71, 0xFB, 0x02, 0x00 };
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 ttnctl can be copied as-is.
// The key shown here is the semtech default key.
static const u1_t PROGMEM APPKEY[16] = { 0xA9, 0x43, 0xB5, 0x11, 0xEB, 0xFB, 0xA5, 0xC1, 0xB7, 0xA1, 0x42, 0xBC, 0x7E, 0xB4, 0x7C, 0x79 };
void os_getDevKey (u1_t* buf) {
memcpy_P(buf, APPKEY, 16);
}
static uint8_t mydata[] = “Hi”;
static osjob_t sendjob;
// Schedule TX every this many seconds (might become longer due to duty
// cycle limitations).
const unsigned TX_INTERVAL = 30;
// Pin mapping
const lmic_pinmap lmic_pins = {
.nss = 18,
.rxtx = LMIC_UNUSED_PIN,
.rst = 14,
.dio = {26, 33, 32},
};
void onEvent (ev_t ev) {
Serial.print(os_getTime());
u8x8.setCursor(0, 5);
u8x8.printf(“TIME %lu”, os_getTime());
Serial.print(": ");
switch (ev) {
case EV_SCAN_TIMEOUT:
Serial.println(F(“EV_SCAN_TIMEOUT”));
u8x8.drawString(0, 7, “EV_SCAN_TIMEOUT”);
break;
case EV_BEACON_FOUND:
Serial.println(F(“EV_BEACON_FOUND”));
u8x8.drawString(0, 7, “EV_BEACON_FOUND”);
break;
case EV_BEACON_MISSED:
Serial.println(F(“EV_BEACON_MISSED”));
u8x8.drawString(0, 7, “EV_BEACON_MISSED”);
break;
case EV_BEACON_TRACKED:
Serial.println(F(“EV_BEACON_TRACKED”));
u8x8.drawString(0, 7, “EV_BEACON_TRACKED”);
break;
case EV_JOINING:
Serial.println(F(“EV_JOINING”));
u8x8.drawString(0, 7, “EV_JOINING”);
break;
case EV_JOINED:
Serial.println(F(“EV_JOINED”));
u8x8.drawString(0, 7, "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”));
u8x8.drawString(0, 7, “EV_RFUI”);
break;
case EV_JOIN_FAILED:
Serial.println(F(“EV_JOIN_FAILED”));
u8x8.drawString(0, 7, “EV_JOIN_FAILED”);
break;
case EV_REJOIN_FAILED:
Serial.println(F(“EV_REJOIN_FAILED”));
u8x8.drawString(0, 7, “EV_REJOIN_FAILED”);
//break;
break;
case EV_TXCOMPLETE:
Serial.println(F(“EV_TXCOMPLETE (includes waiting for RX windows)”));
u8x8.drawString(0, 7, “EV_TXCOMPLETE”);
digitalWrite(BUILTIN_LED, LOW);
if (LMIC.txrxFlags & TXRX_ACK) {
Serial.println(F(“Received ack”));
u8x8.drawString(0, 7, “Received ACK”);
}
if (LMIC.dataLen) {
Serial.println(F(“Received “));
u8x8.drawString(0, 6, “RX “);
Serial.println(LMIC.dataLen);
u8x8.setCursor(4, 6);
u8x8.printf(”%i bytes”, LMIC.dataLen);
Serial.println(F(” bytes of payload”));
u8x8.setCursor(0, 7);
u8x8.printf(“RSSI %d SNR %.1d”, LMIC.rssi, LMIC.snr);
}
// Schedule next transmission
os_setTimedCallback(&sendjob, os_getTime() + sec2osticks(TX_INTERVAL), do_send);
break;
case EV_LOST_TSYNC:
Serial.println(F(“EV_LOST_TSYNC”));
u8x8.drawString(0, 7, “EV_LOST_TSYNC”);
break;
case EV_RESET:
Serial.println(F(“EV_RESET”));
u8x8.drawString(0, 7, “EV_RESET”);
break;
case EV_RXCOMPLETE:
// data received in ping slot
Serial.println(F(“EV_RXCOMPLETE”));
u8x8.drawString(0, 7, “EV_RXCOMPLETE”);
break;
case EV_LINK_DEAD:
Serial.println(F(“EV_LINK_DEAD”));
u8x8.drawString(0, 7, “EV_LINK_DEAD”);
break;
case EV_LINK_ALIVE:
Serial.println(F(“EV_LINK_ALIVE”));
u8x8.drawString(0, 7, “EV_LINK_ALIVE”);
break;
default:
Serial.println(F(“Unknown event”));
u8x8.setCursor(0, 7);
u8x8.printf(“UNKNOWN EVENT %d”, 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”));
u8x8.drawString(0, 7, “OP_TXRXPEND, not sent”);
} else {
// Prepare upstream data transmission at the next possible time.
LMIC_setTxData2(1, mydata, sizeof(mydata) - 1, 0);
Serial.println(F(“Packet queued”));
u8x8.drawString(0, 7, “PACKET QUEUED”);
digitalWrite(BUILTIN_LED, HIGH);
}
// Next TX is scheduled after TX_COMPLETE event.
}
void setup() {
Serial.begin(115200);
u8x8.begin();
u8x8.setFont(u8x8_font_chroma48medium8_r);
u8x8.drawString(0, 1, “LoRaWAN LMiC”);
SPI.begin(5, 19, 27);
// LMIC init
os_init();
// Reset the MAC state. Session and pending data transfers will be discarded.
LMIC_reset();
// Start job (sending automatically starts OTAA too)
do_send(&sendjob);
pinMode(BUILTIN_LED, OUTPUT);
digitalWrite(BUILTIN_LED, LOW);
}
void loop() {
os_runloop_once();
}
And this is the serial output from the Arduino IDE
ets Jun 8 2016 00:22:57
rst:0x1 (POWERON_RESET),boot:0x17 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0018,len:4
load:0x3fff001c,len:956
load:0x40078000,len:0
load:0x40078000,len:13076
entry 0x40078a58
RXMODE_RSSI
39430: engineUpdate, opmode=0x8
Packet queued
42206: EV_JOINING
46471: engineUpdate, opmode=0xc
46504: TXMODE, freq=902300000, len=23, SF=7, BW=125, CR=4/5, IH=0
362894: RXMODE_SINGLE, freq=923300000, SF=7, BW=500, CR=4/5, IH=0
426139: RXMODE_SINGLE, freq=923300000, SF=12, BW=500, CR=4/5, IH=0
428712: engineUpdate, opmode=0xc
439700: engineUpdate, opmode=0xc
439725: TXMODE, freq=903000000, len=23, SF=8, BW=500, CR=4/5, IH=0
754027: RXMODE_SINGLE, freq=923300000, SF=7, BW=500, CR=4/5, IH=0
817271: RXMODE_SINGLE, freq=923300000, SF=12, BW=500, CR=4/5, IH=0
819844: engineUpdate, opmode=0xc
907207: engineUpdate, opmode=0xc
907232: TXMODE, freq=911900000, len=23, SF=8, BW=125, CR=4/5, IH=0
1226861: RXMODE_SINGLE, freq=923300000, SF=8, BW=500, CR=4/5, IH=0
1290082: RXMODE_SINGLE, freq=923300000, SF=12, BW=500, CR=4/5, IH=0
1292654: engineUpdate, opmode=0xc
1332794: engineUpdate, opmode=0xc
1332819: TXMODE, freq=903000000, len=23, SF=8, BW=500, CR=4/5, IH=0
1647121: RXMODE_SINGLE, freq=923300000, SF=7, BW=500, CR=4/5, IH=0
1710366: RXMODE_SINGLE, freq=923300000, SF=12, BW=500, CR=4/5, IH=0
1712938: engineUpdate, opmode=0xc
2169543: engineUpdate, opmode=0xc
2169568: TXMODE, freq=912500000, len=23, SF=9, BW=125, CR=4/5, IH=0
2495037: RXMODE_SINGLE, freq=925100000, SF=9, BW=500, CR=4/5, IH=0
2558209: RXMODE_SINGLE, freq=923300000, SF=12, BW=500, CR=4/5, IH=0
2560782: engineUpdate, opmode=0xc
2571713: engineUpdate, opmode=0xc
2571738: TXMODE, freq=907800000, len=23, SF=8, BW=500, CR=4/5, IH=0
2886040: RXMODE_SINGLE, freq=925100000, SF=7, BW=500, CR=4/5, IH=0
2949284: RXMODE_SINGLE, freq=923300000, SF=12, BW=500, CR=4/5, IH=0
2951859: engineUpdate, opmode=0xc
3188834: engineUpdate, opmode=0xc
3188859: TXMODE, freq=906700000, len=23, SF=10, BW=125, CR=4/5, IH=0
3524727: RXMODE_SINGLE, freq=926900000, SF=10, BW=500, CR=4/5, IH=0
3587804: RXMODE_SINGLE, freq=923300000, SF=12, BW=500, CR=4/5, IH=0
3590376: engineUpdate, opmode=0xc
3613090: engineUpdate, opmode=0xc
3613115: TXMODE, freq=912600000, len=23, SF=8, BW=500, CR=4/5, IH=0
3927417: RXMODE_SINGLE, freq=926900000, SF=7, BW=500, CR=4/5, IH=0
3990661: RXMODE_SINGLE, freq=923300000, SF=12, BW=500, CR=4/5, IH=0
3993234: EV_JOIN_FAILED
3998768: engineUpdate, opmode=0xc
4250120: engineUpdate, opmode=0xc
4250148: TXMODE, freq=911900000, len=23, SF=10, BW=125, CR=4/5, IH=0
4586017: RXMODE_SINGLE, freq=923300000, SF=10, BW=500, CR=4/5, IH=0
4649093: RXMODE_SINGLE, freq=923300000, SF=12, BW=500, CR=4/5, IH=0
4651665: engineUpdate, opmode=0xc
4666741: engineUpdate, opmode=0xc
4666766: TXMODE, freq=903000000, len=23, SF=8, BW=500, CR=4/5, IH=0
4981070: RXMODE_SINGLE, freq=923300000, SF=7, BW=500, CR=4/5, IH=0
5044313: RXMODE_SINGLE, freq=923300000, SF=12, BW=500, CR=4/5, IH=0
5046886: EV_JOIN_FAILED
5052402: engineUpdate, opmode=0xc
5164684: engineUpdate, opmode=0xc
5164711: TXMODE, freq=908700000, len=23, SF=10, BW=125, CR=4/5, IH=0
5500581: RXMODE_SINGLE, freq=923300000, SF=10, BW=500, CR=4/5, IH=0
5563657: RXMODE_SINGLE, freq=923300000, SF=12, BW=500, CR=4/5, IH=0
5566229: engineUpdate, opmode=0xc
5598334: engineUpdate, opmode=0xc
5598359: TXMODE, freq=903000000, len=23, SF=8, BW=500, CR=4/5, IH=0
5912661: RXMODE_SINGLE, freq=923300000, SF=7, BW=500, CR=4/5, IH=0
5975906: RXMODE_SINGLE, freq=923300000, SF=12, BW=500, CR=4/5, IH=0
5978478: EV_JOIN_FAILED
5983995: engineUpdate, opmode=0xc
6820817: engineUpdate, opmode=0xc
6820845: TXMODE, freq=906100000, len=23, SF=10, BW=125, CR=4/5, IH=0
7156714: RXMODE_SINGLE, freq=925100000, SF=10, BW=500, CR=4/5, IH=0
7219790: RXMODE_SINGLE, freq=923300000, SF=12, BW=500, CR=4/5, IH=0
7222364: engineUpdate, opmode=0xc
7277965: engineUpdate, opmode=0xc
7277990: TXMODE, freq=907800000, len=23, SF=8, BW=500, CR=4/5, IH=0
7592292: RXMODE_SINGLE, freq=925100000, SF=7, BW=500, CR=4/5, IH=0
7655536: RXMODE_SINGLE, freq=923300000, SF=12, BW=500, CR=4/5, IH=0
7658109: EV_JOIN_FAILED
7663645: engineUpdate, opmode=0xc
8514192: engineUpdate, opmode=0xc
8514219: TXMODE, freq=909300000, len=23, SF=10, BW=125, CR=4/5, IH=0
8850089: RXMODE_SINGLE, freq=925100000, SF=10, BW=500, CR=4/5, IH=0
8913165: RXMODE_SINGLE, freq=923300000, SF=12, BW=500, CR=4/5, IH=0
8915737: engineUpdate, opmode=0xc
8969401: engineUpdate, opmode=0xc
8969426: TXMODE, freq=907800000, len=23, SF=8, BW=500, CR=4/5, IH=0
9283728: RXMODE_SINGLE, freq=925100000, SF=7, BW=500, CR=4/5, IH=0
9346973: RXMODE_SINGLE, freq=923300000, SF=12, BW=500, CR=4/5, IH=0
9349545: EV_JOIN_FAILED
9355057: engineUpdate, opmode=0xc
10130487: engineUpdate, opmode=0xc
10130515: TXMODE, freq=905100000, len=23, SF=10, BW=125, CR=4/5, IH=0
10466383: RXMODE_SINGLE, freq=926900000, SF=10, BW=500, CR=4/5, IH=0
10529460: RXMODE_SINGLE, freq=923300000, SF=12, BW=500, CR=4/5, IH=0
10532032: engineUpdate, opmode=0xc
10584482: engineUpdate, opmode=0xc
10584507: TXMODE, freq=912600000, len=23, SF=8, BW=500, CR=4/5, IH=0
10898810: RXMODE_SINGLE, freq=926900000, SF=7, BW=500, CR=4/5, IH=0
10962054: RXMODE_SINGLE, freq=923300000, SF=12, BW=500, CR=4/5, IH=0
10964627: EV_JOIN_FAILED
https://www.thethingsnetwork.org/forum/t/rn2903-au-firmware/7127/7