Samr34 problem with call back function

Hallo,
I am doing a LoraWAN Project with SAMR34,
I am doing a project based on serial network provisioning(´similar to example project : Serial Network Provisioning in Atmel)

I have a problem with the call back function in the joining process.
Once the joining activation procedure is finished , it should call the call back function for finishing the activation procedure(join_callback())

When I tried to do the same, I can see in TTN network my DEVAddr, DEVEUI and AppEUI appears,
but the function Lorawan_join is not calling the callback function.

What can be the problem?
if any has idea , kindly please share your thoughts and ideas.

thanks

These are the things that need to happen:

  1. join request transmitted
  2. join request received through gateway by network server
  3. join accept generated by network server
  4. join accept transmitted by gateway
  5. join accept received by node
  6. join accept decoded by node to enter a joined state

It sounds like so far you are accomplishing some of the first few steps, but you should check in the TTN console to make sure that both the join request and join accept have occurred.

If that is the case, the next step would be to look into the internals of the node firmware - make sure you can tell when it enters receive mode (and with what frequency and spreading factor settings), and if it does or does not receive a raw packet. Because the timing there is critical it may be better to put the debug printout only after reception has either succeeded or failed (if logs show that a join accept is being transmitted in RX2, you need to be careful that debug printout from RX1 does not throw off the timing of activating the second receive window)

If you are sure the join accept is being transmitted, and your node is receiving wit the matching settings, then you may need to look into timing errors. Have your node firmware toggle a GPIO at the end of transmit and at the start and end of receive, and watch that on a scope or logic analyzer. If the gateway is nearby, getting another scope probe on its trasmit LED is a great way to directly compare the timing of that to that of the receiver.

2 Likes

Hallo,
Thankyou for the information.

I will go throught it and write the updates here.

@cslorabox Hai,

The example project is working fine and I am able to send data packets.

The project which I am doing right is now is similar to the example project Serial Network Provisioning example project given in the Atmel Studio.

Major Part of the project is based on Task scheduling.

I have replaced the tasks given in the example projects with tasks needed for my project, rest everything is coinfigured with the default settings.

When I try to debug the example project, the function goest to the call back for the activation procedure once it reaches the Lorawan_Join.
But if I try to do the same with my project, it joins the network, but doesnt goes through the call backfunction for the activation procedure and due to that I am anot able to read the device address.

What do you think, I should modify?
If anyone elsehas an idea, kindly please share!!

Hello,

Finally the problem was solved, This happend because Lorawan initialisation was not succesfull.
The problem was solved by debugging the code with actions(similar to giving conditions).
The over all task scheduling is done with a system task manager.

So, to find the error, In Atmel Studio ATSAMR34 a breakpoint with actions was applied to the function where the task scheduling interchanges.
From, this we can view the task changing after each command is being processed.

This way, we can find the error and understand which task is not scheduled

Hope this would help out for someone!