Hey, I am using the Lilygo T-Beam-AXP2101 -V1.2 and i want to send data to TTN.
I am using the MCCI LoRaWAN LMIC library.
This is my Code (i am using PlatformIO/Visual Studio Code):
#include <Arduino.h> // Fügt die Arduino-Bibliotheken hinzu
#include <lmic.h>
#include <hal/hal.h>
#include <SPI.h>
#include <arduino_lmic_hal_boards.h>
// Pinbelegung für das LoRa-Modul
const lmic_pinmap lmic_pins = {
.nss = 18, // Chip Select
.rxtx = LMIC_UNUSED_PIN, // Rx/Tx Pin
.rst = 23, // Reset Pin
.dio = {26, LMIC_UNUSED_PIN, LMIC_UNUSED_PIN} // DIO0, DIO1, DIO2 Pins
};
#define LORA_SCK 5
#define LORA_MISO 19
#define LORA_MOSI 27
#define LORA_CS 18
#define LORA_RST 23
#define LORA_IRQ 26
// LoRaWAN-Parameter
static const uint8_t DEVEUI[8] = { 0x70, 0xB3, 0xD5, 0x7E, 0xD0, 0x06, 0xBC, 0xB5 };
static const uint8_t APPEUI[8] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
static const uint8_t APPKEY[16] = { 0x72, 0xCF, 0x92, 0x4C, 0xF7, 0x61, 0xBD, 0x42, 0x7E, 0x2D, 0x9B, 0x95, 0x3A, 0x74, 0xBE, 0xCB };
void os_getArtEui(u1_t* buf) { memcpy(buf, APPEUI, 8); }
void os_getDevEui(u1_t* buf) { memcpy(buf, DEVEUI, 8); }
void os_getDevKey(u1_t* buf) { memcpy(buf, APPKEY, 16); }
void os_setup() {
// Hier können Sie weitere Initialisierungen hinzufügen, wenn nötig.
}
void setup() {
// Serielle Kommunikation mit Baudrate 9600 starten
Serial.begin(9600);
while (!Serial); // Warten, bis die serielle Kommunikation verfügbar ist
Serial.println(“Starting LoRaWAN…”);
// LoRa initialisieren
const Arduino_LMIC::HalPinmap_t *lmic_pins = Arduino_LMIC::GetPinmap_ThisBoard();
os_init_ex((const void *)lmic_pins);
//os_init();
LMIC_reset();
}
void loop() {
// Sende Nachricht alle 10 Sekunden
if (LMIC.opmode & OP_JOINING) {
Serial.println(“LoRa not joined yet.”);
delay(1000);
} else {
Serial.println(“Sending message…”);
// Umwandeln der Nachricht in uint8_t-Array
uint8_t message[] = {'H', 'e', 'l', 'l', 'o', ' ', 'L', 'o', 'r', 'a'};
// Daten an den LoRaWAN-Netzwerkserver senden
LMIC_setTxData2(1, message, sizeof(message), 0); // Beispielnachricht senden
}
delay(1000); // 10 Sekunden warten
}
When I upload the code i get this error in serial monitor:
- Executing task in folder lora: C:\Users\paulp.platformio\penv\Scripts\platformio.exe device monitor
— Terminal on COM5 | 9600 8-N-1
— Available filters and text transformations: colorize, debug, default, direct, esp32_exception_decoder, hexlify, log2file, nocontrol, printable, send_on_enter, time
— More details at Redirecting...
— Quit: Ctrl+C | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H
�␁��␑D)!11�z 1�11�Starting LoRaWAN…
FAILURE
.pio/libdeps/esp32dev/MCCI LoRaWAN LMIC library/src/hal/hal.cpp:485
Guru Meditation Error: Core 1 panic’ed (Interrupt wdt timeout on CPU1).
Core 1 register dump:
PC : 0x400d4304 PS : 0x00060035 A0 : 0x800d4406 A1 : 0x3ffb2790
A2 : 0x3f4002c6 A3 : 0x000001e5 A4 : 0x3ffc11d4 A5 : 0x0000ff00
A6 : 0x00ff0000 A7 : 0xff000000 A8 : 0x800d4304 A9 : 0x3ffb2770
A10 : 0x3ffc11d4 A11 : 0x00000003 A12 : 0x0000000a A13 : 0x0000ff00
A14 : 0x00ff0000 A15 : 0xff000000 SAR : 0x00000003 EXCCAUSE: 0x00000006
EXCVADDR: 0x00000000 LBEG : 0x400861d1 LEND : 0x400861e1 LCOUNT : 0xfffffffe
Backtrace:0x400d4301:0x3ffb27900x400d4403:0x3ffb27b0 0x400d366f:0x3ffb27d0 0x400d1359:0x3ffb27f0 0x400d5c02:0x3ffb2820
Core 0 register dump:
PC : 0x400f2bc6 PS : 0x00060535 A0 : 0x800dc971 A1 : 0x3ffbd1b0
A2 : 0x00000000 A3 : 0x40085520 A4 : 0x00060520 A5 : �
I got that watchdog timererror and dont know how to solve it.
I read somthing about changing somthing in the .hal file and tried it but it didnt change anything.
I also tried some other things chatgpt told me but nothing worked.
It would be nice if someone could help me.
best regards
Paul