Electric Imp/RN2903 to ESP32/RFM95W

Trying to simulate following Arduino code which uses LMIC Library
in order to communicate with an ESP32 and RFM95W HopeRF chip gateway
as described at https://www.sparkfun.com/products/15006
This is for US 915 MHz

There are two code excerpts below. The first is the ESP32/RFM95W Arduino code used to communicate with its corresponding EPS32/RFM95W LoRaWAN gateway. The ESP32/RFM95W device and gateway were able to communicate with TTN.

The second block of code is my attempt to set up an RN2903 chip connected to an Electric Imp (www.electricimp.com) to communicate with the EPS32/RFM95W gateway.

Communication is established with the RN2903 and Electric Imp, and I can monitor the “ok” responses from the commands. Is it possible for the RN2903 to communicate with the RFM95W gateway? Am I missing something in the setup? Any insight would be appreciated.

// LMIC init used for node

// Reset the MAC state. Session and pending data transfers will be discarded.
// Set static session parameters. Instead of dynamically establishing a session
// by joining the network, precomputed session parameters are be provided.
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);

// slip to CFG_us915 below
#if defined(CFG_eu868) // EU channel setup
// Set up the channel used by the Things Network and compatible with
// our gateway.
// Setting up channels should happen after LMIC_setSession, as that
// configures the minimal channel set.
LMIC_setupChannel(0, 868100000, DR_RANGE_MAP(DR_SF12, DR_SF7), BAND_CENTI); // g-band

#elif defined(CFG_us915) // US channel setup
// Instead of using selectSubBand, which will cycle through a sub-band of 8
// channels. We’ll configure the device to only use one frequency.
// First disable all sub-bands
for (int b = 0; b < 8; ++b) {
// Then enable the channel(s) you want to use
LMIC_enableChannel(8); // 903.9 MHz
// Disable link check validation
// 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_SF8, 14);
// Start job – Transmit a message on begin

// Initialization commands sent from Electric Imp to RN2903
// trying to simulate the LMIC code above

// Excerpt below is representative of actual code to show the
// RN2903 commands

“mac reset”,
format("%s nwkskey %s", MAC_SET, NWKSKEY),
format("%s appskey %s", MAC_SET, APPSKEY),
format("%s devaddr %s", MAC_SET, DEVADDR),
“mac set ar off”,
“mac set pwridx 5”,
“mac set dr 4”,
“mac save”,
“mac join abp”,
“mac pause”

// add “mac set ch status on/off” commands
// turn off all but channels 8 and 17
for (local i = 0; i < 72; i++) {
local str = format("mac set ch status %i ", i);
local onoff = “off”;
if(i == 8 || i == 17) onoff = “on”;
str += onoff; // add onoff to mac command
initCommands.push(str); // add command

initCommands.push(“mac set linkchk 0”); // disable link check validation
initCommands.push(“radio set sf sf9”); // spreading factor 9
initCommands.push(“mac set dr 2”); // set data rate
initCommands.push(“radio set pwr 14”); // power level
initCommands.push(“mac resume”);

// list of init commands are now executed

// Later Transmit commands sent from Electric Imp to RN2903
LoRaSend(“radio tx 48656c6C6F”); // send “Hello”
LoRaSend(“mac resume”);

Response from RN2903
receive message: mac_tx_ok