<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Appkey always equals 0 in my custom model in BT mesh</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/90111/appkey-always-equals-0-in-my-custom-model-in-bt-mesh</link><description>Hello everyone, 
 
 I&amp;#39;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</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 05 Sep 2022 12:52:37 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/90111/appkey-always-equals-0-in-my-custom-model-in-bt-mesh" /><item><title>RE: Appkey always equals 0 in my custom model in BT mesh</title><link>https://devzone.nordicsemi.com/thread/384585?ContentTypeID=1</link><pubDate>Mon, 05 Sep 2022 12:52:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:91098dfd-bea5-4741-aac6-f064b6cf3f41</guid><dc:creator>lalum</dc:creator><description>&lt;p&gt;Hi Andreas,&lt;/p&gt;
&lt;p&gt;yes it&amp;#39;s ok for me !&lt;/p&gt;
&lt;p&gt;thanks !&lt;/p&gt;
&lt;p&gt;Maureen&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Appkey always equals 0 in my custom model in BT mesh</title><link>https://devzone.nordicsemi.com/thread/384540?ContentTypeID=1</link><pubDate>Mon, 05 Sep 2022 10:44:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5ea2bcd4-a8b1-4bb1-9e17-394bbed7c5bd</guid><dc:creator>AHaug</dc:creator><description>&lt;p&gt;Hi Maureen,&lt;br /&gt;&lt;br /&gt;I am glad to hear that our explanation has helped you!&lt;/p&gt;
&lt;p&gt;Is it ok if I mark this case as a verified answer? You may always open up new cases and add&amp;nbsp;details from this&amp;nbsp;case to the new one for context!&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;br /&gt;Andreas&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Appkey always equals 0 in my custom model in BT mesh</title><link>https://devzone.nordicsemi.com/thread/384357?ContentTypeID=1</link><pubDate>Thu, 01 Sep 2022 14:02:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d3eb5e16-2cdf-4065-a475-c6a0f08843c5</guid><dc:creator>lalum</dc:creator><description>&lt;p&gt;Hi Andreas,&lt;/p&gt;
&lt;p&gt;Sorry for the late reply, I need to explore Zephyr and Thread process to better understand my problem !&amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Ok I think I understand my problem now ... &lt;span class="VIiyi" lang="en"&gt;&lt;span class="JLqJ4b ChMk0b" data-language-for-alternatives="en" data-language-to-translate-into="fr" data-phrase-index="0" data-number-of-phrases="1"&gt;&lt;span class="Q4iAWc"&gt;Thanks to your explanation, it&amp;#39;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. &lt;br /&gt;So it explains this strange and unreliable behavior !&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class="VIiyi" lang="en"&gt;&lt;span class="JLqJ4b ChMk0b" data-language-for-alternatives="en" data-language-to-translate-into="fr" data-phrase-index="0" data-number-of-phrases="1"&gt;&lt;span class="Q4iAWc"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class="VIiyi" lang="en"&gt;&lt;span class="JLqJ4b ChMk0b" data-language-for-alternatives="en" data-language-to-translate-into="fr" data-phrase-index="0" data-number-of-phrases="1"&gt;&lt;span class="Q4iAWc"&gt;Thanks a lot for your explanations and your patience&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class="VIiyi" lang="en"&gt;&lt;span class="JLqJ4b ChMk0b" data-language-for-alternatives="en" data-language-to-translate-into="fr" data-phrase-index="0" data-number-of-phrases="1"&gt;&lt;span class="Q4iAWc"&gt;Kind regards &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class="VIiyi" lang="en"&gt;&lt;span class="JLqJ4b ChMk0b" data-language-for-alternatives="en" data-language-to-translate-into="fr" data-phrase-index="0" data-number-of-phrases="1"&gt;&lt;span class="Q4iAWc"&gt;Maureen&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Appkey always equals 0 in my custom model in BT mesh</title><link>https://devzone.nordicsemi.com/thread/380623?ContentTypeID=1</link><pubDate>Mon, 08 Aug 2022 12:56:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b68a7271-d12b-4516-bca0-c28a1be4450b</guid><dc:creator>AHaug</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
[quote user="lalum"]when you talk about my &amp;quot;tricks&amp;quot;[/quote]
&lt;p&gt;I would first like to add that if they work without causing issues down the line, they are completely viable , but&amp;nbsp;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.&lt;/p&gt;
&lt;p&gt;I also believe this question might be more sufficiently answered by my colleague in case #293377 (if thats the same application that you&amp;#39;re working on there)!&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;br /&gt;Andreas&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Appkey always equals 0 in my custom model in BT mesh</title><link>https://devzone.nordicsemi.com/thread/380405?ContentTypeID=1</link><pubDate>Fri, 05 Aug 2022 13:30:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0ee7f7d0-c78e-4ee5-8d05-f4440a56e53f</guid><dc:creator>lalum</dc:creator><description>&lt;p&gt;Hi Andreas, thank you so much for your reply and your help !&lt;br /&gt;Indeed, I&amp;#39;m a newbie with multithreading ... so I think the link to the course can help me !&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;when you talk about my &amp;quot;tricks&amp;quot; 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 ?&lt;br /&gt;Or it was about my first example that didn&amp;#39;t work where I was trying to use all the context as my thread argument ?&lt;/p&gt;
&lt;p&gt;Kind regards and thanks &lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Appkey always equals 0 in my custom model in BT mesh</title><link>https://devzone.nordicsemi.com/thread/380392?ContentTypeID=1</link><pubDate>Fri, 05 Aug 2022 12:58:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:938fca86-bcde-41a0-abd7-8f11b2c56f0a</guid><dc:creator>AHaug</dc:creator><description>[quote user="AHaug"]The value of ctx-&amp;gt;app_idx is indeed equal to 0 in my reception function &amp;quot;bt_mesh_handle_message_request&amp;quot; but once in the thread &amp;quot;My_thread&amp;quot; the value rx_ctx-&amp;gt;app_idx is equal to 0x2000... I don&amp;#39;t understand why the value of ctx changes without my intervention. I tried to put the ctx value as a global variable and thus not pass ctx as an argument of my thread, but the result is the same, once in the thread rx_ctx-&amp;gt;app_idx = 0x2000....[/quote]
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I got a reply with regards to this:&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Rx context is the local variable from here:&amp;nbsp;&lt;/span&gt;&lt;a href="https://github.com/zephyrproject-rtos/zephyr/blob/main/subsys/bluetooth/mesh/net.c#L371-L391" rel="nofollow noopener noreferrer" target="_blank"&gt;https://github.com/zephyrproject-rtos/zephyr/blob/main/subsys/bluetooth/mesh/net.c#L371-L391&lt;/a&gt;&amp;nbsp;&lt;br /&gt;&lt;span&gt;However, it is not correct to use a pointer to the local variable from the stack of one thread as incoming data for another thread. This might result in some bugs further down in development that is hard to solve. To be sure that you do this properly, I would recommend taking a look at how Zephyr does threading, context switching, stack allocation and make sure you understand it quite thoroughly before doing &amp;quot;tricks&amp;quot; like what you&amp;#39;re attempting right now&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;In addition,&amp;nbsp;&lt;a href="https://academy.nordicsemi.com/lessons/lesson-7-multithreaded-applications/"&gt;topic 7 and 8 in this course&lt;/a&gt;&amp;nbsp;is a great entry level overview over multithread applications if that that&amp;nbsp; topic is new to you, as well as Zephyr&amp;#39;s&amp;nbsp;&lt;a href="https://docs.zephyrproject.org/latest/kernel/services/threads/index.html"&gt;thread documentation&lt;/a&gt;,&amp;nbsp;&lt;a href="https://docs.zephyrproject.org/apidoc/latest/group__thread__apis.html"&gt;thread API&lt;/a&gt;&amp;nbsp;and&amp;nbsp;&lt;a href="https://docs.zephyrproject.org/2.6.0/samples/basic/threads/README.html"&gt;thread samples&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Kind regards,&lt;br /&gt;Andreas&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Appkey always equals 0 in my custom model in BT mesh</title><link>https://devzone.nordicsemi.com/thread/380090?ContentTypeID=1</link><pubDate>Thu, 04 Aug 2022 11:18:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c28f1985-1bac-4465-b6d3-838dbb404fb0</guid><dc:creator>lalum</dc:creator><description>&lt;p&gt;Hi Andreas,&lt;/p&gt;
&lt;p&gt;Thank you for the additional information. It confirms what I understood. To make my communication works, &lt;span class="VIiyi" lang="en"&gt;&lt;span class="JLqJ4b ChMk0b" data-language-for-alternatives="en" data-language-to-translate-into="fr" data-phrase-index="0" data-number-of-phrases="1"&gt;&lt;span class="Q4iAWc"&gt;I decided to retrieve only the destination address and to pass it as an argument of my thread.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class="VIiyi" lang="en"&gt;&lt;span class="JLqJ4b ChMk0b" data-language-for-alternatives="en" data-language-to-translate-into="fr" data-phrase-index="0" data-number-of-phrases="1"&gt;&lt;span class="Q4iAWc"&gt;&lt;pre class="ui-code" data-mode="text"&gt;static int bt_mesh_handle_message_request(struct bt_mesh_model *model, struct bt_mesh_msg_ctx *ctx, struct net_buf_simple *buf){
    printk(&amp;quot;SERVER : receive request message \n&amp;quot;);
	uint32_t receive_offset = net_buf_simple_pull_le32(buf);
	size_t receive_size = net_buf_simple_pull_le32(buf);
	printk(&amp;quot;SERVER : receive offset = %d and size = %zu \n&amp;quot;, receive_offset, receive_size);

	struct bt_mesh_datas_state datas_state_srv = {
		.address = SHARED_RAM_ADDRESS + receive_offset,
		.datas = (uint32_t *) datas_state_srv.address,
		.remaining_datas = receive_size 
	};

	struct k_thread my_thread_data;
	printk(&amp;quot;DEBUG : create thread \n&amp;quot;);
	uint16_t addr = ctx-&amp;gt;addr;
	k_thread_create(&amp;amp;my_thread_data, &amp;amp;my_thread_stack, STACKSIZE, thread, model, addr, &amp;amp;datas_state_srv, PRIORITY, 0, K_NO_WAIT);
	return 0;
}&lt;/pre&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class="VIiyi" lang="en"&gt;&lt;span class="JLqJ4b ChMk0b" data-language-for-alternatives="en" data-language-to-translate-into="fr" data-phrase-index="0" data-number-of-phrases="1"&gt;&lt;span class="Q4iAWc"&gt;and in my thread I recreate a publication context :&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class="VIiyi" lang="en"&gt;&lt;span class="JLqJ4b ChMk0b" data-language-for-alternatives="en" data-language-to-translate-into="fr" data-phrase-index="0" data-number-of-phrases="1"&gt;&lt;span class="Q4iAWc"&gt;&lt;pre class="ui-code" data-mode="text"&gt;void My_thread(struct bt_mesh_model *model, uint16_t address, struct bt_mesh_datas_state *datas_state_srv){

	printk(&amp;quot;DEBUG : Thread created \n&amp;quot;);
	struct bt_mesh_msg_ctx ctx = {
		.addr = address,
		.app_idx = model-&amp;gt;keys[0],
		.send_ttl = BT_MESH_TTL_DEFAULT,
	};
	
	BT_MESH_MODEL_BUF_DEFINE(msg, BT_MESH_OP_DATAS, 1);
	bt_mesh_model_msg_init(&amp;amp;msg, BT_MESH_OP_DATAS);

	net_buf_simple_add(&amp;amp;msg, 5);
	(void) bt_mesh_model_send(model, ctx, &amp;amp;msg, NULL, NULL);
	printk(&amp;quot;DEBUG : send message ok \n&amp;quot;);

	while(1){

		printk(&amp;quot;DEBUG : thread finished \n&amp;quot;);
		k_usleep(100000000000);
	}	
	return;&lt;/pre&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class="VIiyi" lang="en"&gt;&lt;span class="JLqJ4b ChMk0b" data-language-for-alternatives="en" data-language-to-translate-into="fr" data-phrase-index="0" data-number-of-phrases="1"&gt;&lt;span class="Q4iAWc"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class="VIiyi" lang="en"&gt;&lt;span class="JLqJ4b ChMk0b" data-language-for-alternatives="en" data-language-to-translate-into="fr" data-phrase-index="0" data-number-of-phrases="1"&gt;&lt;span class="Q4iAWc"&gt;It works ... but It doesn&amp;#39;t explain why the first code doesn&amp;#39;t work ...&lt;br /&gt;I hope somebody in your team have the explanation !&lt;br /&gt;&lt;br /&gt;Kind regards&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Appkey always equals 0 in my custom model in BT mesh</title><link>https://devzone.nordicsemi.com/thread/379561?ContentTypeID=1</link><pubDate>Mon, 01 Aug 2022 13:46:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9fa56f56-5928-4361-b111-010ff872179e</guid><dc:creator>AHaug</dc:creator><description>&lt;p&gt;Hi,&lt;br /&gt;&lt;br /&gt;I have some additional information/update for you.&lt;/p&gt;
&lt;p&gt;You might already know this, but I am adding this nonetheless to cl&lt;/p&gt;
&lt;p&gt;An application key is used in the network to separate acess rights to the different applications in a network. Every application has their own key. When a Mesh pack is sendt in the network, it will be encrypted with an application key, and unless the model is bound with the correct application key, then a node will not be able to decrypt the message.&lt;/p&gt;
[quote user="lalum"]The value of ctx-&amp;gt;app_idx is indeed equal to 0 in my reception function &amp;quot;bt_mesh_handle_message_request&amp;quot; but once in the thread &amp;quot;My_thread&amp;quot; the value rx_ctx-&amp;gt;app_idx is equal to 0x2000... I don&amp;#39;t understand why the value of ctx changes without my intervention. I tried to put the ctx value as a global variable and thus not pass ctx as an argument of my thread, but the result is the same, once in the thread rx_ctx-&amp;gt;app_idx = 0x2000....[/quote]
&lt;p&gt;As for why this is happening I will need to ask around some more. Let me know if you&amp;#39;ve managed it to work in the mean while, and thank you for your patience so far&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;br /&gt;Andreas&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Appkey always equals 0 in my custom model in BT mesh</title><link>https://devzone.nordicsemi.com/thread/378955?ContentTypeID=1</link><pubDate>Wed, 27 Jul 2022 14:39:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:540500ab-8f88-451d-ad23-88d923c913eb</guid><dc:creator>lalum</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;thank you very much for your answer !&lt;/p&gt;
&lt;p&gt;&lt;span class="VIiyi" lang="en"&gt;&lt;span class="JLqJ4b" data-language-for-alternatives="en" data-language-to-translate-into="fr" data-phrase-index="0" data-number-of-phrases="1"&gt;&lt;span class="Q4iAWc"&gt;After analysis it seems that it is &amp;quot;Appkey index&amp;quot; and not the Appkey that I am returning... The value &amp;quot;0&amp;quot; that I have would therefore correspond to the Appkey at index 0 of the Appkey list related to my model. In my case I only assigned one appkey to my model. But that&amp;#39;s just my theory... &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class="VIiyi" lang="en"&gt;&lt;span class="JLqJ4b" data-language-for-alternatives="en" data-language-to-translate-into="fr" data-phrase-index="0" data-number-of-phrases="1"&gt;&lt;span class="Q4iAWc"&gt;In any case I have a problem with my thread... I give it the value &amp;quot;ctx&amp;quot; as an argument and this value is modified automatically in my thread ! &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class="VIiyi" lang="en"&gt;&lt;span class="JLqJ4b" data-language-for-alternatives="en" data-language-to-translate-into="fr" data-phrase-index="0" data-number-of-phrases="1"&gt;&lt;span class="Q4iAWc"&gt;The value of ctx-&amp;gt;app_idx is indeed equal to 0 in my reception function &amp;quot;bt_mesh_handle_message_request&amp;quot; but once in the thread &amp;quot;My_thread&amp;quot; the value rx_ctx-&amp;gt;app_idx is equal to 0x2000... I don&amp;#39;t understand why the value of ctx changes without my intervention. I tried to put the ctx value as a global variable and thus not pass ctx as an argument of my thread, but the result is the same, once in the thread rx_ctx-&amp;gt;app_idx = 0x2000.... &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class="VIiyi" lang="en"&gt;&lt;span class="JLqJ4b" data-language-for-alternatives="en" data-language-to-translate-into="fr" data-phrase-index="0" data-number-of-phrases="1"&gt;&lt;span class="Q4iAWc"&gt;I fully understand that no one is available to answer me during this holiday period and thank you for your time! I can wait for the beginning of next week to have a solution&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class="VIiyi" lang="en"&gt;&lt;span class="JLqJ4b" data-language-for-alternatives="en" data-language-to-translate-into="fr" data-phrase-index="0" data-number-of-phrases="1"&gt;&lt;span class="Q4iAWc"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class="VIiyi" lang="en"&gt;&lt;span class="JLqJ4b" data-language-for-alternatives="en" data-language-to-translate-into="fr" data-phrase-index="0" data-number-of-phrases="1"&gt;&lt;span class="Q4iAWc"&gt;King regards&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Appkey always equals 0 in my custom model in BT mesh</title><link>https://devzone.nordicsemi.com/thread/378936?ContentTypeID=1</link><pubDate>Wed, 27 Jul 2022 13:35:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3870ba8e-c08e-4e5d-bc30-dd4a12d8f5c7</guid><dc:creator>AHaug</dc:creator><description>&lt;p&gt;Hi,&amp;nbsp;&lt;br /&gt;&lt;br /&gt;I will see if I can find someone who can explain how Appkeys work better than me and can explain both of us how it works. Unfortunately we hit a bit of a bad timing where we have an overlap where most of the Mesh experts are out on vacation this week,&amp;nbsp;but nonetheless I&amp;#39;ve asked the team for some input. I can hopefully return you with an answer and an explaination on Monday/early next week.&lt;br /&gt;&lt;br /&gt;I hope the delayed response time does not cause any issues for you,&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;br /&gt;Andreas&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Appkey always equals 0 in my custom model in BT mesh</title><link>https://devzone.nordicsemi.com/thread/378701?ContentTypeID=1</link><pubDate>Tue, 26 Jul 2022 11:46:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9587271f-a84b-4cf5-b141-0451eee0e74f</guid><dc:creator>lalum</dc:creator><description>&lt;p&gt;Hi Andreas,&lt;/p&gt;
&lt;p&gt;&lt;span class="VIiyi" lang="en"&gt;&lt;span class="JLqJ4b ChMk0b" data-language-for-alternatives="en" data-language-to-translate-into="fr" data-phrase-index="0" data-number-of-phrases="1"&gt;&lt;span class="Q4iAWc"&gt;my problem reappeared&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;. I think my problem is that I don&amp;#39;t really understand how the Appkeys are bound to models...&lt;br /&gt;&lt;br /&gt;This time my server receive the message from my client and when it wants to respond I have this error : &amp;quot;E : Model not bound to Appkey 0x2000&amp;quot;.&lt;br /&gt;&lt;br /&gt;So to give you more information, this is my function which handle the message sent by the client: (my client send a request to my server with an offset and a size to read datas in a particular area of the RAM)&lt;pre class="ui-code" data-mode="text"&gt;static int bt_mesh_handle_message_request(struct bt_mesh_model *model, struct bt_mesh_msg_ctx *ctx, struct net_buf_simple *buf){
    printk(&amp;quot;SERVER : receive request message \n&amp;quot;);
	uint32_t receive_offset = net_buf_simple_pull_le32(buf);
	size_t receive_size = net_buf_simple_pull_le32(buf);
	printk(&amp;quot;SERVER : receive offset = %d and size = %zu \n&amp;quot;, receive_offset, receive_size);

	struct bt_mesh_datas_state datas_state_srv = {
		.address = SHARED_RAM_ADDRESS + receive_offset,
		.datas = (uint32_t *) datas_state_srv.address,
		.remaining_datas = receive_size 
	};

	struct k_thread my_thread_data;
	printk(&amp;quot;DEBUG : create thread \n&amp;quot;);
	k_thread_create(&amp;amp;my_thread_data, &amp;amp;my_thread_stack, STACKSIZE, My_thread, model, ctx, &amp;amp;datas_state_srv, PRIORITY, 0, K_NO_WAIT);
	return 0;
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;This handler create &lt;span class="VIiyi" lang="en"&gt;&lt;span class="JLqJ4b ChMk0b" data-language-for-alternatives="en" data-language-to-translate-into="fr" data-phrase-index="0" data-number-of-phrases="1"&gt;&lt;span class="Q4iAWc"&gt;a thread that I want to use to split the data into packets and send them&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;. But to begin, I just want to send at least on packet in this thread to test, so the thread looks like this :&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;void My_thread(struct bt_mesh_model *model, struct bt_mesh_msg_ctx *rx_ctx, struct bt_mesh_datas_state *datas_state_srv){
	
	printk(&amp;quot;DEBUG : In the thread \n&amp;quot;);
	BT_MESH_MODEL_BUF_DEFINE(msg, BT_MESH_MESH_OP_DATAS, 1);
	bt_mesh_model_msg_init(&amp;amp;msg, BT_MESH_MESH_OP_DATAS);

	net_buf_simple_add(&amp;amp;msg, 5);
	(void) bt_mesh_model_send(model, rx_ctx, &amp;amp;msg, NULL, NULL);
	printk(&amp;quot;DEBUG : send message ok \n&amp;quot;);

	while(1){

		printk(&amp;quot;DEBUG : thread finished \n&amp;quot;);
		k_usleep(100000000000);
	}	
	return;
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;when I try to debug, I see that the rx_ctx-&amp;gt; app_idx = 0x2000 and model-&amp;gt;key is empty ... But I don&amp;#39;t understand why model-&amp;gt;key is empty because I bound an Appkey to my server and client models in the nRF mesh app...&lt;br /&gt;&lt;br /&gt;Sorry I&amp;#39;m very new with zephyr, nordic and BT mesh and I try to understand !&lt;br /&gt;&lt;br /&gt;Kind regards&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Appkey always equals 0 in my custom model in BT mesh</title><link>https://devzone.nordicsemi.com/thread/378149?ContentTypeID=1</link><pubDate>Thu, 21 Jul 2022 14:30:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:622df4c4-ce5e-46d0-a797-7df77be8c912</guid><dc:creator>AHaug</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
[quote user="lalum"]For a strange reason it works now ... I don&amp;#39;t succeed to identify the source of the problem... [/quote]
&lt;p&gt;I&amp;#39;m glad to hear that the issue has fixed itself automagically!&amp;nbsp;&lt;br /&gt;&lt;br /&gt; I&amp;#39;ll let the case stay open in case you manage to reproduce the issue and we need to look closer into it again&lt;br /&gt;&lt;br /&gt;Kind regards,&lt;br /&gt;Andreas&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Appkey always equals 0 in my custom model in BT mesh</title><link>https://devzone.nordicsemi.com/thread/378143?ContentTypeID=1</link><pubDate>Thu, 21 Jul 2022 14:19:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b184fbba-d7b0-4eaa-bcc8-29a8e9f8129f</guid><dc:creator>lalum</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;thanks for your reply ! For a strange reason it works now ... I don&amp;#39;t succeed to identify the source of the problem... And I don&amp;#39;t really like it because I didn&amp;#39;t do something in particular and &lt;span class="VIiyi" lang="en"&gt;&lt;span class="JLqJ4b ChMk0b" data-language-for-alternatives="en" data-language-to-translate-into="fr" data-phrase-index="0" data-number-of-phrases="1"&gt;&lt;span class="Q4iAWc"&gt;I&amp;#39;m afraid that the problem will reappear.&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class="VIiyi" lang="en"&gt;&lt;span class="JLqJ4b ChMk0b" data-language-for-alternatives="en" data-language-to-translate-into="fr" data-phrase-index="0" data-number-of-phrases="1"&gt;&lt;span class="Q4iAWc"&gt;So I give you the answers just in case :&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class="VIiyi" lang="en"&gt;&lt;span class="JLqJ4b ChMk0b" data-language-for-alternatives="en" data-language-to-translate-into="fr" data-phrase-index="0" data-number-of-phrases="1"&gt;&lt;span class="Q4iAWc"&gt;1. I work with nRF connect sdk on visual studio code, v1.9.1 release&lt;br /&gt;2. Yes it was the exact error message that I received when I connected my nrf52840 in serial and I started communication&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class="VIiyi" lang="en"&gt;&lt;span class="JLqJ4b ChMk0b" data-language-for-alternatives="en" data-language-to-translate-into="fr" data-phrase-index="0" data-number-of-phrases="1"&gt;&lt;span class="Q4iAWc"&gt;3. I use nrf Mesh 3.2.4 on an Andro&amp;iuml;d phone&lt;br /&gt;4. I base my custom application on several examples such as the generic OnOff models in the nrf sdk and the chat sample&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class="VIiyi" lang="en"&gt;&lt;span class="JLqJ4b ChMk0b" data-language-for-alternatives="en" data-language-to-translate-into="fr" data-phrase-index="0" data-number-of-phrases="1"&gt;&lt;span class="Q4iAWc"&gt;kind regards&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Appkey always equals 0 in my custom model in BT mesh</title><link>https://devzone.nordicsemi.com/thread/378124?ContentTypeID=1</link><pubDate>Thu, 21 Jul 2022 13:42:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f5756579-6a98-4247-b667-074701210456</guid><dc:creator>AHaug</dc:creator><description>&lt;p&gt;Hi,&lt;br /&gt;&lt;br /&gt;Could you supply me with some more info about the following:&amp;nbsp;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Can you verify if you are working with nRF Connect SDK and if so what version are you using?&lt;/li&gt;
&lt;li&gt;Is&amp;nbsp;&lt;span&gt;&amp;quot;E : Model don&amp;#39;t bound to AppKey 0x000&amp;quot; the exact error message you are receiving or is it translated to English?&amp;nbsp;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;You state you&amp;#39;re using the nRF Mesh application to provision your node. Can you state which phone OS you are using (and what version of the mobile application)?&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;Did you base your custom application on any existing samples? If so, could you supply them to me?&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;span&gt;Kind regards,&lt;br /&gt;Andreas&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Appkey always equals 0 in my custom model in BT mesh</title><link>https://devzone.nordicsemi.com/thread/377661?ContentTypeID=1</link><pubDate>Tue, 19 Jul 2022 13:37:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3441cd08-4291-4954-83a9-a3a7888e4e41</guid><dc:creator>AHaug</dc:creator><description>&lt;p&gt;Hi,&lt;br /&gt;&lt;br /&gt;I&amp;#39;ve picked up your case and I will be looking into answering your issue. However response time might be a bit longer due to the summer vacation period here in Norway. I will get back to you as soon as I know more, hopefully within the weekend.&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;br /&gt;Andreas&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>