Basics questions on LMIC

(Lo Ra Pf Eensip2017) #1

Hello, everyone.

I am a student that try to connect some sensors to TTN with a Dagino LoRa shield and a Arduino Uno. I manage to send one data by following the example given on the LMIC github, but when I try other thing I fail. So I have few questions that could help me to understand why I fail.

Is that possible to use the LMIC like a " USB serial " usual library ? (I mean don’t use a scheduled callback and just tell “I have finish my job and send now”)

I have the feeling that something don’t work during the initialisation phases when I don’t use
os_runloop_once(). Is that true ?

When I use LMIC_startJoining(), I never get the EV_JOINING and the others, why ? There is something other needed ?

What exactly is a osjob_t variable ?

So if someone have time to answer me, think you.


I have no knowledge about the Dagino shield… but when you have installed the lmic library in your Arduino Ide you have under examples/ibm lmic framework the ttn-otaa example which is ready for working after you have added your APPEUI, DEVEUI and the16Byte APPKEY from your app and device registrationyou did. app- and deveui have to be coded in reverse order from what you see in your console app and device information. Also you have to tell lmic what radio to use in config.h. The RFM95W correct setting is #define CFG_sx1276_radio 1 in C:\Users\xyz…\Documents\Arduino\libraries\IBM_LMIC_framework\src\lmic\config.h

all of this is also written in the comment section of the sample code.

To use this sketch, first register your application and device with the things network, to set or generate an AppEUI, DevEUI and AppKey. Multiple devices can use the same AppEUI, but each device has its own
DevEUI and AppKey. Do not forget to define the radio type correctly in config.h.

Also: Note that while a transaction is in process (i.e. until the TXcomplete event has been
received, no blocking code (e.g. delay loops etc.) are allowed, otherwise the LMIC/OS code might miss the event. If this rule is not followed, a typical symptom is, that the first send is ok and all following ones
end with the TX not complete failure.

(Lo Ra Pf Eensip2017) #3

Hello HanspeterH,

Thank you for your answer. I have solve my problem. As you said we must not bloc our program without Lmic hasn’t finish his work. That my mistake. But now it solve.

If we don’t want to use the tx_interval example we can do this after each sending and this work well.

do_send(&sendjob, mydata);
//Run LMIC loop until he as finish
while(flag_TXCOMPLETE == 0)
flag_TXCOMPLETE = 0;