Hi, I know that a lot of people have opened similar topics with similar problems but I’m very desperate at this point and none of the solutions helped me.
So I have my SX1276 connected to my Arduino Nano, I have triple checked all the connections both visually and with a multimeter to see if everything is properly connected. Everything is connected as will be described in the pin mapping in the code.
#include <lmic.h>
#include <hal/hal.h>
#include <SPI.h>
static const PROGMEM u1_t NWKSKEY[16] = { 0xE4, 0x9E, 0x15, 0xB4, 0x7E, 0x3D, 0xB1, 0x32, 0xEA, 0x08, 0x03, 0xDE, 0x9A, 0x02, 0x6D, 0x12 };
static const u1_t PROGMEM APPSKEY[16] = { 0xEF, 0x56, 0x10, 0xB6, 0x9B, 0x55, 0x61, 0xF5, 0x17, 0x89, 0x70, 0xC2, 0x3B, 0x54, 0xC9, 0xDA };
static const u4_t DEVADDR = 0x260BB373 ;
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 = 6,
.rxtx = LMIC_UNUSED_PIN,
.rst = 5,
.dio = {2,3,4},
};
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_RFU1:
Serial.println(F("EV_RFU1"));
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"));
}
// Schedule next transmission
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:
// data received in ping slot
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;
default:
Serial.println(F("Unknown event"));
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"));
} else {
// Prepare upstream data transmission at the next possible time.
LMIC_setTxData2(1, mydata, sizeof(mydata)-1, 0);
Serial.println(F("Packet queued"));
}
// Next TX is scheduled after TX_COMPLETE event.
}
void setup() {
Serial.begin(9600);
Serial.println(F("Starting"));
// LMIC init
os_init();
LMIC_reset();
LMIC_setClockError(MAX_CLOCK_ERROR * 2 / 100);
#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 (0x1, DEVADDR, nwkskey, appskey);
#else
LMIC_setSession (0x1, 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
// 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 (note: txpow seems to be ignored by the library)
LMIC_setDrTxpow(DR_SF7,14);
// Start job
do_send(&sendjob);
}
void loop() {
os_runloop_once();
}
After uploading the code to my Arduino I get the following errors:
Blockquote c:\Users\Admin\Documents\Arduino\libraries\MCCI_LoRaWAN_LMIC_library\src\lmic\oslmic.c:53
c:\Users\Admin\Documents\Arduino\libraries\MCCI_LoRaWAN_LMIC_library\src\lmic\radio.c:1164
The first error goes away by changing line 53 in oslmic.c from ASSERT(0) to ASSERT(1).
After that the second error comes up.
After searching for and answer for days I used a code provided by StuartsProjects on GitHub that checks the wiring on the SX1276 and I get the following error:
Blockquote 2_Register_Test Starting
No device responding
Device version 0x00
Frequency at Start 0
Registers at Start
Reg 0 1 2 3 4 5 6 7 8 9 A B C D E F
0x00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x10 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x20 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x40 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x50 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x60 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x70 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
My question is if there’s something wrong with my code or is the module just flat out dead?
I changed the lmic_project_config accordingly and it just doesn’t work.
Please send help, I’ve been working on this for months now and my first attempt with a RFM95W didn’t go much better.