Appkey always equals 0 in my custom model in BT mesh

Hello everyone,

I'm currently trying to create Bluetooth mesh custom client and server with the nrf connect sdk. 

The purpose of my application is to make my server send data automatically to my client when it receives a particular message from it.

A very common type of communication between a server and a client !

To send a message to my server, my client use the model publication context configurated by the Configuration Client Model. (so I use publish function)
To send a message to my client, my server use the publication context of my client request to respond to the client. (So I use send function)

My problem is that my server failed to respond to my client because the Appkey that it receives from my client always equals zero, and it doesn't recognize it. I have this error :

"E : Model don't bound to AppKey 0x000"

After this error, my server is no longer able to receive messages from my client.

I use the phone app nrf mesh to provision my node and to provide an AppKey to my Client and my Server.

If you have any idea about what can cause this problem it would be very helpful !

  • Hi Andreas, thank you so much for your reply and your help !
    Indeed, I'm a newbie with multithreading ... so I think the link to the course can help me !


    when you talk about my "tricks" you think about the way I recreated the publication context with using the address of the node which has sent the message as the destination address ? This method is not correct ?
    Or it was about my first example that didn't work where I was trying to use all the context as my thread argument ?

    Kind regards and thanks

  • Hi,

    lalum said:
    when you talk about my "tricks"

    I would first like to add that if they work without causing issues down the line, they are completely viable , but in this case what you will most likely face is that when you use a pointer to a local variable frome one thread as incomming data for another thread, you can not guarantee that the variable exists. As an example, the incoming data to some callback will not exist outside the callback context.

    I also believe this question might be more sufficiently answered by my colleague in case #293377 (if thats the same application that you're working on there)!

    Kind regards,
    Andreas

  • Hi Andreas,

    Sorry for the late reply, I need to explore Zephyr and Thread process to better understand my problem !  

    Ok I think I understand my problem now ... Thanks to your explanation, it's much clearer. Indeed, if the publication context is a local variable of the thread that receive the message I cannot just use it in an another thread which is responsible for sending message.
    So it explains this strange and unreliable behavior !

    Thanks a lot for your explanations and your patience

    Kind regards

    Maureen

  • Hi Maureen,

    I am glad to hear that our explanation has helped you!

    Is it ok if I mark this case as a verified answer? You may always open up new cases and add details from this case to the new one for context!

    Kind regards,
    Andreas

  • Hi Andreas,

    yes it's ok for me !

    thanks !

    Maureen

Related