U can help me? i can't fix my code esp32 with sx1276 for comunication in ttn

Hello, i'm make a project esp32 with sx1276 and i can't fix.
I just want to connect my board using lora in ttn.

This is my code:

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

// Definir as chaves de acesso fornecidas pela TTN
static const u1_t NWKSKEY[16] = { /* Inserir NWKSKEY aqui */ };
static const u1_t APPSKEY[16] = { /* Inserir APPSKEY aqui */ };
static const u4_t DEVADDR = 0x12345678; // Inserir o DevAddr aqui

// Mapeamento dos pinos para o módulo SX1276 e ESP32
const lmic_pinmap lmic_pins = {
    .nss = 18,
    .rxtx = LMIC_UNUSED_PIN,
    .rst = 14,
    .dio = {26, 33, 32},
};

void onEvent(ev_t ev) {
    // Lidar com os eventos do LMIC
    // ...
}

void do_send(osjob_t* j) {
    // Enviar dados aqui
    // ...
}

osjob_t sendjob;

void setup() {
    Serial.begin(115200);
    Serial.println("Iniciando...");

    // Inicializar o LMIC
    os_init();
    LMIC_reset();

    // Configurar as chaves de acesso
    u1_t myNwksKey[16] = { /* Inserir NWKSKEY aqui */ };
    u1_t myAppsKey[16] = { /* Inserir APPSKEY aqui */ };
    LMIC_setSession(0x1, DEVADDR, myNwksKey, myAppsKey);

    // Configurar o canal de uplink para a TTN
    LMIC_setupChannel(0, 903900000, DR_RANGE_MAP(DR_SF10, DR_SF7), BAND_CENTI); // Frequência 903.9 MHz para FSB 3

    // Iniciar uma tentativa de OTAA join
    do_send(&sendjob);
}

void loop() {
    os_runloop_once();
}

and this is a error:

Arduino: 1.8.16 (Windows 10), Placa:"ESP32 Dev Module, Disabled, Disabled, Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS), 240MHz (WiFi/BT), QIO, 80MHz, 4MB (32Mb), 921600, Core 1, Core 1, None, Disabled"
c:/users/ctracker/appdata/local/arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/esp-2021r2-patch5-8.4.0/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: C:\Users\Ctracker\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.11/tools/sdk/esp32/lib\libpp.a(hal_mac.o): in function `hal_init':

(.text.hal_init+0x40): multiple definition of `hal_init'; libraries\IBM_LMIC_framework\hal\hal.cpp.o:C:\Users\Ctracker\Documents\Arduino\libraries\IBM_LMIC_framework\src\hal/hal.cpp:259: first defined here

collect2.exe: error: ld returned 1 exit status

exit status 1

Erro compilando para a placa ESP32 Dev Module

Este relatório teria mais informações com
"Mostrar a saida detalhada durante a compilação"
opção pode ser ativada em "Arquivo -> Preferências"

How i can fix?

Take a look at line 259 of the file name given.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.