LMIC FOR STM32CubeMX in 15 minutes

Thank you for the information link @descartes

Now, Im testing my end node with the code from @skovholm. I can see it on my GW but it cannot join on TTN console. I got a MIC Mismatch error. I checked my DEVEUI, APPEUI, and former devdeky (now APPKEY). Im using LoRaWAN version 1.0.1 but I tried with 1.0.3 too, but I have the same problem.

What could be the problem?

Regards.

Check the docs for the endian-ness of the EUIs.

The AppKey is not end sensitive.

Hi @descartes

I reversed the bytes of APPKEY, but it doesn’t work. I was reanding about endian-ness. Are you trying to tell me that I should enter my numbers without inverting because APPKEY is in Big Endian, and DEVEUI and APPEUI are on little endian?

No, I was pretty clear that the AppKey is not end sensitive. Whereas the EUI’s are endian specific which is why you need to check the docs. So pretty much the reverse of your interpretation.

If you are using the ancient code base of the IBM LMIC of 2016 it may not be clear. More recent versions are clear. More recent versions are far more compatible with pretty much everything LoRaWAN so you may get the code base at the top of this thread working, it wasn’t a good choice, which is why I directed you to LMIC-node which has gold-plated documentation with gift-wrapping.

In the meanwhile, if you’ve had your EUI’s MSB, try them LSB. DO NOT try to mix & match - it’s either BOTH MSB or BOTH LSB.

1 Like

hello everybody

i have used this lib and project last day and every thing was ok. it joins to ttn very fast by sending just 1 or 2 request join

but i test it today and it takes 20min to connect successfully

and this is my gateway log and rssi


my distance from gateway is about 30m with couple of brick wall

Referencing your duplicate post, this is by design - you are likely recycling the DevNonce and duplicates are rejected by the LNS. For development work you can turn this off in the console or you can make your version aligned with LMIC which does NOT support v1.0.4 incrementing Nonces.

Edit 11 Jan: failed to include NOT in the last sentence - LMIC doesn’t support incrementing DevNonces as required for v1.0.4 so you MUST use v1.0.3

actually i need to have deep undrestand of concept of lorawan
but i only study “the thing network” document could you give me road map to have better undrestand of it
i didnt found anything with this title in forum does it exist?

thank you my friend
i test it and this is result
Screenshot from 2024-01-11 10-03-39

i found somewhere in my code that devNonce variable initialize with a random number and i comment it and asign a fix value to that

please give more detail I’m too much beginer

That will guarantee it gets re-used…which is the problem. :frowning: You want a value (preferably random?) that increments each time and isnt re-used. Note any given device has a limited pool of DevNonces (actually quite a lot!) which under normal use & life time operation should not become exhausted, but if joining regularly (some badly witten s/w joins every time before 1st data TX and is a waste of space/should be avoided like the plague) such that you run out in the working life of the device then only option is to delete device in LNS and start again!

How about the Learn link at the top of the every forum page? And the link bottom right to the documentation on every console page?

And then there is the LoRaWAN specification on the LoRa Alliance website.

There is an error in my post above - I missed a not - I’ve edited this now - LMIC does NOT support v1.0.4 so if you’ve selected that as your device version, it will need to be changed to v1.0.3

1 Like

Screenshot from 2024-01-13 12-49-11
I have enabled reset join nonces and reset used DevNonces
you mean this steps?

i did them but still reJoining time is around 15min

We’d need some more info on what it’s doing for those 15 minutes - serial logs from the device as text formatted with the </> tool plus screen shots at a reasonable “old person” resolution of the exact same time from the device console in verbose mode.

sorry for big delay
i am posting console log as you say
and notice that it is first join attemp takes 20min to join
serial log:

============== DEBUG STARTED ==============
JOINING
try joining
EV_TXSTART
Unknown event
EV_TXSTART
Unknown event
EV_TXSTART
Unknown event
EV_TXSTART
Unknown event
EV_TXSTART
Unknown event
EV_TXSTART
Unknown event
EV_TXSTART
Unknown event
EV_TXSTART
Unknown event
JOINED
val = 000000DF
EV_TXSTART
Unknown event
TXCOMPLETE
EV_TXCOMPLETE (includes waiting for RX windows)
val = 000000DF
EV_TXSTART
Unknown event
val = 000000DF
TXCOMPLETE
EV_TXCOMPLETE (includes waiting for RX windows)

console log:




after i enabled Reset join nonce
and press Reset used DevNonce




A summary of what you see would help speed up feedback. And please format serial logs with the </> tool

in summery I’m using lmic in stm32 and testing otaa joining method
but there is 2 problem:

  1. it takes to much time to join something around 20min
  2. and when i reset the device or reprogram it connecting takes to much time although i heve “reset used devnonce” key in console setting

my first pictures is console log for first time joining
and second pictures is console log after reseting device

main question is how i can reduce this time buecaus i’m in developing and i need to test many times???

device log(even dont have any thing helpfull):

============== DEBUG STARTED ==============
JOINING
try joining
EV_TXSTART
Unknown event
EV_TXSTART
Unknown event
EV_TXSTART
Unknown event
EV_TXSTART
Unknown event
EV_TXSTART
Unknown event
EV_TXSTART
Unknown event
EV_TXSTART
Unknown event
EV_TXSTART
Unknown event
JOINED
val = 000000DF
EV_TXSTART
Unknown event
TXCOMPLETE
EV_TXCOMPLETE (includes waiting for RX windows)
val = 000000DF
EV_TXSTART
Unknown event
val = 000000DF
TXCOMPLETE
EV_TXCOMPLETE (includes waiting for RX windows)

This!

I meant a summary of any differences you may have seen after you’d done the reset

actually no defferences after reset!
do you have any idea what should i do? :man_facepalming:

Your RSSI/SNR looks OK, there aren’t any warnings in the console about the DevNonce, so I’d have to suspect that something is stopping the device from hearing the Join Accept. Potentially:

  • The gateway is not transmitting the accept - you can check on the gateway console
  • The antenna is inefficient, compensated for by the device transmitting at a high power providing a good signal, but the antenna isn’t quite right for listening.
  • The timing is badly out due to other threads on the device so it misses the receive window - you’ll need to turn on the timestamps on the serial log so we can see what it is doing.

Hi everyone,

Im still developing my project but now I have another problem.

I developed a Node Red app that sends a hexadecimal data (B6 BB 9E). I can see it on ttn console without problem. The problem comes when my board read the MAC payload as B6 BB 9E.
You can think that I coded this interpretation on my stm32 project but I didn’t. That’s what I want but even if I have my Node Red app closed, it’s still interpreting the same way.

I post 2 pictures to better understanding
image
image

All the answer are welcomed.

Thank you.