Lmic.h configuration issue and having issue with transmitting data with LoRa shield

I am currently having issues with the lmic.h configuration. It gives me errors stating that a certain file is not defined even though I already upload the file into lmic.h. I was wondering if someone knew where I could find a lmic file that did not require a lot of configuration file uploading. The first figure shows the configuration I am using to run the program. The second figure shows the error that I am getting.

lmicconfiguration

cstringerrormessage

I did not have this problem before but I was having another issue with transmitting data using the LoRa shield v95 to the LoRa LP01-p gateway. The LoRa shield is connected to a MEGA 2560 Arduino. I have the baud rate at 115200 in the code and COM5 terminal. I have already changed my network session key, application session key, and device address node to the device I have on thethingsnetwork.org. The code compiled and I am getting messages on the COM5 terminal but they are not messages that I was hoping for. The first figure here displays the messages I am getting. The second figure displays the code that I am using. Note: the LMIC_setupChannel code is commented out. When I getting the cstring error message it was the LMIC_setupChannel code is not commented out.

LoRaShieldCOM5

LoRashieldcode
LoRashieldcode1
LoRashieldcode2
LoRashieldcode3
LoRashieldcode4
LoRashieldcode5
LoRashieldcode6

Have you considered posting text in stead of pictures? Text is a lot easier to read and someone trying to help can cut-and-paste it to their Arduino IDE which is not possible with pictures.
Please use the instructions in this message on how to properly format a post on the forum.

What messages were you hoping for?

Your “Unknown Event” is probably the join attempt notification added to the MCCI LMiC in the past year but not recognized in many sketches. That’s been covered here before.

Likely your node is failing to successfully receive either due to wrong settings or wrong timing.

Also your use of the word “upload” for adding an include directive to a header is incorrect and meaningless. It seems like you have been mixing code from multiple sources, which is a fairly risky thing to do as it is likely to lead to hard-to understand complications.

First get things working using code form only a single source. Then only add complications one by one, keeping careful track of what you’ve changed (for example by using a version control system) so that you understand exactly which change broke the setup.

I am hoping that I would not have any issues with the lmic.h configuration and have zero errors when I ran the program. In addition I was hoping that on the COM5 terminal it would look like this:

COM5ter

Here is the code copied out instead.


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

// LoRaWAN NwkSKey, network session key
// This is the default Semtech key, which is used by the prototype TTN
// network initially.

//lorashieldtest device Network Session Key 
static const PROGMEM u1_t NWKSKEY[16] = { 0x67, 0xAD, 0x37, 0xE5, 0xDD, 0x28, 0x1F, 0x6A, 0xC9, 0xF7, 0x85, 0x7E, 0x3E, 0xB2, 0x79, 0xAC };

// LoRaWAN AppSKey, application session key
// This is the default Semtech key, which is used by the prototype TTN
// network initially.
//lorashieldtest device App session key 
static const u1_t PROGMEM APPSKEY[16] = { 0xF2, 0x92, 0xED, 0x39, 0x63, 0x95, 0xE7, 0x30, 0xD2, 0xDB, 0xC2, 0x5F, 0x36, 0xAD, 0xBD, 0xD5 };

//lora shield Device address node 
// LoRaWAN end-device address (DevAddr)
// See http://thethingsnetwork.org/wiki/AddressSpace
static const u4_t DEVADDR = 0x26021C63; // <-- Change this address for every node!

// These callbacks are only used in over-the-air activation, so they are
// left empty here (we cannot leave them out completely unless
// DISABLE_JOIN is set in config.h, otherwise the linker will complain).
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;

// Schedule TX every this many seconds (might become longer due to duty
// cycle limitations).
const unsigned TX_INTERVAL = 10;

// Pin mapping Dragino Shield 
const lmic_pinmap lmic_pins = {
  .nss = 10,
  .rxtx = LMIC_UNUSED_PIN,
  .rst = 9,
  .dio = {2, 6, 7},
};

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;
      break;
    case EV_TXCOMPLETE:
      Serial.println(F("EV_TXCOMPLETE (includes waiting for RX windows)"));
      if (LMIC.dataLen) {
        // data received in rx slot after tx
        Serial.print(F("Data Received: "));
        Serial.write(LMIC.frame + LMIC.dataBeg, LMIC.dataLen);
        Serial.println();
      }
      // 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;
  }
}

//this is what will be shown in the COM5 terminal
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"));
    Serial.println(LMIC.freq);
  }
  // Next TX is scheduled after TX_COMPLETE event.
}

void setup() {
  //on the COM terminal have the baud rate set to 115200
  //no line ending 
  //leave it on auto scroll
  Serial.begin(115200);
  Serial.println(F("Starting"));

#ifdef VCC_ENABLE
  // For Pinoccio Scout boards
  pinMode(VCC_ENABLE, OUTPUT);
  digitalWrite(VCC_ENABLE, HIGH);
  delay(1000);
#endif

  // LMIC init
  os_init();
  // Reset the MAC state. Session and pending data transfers will be discarded.
  LMIC_reset();

  // Set static session parameters. Instead of dynamically establishing a session
  // by joining the network, precomputed session parameters are be provided.
#ifdef PROGMEM
  // On AVR, these values are stored in flash and only copied to RAM
  // once. Copy them to a temporary buffer here, LMIC_setSession will
  // copy them into a buffer of its own again.
  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
  // If not running an AVR with PROGMEM, just use the arrays directly
  LMIC_setSession (0x1, DEVADDR, NWKSKEY, APPSKEY);
#endif

  // Set up the channels used by the Things Network, which corresponds
  // to the defaults of most gateways. Without this, only three base
  // channels from the LoRaWAN specification are used, which certainly
  // works, so it is good for debugging, but can overload those
  // frequencies, so be sure to configure the full frequency range of
  // your network here (unless your network autoconfigures them).
  // Setting up channels should happen after LMIC_setSession, as that
  // configures the minimal channel set. 

//when i was running the program with the LMIC_setupChannel commented out I was getting 
//start packet queue unknown 
//when I uncommented the LMIC_setupChannel the program said that there was no such directory //lmic.h

 // LMIC_setupChannel(0, 915000000, DR_RANGE_MAP(DR_SF12, DR_SF7),  BAND_CENTI);      // g-band
 // LMIC_setupChannel(1, 915000000, DR_RANGE_MAP(DR_SF12, DR_SF7B), BAND_CENTI);      // g-band
 // LMIC_setupChannel(2, 915000000, DR_RANGE_MAP(DR_SF12, DR_SF7),  BAND_CENTI);      // g-band
 // LMIC_setupChannel(3, 915000000, DR_RANGE_MAP(DR_SF12, DR_SF7),  BAND_CENTI);      // g-band
 // LMIC_setupChannel(4, 915000000, DR_RANGE_MAP(DR_SF12, DR_SF7),  BAND_CENTI);      // g-band
 // LMIC_setupChannel(5, 915000000, DR_RANGE_MAP(DR_SF12, DR_SF7),  BAND_CENTI);      // g-band
 // LMIC_setupChannel(6, 915000000, DR_RANGE_MAP(DR_SF12, DR_SF7),  BAND_CENTI);      // g-band
 // LMIC_setupChannel(7, 915000000, DR_RANGE_MAP(DR_SF12, DR_SF7),  BAND_CENTI);      // g-band
 // LMIC_setupChannel(8, 915000000, DR_RANGE_MAP(DR_FSK,  DR_FSK),  BAND_MILLI);      // g2-band
  // TTN defines an additional channel at 869.525Mhz using SF9 for class B
  // devices' ping slots. LMIC does not have an easy way to define set this
  // frequency and support for class B is spotty and untested, so this
  // frequency is not configured here.

  for (int channel = 0; channel < 8; ++channel) {
    LMIC_disableChannel(channel);
  }
  for (int channel = 9; channel < 72; ++channel) {
    LMIC_disableChannel(channel);
  }

  // Disable link check validation
  LMIC_setLinkCheckMode(0);

  // Set data rate and transmit power (note: txpow seems to be ignored by the library)
  LMIC_setDrTxpow(DR_SF7, 14);

  // Start job
  do_send(&sendjob);
}

void loop() {
  os_runloop_once();
} 

I was hoping you would read and use the information on formatting a posting on the forum I linked to in my previous message. I guess we are both disappointed…