Problem in transmission on TTN and Helium network with CubeCell Dev-Board HTCC-AB01

Hi everyone,
I have a problem with the ubeCell Dev-Board HTCC-AB01, I cannot transmit data on the TTN and on the Helium network, I don’t understand where I am wrong, I am attaching the code:
The netmode used is OTAA.

#include <LoRaWan_APP.h>
#include <Arduino.h>
#include <Seeed_BME280.h>
#include <Wire.h>

/* OTAA para TTN*/
uint8_t devEui = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
uint8_t appEui = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
uint8_t appKey = { 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88 };

/* ABP para TTN*/
uint8_t nwkSKey = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
uint8_t appSKey = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
uint32_t devAddr = ( uint32_t )0x00000000;

/* OTAA para HELIUM*/
//uint8_t devEui = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
//uint8_t appEui = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
//uint8_t appKey = { 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88 };

/* ABP para HELIUM*/
//uint8_t nwkSKey = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
//uint8_t appSKey = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
//uint32_t devAddr = ( uint32_t )0x00000000;

bool ENABLE_SERIAL = true; // enable serial debug output here if required
uint32_t appTxDutyCycle = 120000; // the frequency of readings, in milliseconds(set 300s)

uint16_t userChannelsMask[6]={ 0x00FF,0x0000,0x0000,0x0000,0x0000,0x0000 };
LoRaMacRegion_t loraWanRegion = ACTIVE_REGION;
DeviceClass_t loraWanClass = LORAWAN_CLASS;
bool overTheAirActivation = LORAWAN_NETMODE;
bool loraWanAdr = LORAWAN_ADR;
bool keepNet = LORAWAN_NET_RESERVE;
bool isTxConfirmed = LORAWAN_UPLINKMODE;
uint8_t appPort = 2;
uint8_t confirmedNbTrials = 4;

int temperature, humidity, batteryVoltage, batteryLevel;
long pressure;

BME280 bme280;

static void prepareTxFrame( uint8_t port )
{
// This enables the output to power the sensor
pinMode(Vext, OUTPUT);
digitalWrite(Vext, LOW);
delay(500);

if(!bme280.init()){
if(ENABLE_SERIAL){
Serial.println(“Device error!”);
}
}

// This delay is required to allow the sensor time to init
delay(500);

temperature = bme280.getTemperature() * 100;
humidity = bme280.getHumidity();
pressure = bme280.getPressure();

Wire.end();

// Turn the power to the sensor off again
digitalWrite(Vext, HIGH);

batteryVoltage = getBatteryVoltage();
batteryLevel = (BoardGetBatteryLevel() / 254) * 100;

appDataSize = 12;
appData[0] = highByte(temperature);
appData[1] = lowByte(temperature);

appData[2] = highByte(humidity);
appData[3] = lowByte(humidity);

appData[4] = (byte) ((pressure & 0xFF000000) >> 24 );
appData[5] = (byte) ((pressure & 0x00FF0000) >> 16 );
appData[6] = (byte) ((pressure & 0x0000FF00) >> 8 );
appData[7] = (byte) ((pressure & 0X000000FF) );

appData[8] = highByte(batteryVoltage);
appData[9] = lowByte(batteryVoltage);

appData[10] = highByte(batteryLevel);
appData[11] = lowByte(batteryLevel);

if(ENABLE_SERIAL){
Serial.print("Temperature: ");
Serial.print(temperature / 100);
Serial.print(“C, Humidity: “);
Serial.print(humidity);
Serial.print(”%, Pressure: “);
Serial.print(pressure / 100);
Serial.print(” mbar, Battery Voltage: “);
Serial.print(batteryVoltage);
Serial.print(” mV, Battery Level: “);
Serial.print(batteryLevel);
Serial.println(” %”);
}
}

void setup()
{

boardInitMcu();
if(ENABLE_SERIAL){
Serial.begin(115200);
}
deviceState = DEVICE_STATE_INIT;
LoRaWAN.ifskipjoin();

}

void loop()
{
switch( deviceState )
{
case DEVICE_STATE_INIT:
{
printDevParam();
LoRaWAN.init(loraWanClass,loraWanRegion);
deviceState = DEVICE_STATE_JOIN;
break;
}
case DEVICE_STATE_JOIN:
{
LoRaWAN.join();
deviceState = DEVICE_STATE_SEND;
break;
}
case DEVICE_STATE_SEND:
{
prepareTxFrame( appPort );
LoRaWAN.send();
deviceState = DEVICE_STATE_CYCLE;
break;
}
case DEVICE_STATE_CYCLE:
{
// Schedule next packet transmission
txDutyCycleTime = appTxDutyCycle + randr( 0, APP_TX_DUTYCYCLE_RND );
LoRaWAN.cycle(txDutyCycleTime);
deviceState = DEVICE_STATE_SLEEP;
break;
}
case DEVICE_STATE_SLEEP:
{
LoRaWAN.sleep();
break;
}
default:
{
deviceState = DEVICE_STATE_INIT;
break;
}
}
}

In the TTN console I don’t see any join message while in Helium I only see many Join request and Join Accept messages. In the serial monitor I see that it stops in the join phase giving me an error after a few minutes. I ask you for help, I am quite frustrated. Thank you

Helium questions are utterly and completely off topic here.

As for the TTN case, where’s the nearest gateway you were hoping to use?

Hi cslorabox,
The nearest gateway is about 2 km, I attach a map for more details.
Thanks a lot.

Immagine 2022-01-15 112911

What is the intervening land topology and any building clutter? If a hill in the way for either GW (are they both on TTN?) or if substantial buildings intervene you may not good coverage. Can you confirm in RF range? Can you move closer to either GW for initial testing? The GW to WNW may be helped by the ‘urban canyon’ effect of the main road but there is no guarantee of coverage. Built urban environments may get >5km range, but equally may struggle to get >500m. How high (absolute ref MSL and ref LGL) is you node and the GW’s? What do you know about the GW’s - indoor (antenna) or external?

Actually a quick check on local layout suggests immediate topology relatively flat - 129-135m Ref MSL so that is unlikely the issue - more a problem of city centre urban building clutter, poor antenna connection or lack of relative height - can you get higher in your building? (Or better yet get within 50-250m or one of the GW’s) assuming your node firmware is correct.
image

Hi Jeff,
thank you very much for the support, my location is about 30 meters at the street level (8th and last floor), I will try to get close to the gateway, I also know it should be like this: Kerlink Ifemtocell Office. For the node firmware I used the base of the Heltec library, it should be corrected.
Thanks

Given the gateway is some distance away and you presumably don’t have access to see its raw feed, this is going to be a bit harder to debug.

Any chance you can find a cafe or public internet access point within a few hundred meters of the gateway and go there with the node and your laptop and see if you get any better success?

@armisim99 or head to either of the public parks/green spaces nearby either one? Spend 15-30 mins on a bench seat and you may get lucky or atleast gather a decent set of logs (device & console) :wink:

Don’t forget to wave the device with the antenna clearly visible, it will help the Police snipers get a clear shot.

Do this in a cafe, last I checked there were some very nice ones around Porta Nuova, much better. Or buy a gateway.

Now that we’ve had our fun, what would be most useful would be a location where you can see all the way to the gateway installation with no obstructions (but are at least 10-20 meters from it so as not to overload it), and where you have Internet access to monitor the results, either via public wifi, or by tethering through your phone.

Did you populate your node keys? Hope you only blanked them out for posting purposes. Also check that you do have them in the correct order (LSB or MSB).

You do have a lot of building clutter in your area.

You have 4 gateways in your area, so dependent on the noise in the EU band and the buildings I would have thought one should have RX you.

kerlink-ifemtocell-office - 2 KM
RAK7258-9181000S20300052 - 2.15 km
NeosGate_1 - 3.51 KM
rak7244 - 5.66 KM

Hi guys,
The problem is that I was too far from the gateway.
Thank you for all of your support

I have some error compiling the code above…
libraries\LoRa\LoRaWan_APP.cpp.o: In function LoRaWanClass::join()': C:\Users\alexandru.luchiian\AppData\Local\Arduino15\packages\CubeCell\hardware\CubeCell\1.4.0\libraries\LoRa\src/LoRaWan_APP.cpp:643: undefined reference to devAddr’
C:\Users\alexandru.luchiian\AppData\Local\Arduino15\packages\CubeCell\hardware\CubeCell\1.4.0\libraries\LoRa\src/LoRaWan_APP.cpp:643: undefined reference to nwkSKey' C:\Users\alexandru.luchiian\AppData\Local\Arduino15\packages\CubeCell\hardware\CubeCell\1.4.0\libraries\LoRa\src/LoRaWan_APP.cpp:643: undefined reference to appSKey’
C:\Users\alexandru.luchiian\AppData\Local\Arduino15\packages\CubeCell\hardware\CubeCell\1.4.0/cores/asr650x/projects/CubeCellLib.a(AT_Command.o): In function getNetInfo': D:\lib\650x/AT_Command.c:1969: undefined reference to devAddr’
D:\lib\650x/AT_Command.c:1969: undefined reference to nwkSKey' D:\lib\650x/AT_Command.c:1969: undefined reference to appSKey’
C:\Users\alexandru.luchiian\AppData\Local\Arduino15\packages\CubeCell\hardware\CubeCell\1.4.0/cores/asr650x/projects/CubeCellLib.a(AT_Command.o): In function printDevParam': D:\lib\650x/AT_Command.c:2006: undefined reference to nwkSKey’
D:\lib\650x/AT_Command.c:2006: undefined reference to appSKey' D:\lib\650x/AT_Command.c:2006: undefined reference to devAddr’
collect2.exe: error: ld returned 1 exit status
exit status 1
Error compiling for board CubeCell-Board(HTCC-AB01).