Skip to content
This repository has been archived by the owner on Oct 6, 2019. It is now read-only.

Difficulty to debug and make it working #4

Open
pierrot10 opened this issue Jul 25, 2017 · 3 comments
Open

Difficulty to debug and make it working #4

pierrot10 opened this issue Jul 25, 2017 · 3 comments

Comments

@pierrot10
Copy link

pierrot10 commented Jul 25, 2017

Helo
I am very new with Lora and I am trying to build a node with a Feather MO Lora board

I connect the pim has it's shown here

I also download the library LoRa-LMIC-1.51 as it's written here , and then I configured the code with

At TTN web site I created a new devise and I saved it as the following
// LoRaWAN Config
// Device Address
devaddr_t DevAddr = 0x26011942; // TTN Device Address

// Network Session Key
unsigned char NwkSkey[16] = { 0x25, 0x64, 0x48, 0xC4, 0x39, 0x57, 0x84, 0x89, 0x57, 0x33, 0xCA, 0x80, 0xF0, 0xF4, 0xA1, 0xD8 }; // TTN Network Session Key
                            
// Application Session Key
unsigned char AppSkey[16] = { 0x9A, 0xCB, 0xE8, 0x23, 0x4D, 0xC5, 0xCB, 0x37, 0xDB, 0x33, 0x85, 0x28, 0xCD, 0x28, 0x16, 0x01 }; // TTN App Session Key

// LoRaWAN Application identifier (AppEUI)
static const u1_t AppEui[8] PROGMEM = { 0x70, 0xB3, 0xD5, 0x7E, 0xF0, 0x00, 0x64, 0x29 }; // TTN Application EUI

I upload my code and here is the print I got
(I add some debug point. All print starting with "DEBUG: ..." are debug I added into the code)

Beginning to send data
seqno 1: Battery: 4.24
LMIC_setTxData2
DEBUG: engineUpdate
DEBUG: End engineUpdate
dataSent2:0
seqno 1: Free Memory: 28735
LMIC_setTxData2
DEBUG: engineUpdate
DEBUG: End engineUpdate
DEBUG: engineUpdate
DEBUG: processDnData
DEBUG: onEvent
DEBUG: EV_TXCOMPLETE
DEBUG: engineUpdate
Sleeping for 92 seconds

But nothing is recorded into my TTN console even if I am close within 5km of a gateway.
How should I exactly configure my devise by TTN?

Into the sketch file, I also observed the followin initLoRaWAN() function;

Is there a way debug if the node joned the nearest gateway?
Is tere a way to have thr following funtion to return true or flase?
Is there a way to know if data has been recorded or not to TTN?
If I am on the train, does the node will send message to a gateway if the train through an area coavered by a gateway? Or does the node have to join first a gateway and a node can not move...

I thank a lot if you tell me more about Feather MO Lora board with the goal to send sensor measurement to TTN

Many thank

void initLoRaWAN() {
	// LMIC init
  sprintln(F("=> os_init"),2);
	os_init();

	// Reset the MAC state. Session and pending data transfers will be discarded.
  sprintln(F("=> LMIC_reset"),2);
	LMIC_reset();

	// by joining the network, precomputed session parameters are be provided.
	sprintln(F("=> Joining network"),2);
	LMIC_setSession(0x1, DevAddr, (uint8_t*)NwkSkey, (uint8_t*)AppSkey);

	// Enabled data rate adaptation
  sprintln(F("=> Enable data rate adaptation)"),2);
	LMIC_setAdrMode(1);

	// Enable link check validation
  sprintln(F("=> Enable link check validation"),2);
	LMIC_setLinkCheckMode(0);

	// Set data rate and transmit power
  sprintln(F("=> Set data rate and transit power"),2);
	LMIC_setDrTxpow(DR_SF12, 21);
}
@pierrot10
Copy link
Author

Hello, I am sorry to come back to this issue but I am still experiencing that issue. I would appreciate if someone can tell how to make it working with TTN. Cheers and great day!

@grhabyt
Copy link

grhabyt commented Dec 21, 2017

@mikenz First, thanks for the library, it's much easier to follow than most approaches. I am also trying to get this going with TTN. Could you provide some sample code?
@pierrot10 I read somewhere else that the TTN DevEUI and the AppEUI need to be little-endian, but the AppKey should be big-endian. Does that help?

@mikenz
Copy link
Owner

mikenz commented Dec 24, 2017

Hi, there's no TTN gateways near me, only two in the whole country, so it's not something I'll be looking at any time soon.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants