Hey, i am currently having Problems Connecting to the Helium Network correctly. I am using an Htcc-ab02.
All my Event Log (Helium Console) shows are repetetive “Join Request” and “Join Accept” notifications. The Only diffrence in these is, that the Frequency between the Requests are changing slightly (my Region is EU868). An example, some “Join Request” and its “Join Accept” response are on Frequency 868.50, others are on Frequency 868.10.
(My only guess right now is, that my board might be listening on the wrong frequency, but couldn’t find out where to set the Frequency to a specific value)
Im quite new to this and im not able to find the problem, would be great to get some help, thanks.
My Serial Output Looks like this:
AT Rev 1.3
+AutoLPM=1+LORAWAN=1
+KeepNet=0
+OTAA=1
+Class=A
+ADR=0
+IsTxConfirmed=0
+AppPort=2
+DutyCycle=15000
+ConfirmedNbTrials=4
+ChMask=00000000000000000000FF00
+DevEui=6081F946DEFA1B82(For OTAA Mode)
+AppEui=6081F95EDD224DC4(For OTAA Mode)
+AppKey=0387D52977D1C4BFD546DE870D6C65B5(For OTAA Mode)
+NwkSKey=15B1D0EFA463DFBE3D11181E1EC7DA85(For ABP Mode)
+AppSKey=D72C78758CDCCABF55EE4A778D16EF67(For ABP Mode)
+DevAddr=007E6AE1(For ABP Mode)LoRaWAN EU868 Class A start!
joining…TX on freq 868500000 Hz at DR 4
TX on freq 868500000 Hz at DR 4
Event : Tx Done
RX on freq 868500000 Hz at DR 4
Event : Rx Timeout
RX on freq 869525000 Hz at DR 0
Event : Rx Timeout
TX on freq 868100000 Hz at DR 5
TX on freq 868100000 Hz at DR 5
Event : Tx Done
RX on freq 868100000 Hz at DR 5
Event : Rx Timeout
RX on freq 869525000 Hz at DR 0
Event : Rx Timeout
TX on freq 868100000 Hz at DR 5
TX on freq 868100000 Hz at DR 5
Event : Tx Done
RX on freq 868100000 Hz at DR 5
Event : Rx Timeout
RX on freq 869525000 Hz at DR 0
Event : Rx Timeout
TX on freq 868100000 Hz at DR 5
TX on freq 868100000 Hz at DR 5
Event : Tx Done
RX on freq 868100000 Hz at DR 5
Event : Rx Timeout
RX on freq 869525000 Hz at DR 0
Event : Rx Timeout
TX on freq 868500000 Hz at DR 5
TX on freq 868500000 Hz at DR 5
Event : Tx Done
RX on freq 868500000 Hz at DR 5
Event : Rx Timeout
RX on freq 869525000 Hz at DR 0
Event : Rx Timeout
TX on freq 868500000 Hz at DR 5
TX on freq 868500000 Hz at DR 5
Event : Tx Done
My Code is the following:
include “LoRaWan_APP.h”
#include “Arduino.h”
//board_build.arduino.lorawan.region = EU868
/*
set LoraWan_RGB to Active,the RGB active in loraWan
RGB red means sending;
RGB purple means joined done;
RGB blue means RxWindow1;
RGB yellow means RxWindow2;
RGB green means received done;
*/
/* OTAA para*/
uint8_t devEui[] = {0x60, 0x81, 0xF5, 0x46, 0xDE, 0xFA, 0x1B, 0x82};
uint8_t appEui[] = {0x60, 0x81, 0xF5, 0x5E, 0xDD, 0x22, 0x4C, 0xC4};
uint8_t appKey[] = {0x03, 0x87, 0xD5, 0x29, 0x77, 0xE1, 0xC4, 0xBE, 0xD5, 0x47, 0xDB, 0x86, 0x0D, 0x6C, 0x65, 0xB5};
/* ABP para*/
uint8_t nwkSKey[] = { 0x15, 0xb1, 0xd0, 0xef, 0xa4, 0x63, 0xdf, 0xbe, 0x3d, 0x11, 0x18, 0x1e, 0x1e, 0xc7, 0xda,0x85 };
uint8_t appSKey[] = { 0xd7, 0x2c, 0x78, 0x75, 0x8c, 0xdc, 0xca, 0xbf, 0x55, 0xee, 0x4a, 0x77, 0x8d, 0x16, 0xef,0x67 };
uint32_t devAddr = ( uint32_t )0x007e6ae1;
/LoraWan channelsmask, default channels 0-7/
uint16_t userChannelsMask[6]={ 0xFF00,0x0000,0x0000,0x0000,0x0000,0x0000 };
/* NOTE: It is very important that these variables be defined correctly in the Arduino IDE Tools->Board options */
/LoraWan region, select in arduino IDE tools/
LoRaMacRegion_t loraWanRegion = ACTIVE_REGION;
/LoraWan Class, Class A and Class C are supported/
DeviceClass_t loraWanClass = LORAWAN_CLASS;
/OTAA or ABP/
bool overTheAirActivation = LORAWAN_NETMODE;
/ADR enable/
bool loraWanAdr = LORAWAN_ADR;
/* set LORAWAN_Net_Reserve ON, the node could save the network info to flash, when node reset not need to join again */
bool keepNet = LORAWAN_NET_RESERVE;
/* Indicates if the node is sending confirmed or unconfirmed messages */
bool isTxConfirmed = LORAWAN_UPLINKMODE;
/the application data transmission duty cycle. value in [ms]./
uint32_t appTxDutyCycle = 15000;
/* Application port */
uint8_t appPort = 2;
/*!
Number of trials to transmit the frame, if the LoRaMAC layer did not
receive an acknowledgment. The MAC performs a datarate adaptation,
according to the LoRaWAN Specification V1.0.2, chapter 18.4, according
to the following table:
Transmission nb | Data Rate
----------------|-----------
1 (first) | DR
2 | DR
3 | max(DR-1,0)
4 | max(DR-1,0)
5 | max(DR-2,0)
6 | max(DR-2,0)
7 | max(DR-3,0)
8 | max(DR-3,0)
Note, that if NbTrials is set to 1 or 2, the MAC will not decrease
the datarate, in case the LoRaMAC layer did not receive an acknowledgment
*/
uint8_t confirmedNbTrials = 4;
// This variable, defined in the runtime, tracks the number of uplinks sent.
// When this count reaches 65,535 the connection must be re-established.
// If you do not the device will continue to send data to the network but
// it will not make it to the Helium console.
// The value is tested below and a reconnection is forced if the counter
// equals 65534.
// refer to FCnt on this documentation page:
// https://developer.helium.com/longfi/mac-commands-fopts-adr
extern uint32_t UpLinkCounter;
/* Prepares the payload of the frame */
static void prepareTxFrame( uint8_t port )
{
/*appData size is LORAWAN_APP_DATA_MAX_SIZE which is defined in "commissioning.h". *appDataSize max value is LORAWAN_APP_DATA_MAX_SIZE. *if enabled AT, don't modify LORAWAN_APP_DATA_MAX_SIZE, it may cause system hanging or failure. *if disabled AT, LORAWAN_APP_DATA_MAX_SIZE can be modified, the max value is reference to lorawan region and SF. *for example, if use REGION_CN470, *the max value for different DR can be found in MaxPayloadOfDatarateCN470 refer to DataratesCN470 and BandwidthsCN470 in "RegionCN470.h". */ appDataSize = 4; appData[0] = 0x00; appData[1] = 0x01; appData[2] = 0x02; appData[3] = 0x03;
}
void setup() {
Serial.begin(9600);
#if(AT_SUPPORT)
enableAt();
#endif
deviceState = DEVICE_STATE_INIT; LoRaWAN.ifskipjoin(); LoRaWAN.displayMcuInit(); Serial.println("Setup finished");
}
void loop()
{
switch( deviceState ) { case DEVICE_STATE_INIT: {
#if(AT_SUPPORT)
getDevParam();
#endif
printDevParam(); LoRaWAN.init(loraWanClass,loraWanRegion); deviceState = DEVICE_STATE_JOIN; // This is a runtime API that is in the Heltec github // but has not yet made it to the Arduino install // version. (1.0.0) It's here for future reference // LoRaWAN.setDataRateForNoADR(DR_3); break; } case DEVICE_STATE_JOIN: { LoRaWAN.join(); break; } case DEVICE_STATE_SEND: { // Comment out this warning if you "really" do want // to enable ADR if (loraWanAdr == true) { Serial.println(">>>> WARNING: ADR is enabled.\n\tThis may reduce the datarate/Spreading Factor after about 100 uplinks"); } prepareTxFrame( appPort ); LoRaWAN.send(); deviceState = DEVICE_STATE_CYCLE; // the following is experimental but does seem to // re-initialize the connection correctly. See the note // at extern UpLinkCounter above if (UpLinkCounter == 65534) { // force a rejoin deviceState = DEVICE_STATE_INIT; } 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; } } delay(50);
}
platformio.ini File:
; PlatformIO Project Configuration File
;
; Build options: build flags, source filter
; Upload options: custom upload port, speed and extra flags
; Library options: dependencies, extra library storages
; Advanced options: extra scripting
;
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html
[env:cubecell_board_plus]
platform = asrmicro650x
board = cubecell_board_plus
framework = arduino
build_flags = -Wl,-Map,output.map
board_build.arduino.lorawan.region = EU868
board_build.arduino.lorawan.class = CLASS_A
board_build.arduino.lorawan.netmode = OTAA
board_build.arduino.lorawan.uplinkmode = UNCONFIRMED
board_build.arduino.lorawan.rgb = ACTIVE
board_build.arduino.lorawan.debug_level = FREQ_AND_DIO
board_build.arduino.lorawan.adr = OFF
board_build.arduino.lorawan.at_support = OFF
board_build.arduino.lorawan.net_reserve = OFF