<?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>How can i pass a structure to another thread through mailbox in zephyr</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/81747/how-can-i-pass-a-structure-to-another-thread-through-mailbox-in-zephyr</link><description>Hi, 
 Im using nrf9160 based custom board, nrf sdk 1.5.1 
 I have below structure to frame the data packet and i need to send this packet to another thread through MailBox. i have tested mail box with char array buffers and its working fine but not in</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 17 Nov 2021 12:28:21 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/81747/how-can-i-pass-a-structure-to-another-thread-through-mailbox-in-zephyr" /><item><title>RE: How can i pass a structure to another thread through mailbox in zephyr</title><link>https://devzone.nordicsemi.com/thread/339423?ContentTypeID=1</link><pubDate>Wed, 17 Nov 2021 12:28:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3f09b788-c5ba-4162-b3a5-2632acd37dee</guid><dc:creator>Albrecht Markus Schellenberger</dc:creator><description>&lt;p lang="en-GB"&gt;Hello Rajender,&lt;/p&gt;
[quote user=""]so please help me to send this data packet to another thread.[/quote]
&lt;p lang="en-GB"&gt;You have to make usage of a pointer pointing towards your struct.&lt;/p&gt;
&lt;p lang="en-GB"&gt;&lt;pre class="ui-code" data-mode="text"&gt; msg_t msgSendPacket, *msgSendPacketPtr = &amp;amp;msgSendPacket;
   //Fill the Packet from UART
   
    /* prepare to send message through Mailbox*/
    mailBoxMsg.info = sizeof(&amp;amp;msgSendPacket);
    mailBoxMsg.size = sizeof(&amp;amp;msgSendPacket);
    mailBoxMsg.tx_data = msgSendPacketPtr;
    mailBoxMsg.tx_block.data = NULL;
    mailBoxMsg.tx_target_thread = tid_myThread;
    k_mbox_async_put(&amp;amp;mailBoxMsgMailBox, &amp;amp;mailBoxMsg, NULL);//NULL means no semphore used
    
    k_poll_signal_raise(&amp;amp;myThreadSignal, dataSig);&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;span lang="en-GB"&gt;During reception, a pointer pointing towards a struct of the same type will fill it with the respective data.&lt;/span&gt;&lt;/p&gt;
&lt;p lang="en-GB"&gt;&lt;pre class="ui-code" data-mode="text"&gt;struct k_mbox_msg recv_msg;
msg_t msgRecvPacket, *msgRecvPacketPtr = &amp;amp;msgRecvPacket;

...

/* retrieve message data and delete the message */
k_mbox_data_get(&amp;amp;recv_msg, msgRecvPacketPtr);&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;span lang="en-GB"&gt;I hope this solves your issue!&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span lang="en-GB"&gt;Regards,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span lang="en-GB"&gt;Markus&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How can i pass a structure to another thread through mailbox in zephyr</title><link>https://devzone.nordicsemi.com/thread/339158?ContentTypeID=1</link><pubDate>Tue, 16 Nov 2021 08:48:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7252a2e4-b6f7-4194-9a45-2f24d14dc295</guid><dc:creator>Rajender</dc:creator><description>&lt;p&gt;ok markus, but please try to come back asap&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How can i pass a structure to another thread through mailbox in zephyr</title><link>https://devzone.nordicsemi.com/thread/339157?ContentTypeID=1</link><pubDate>Tue, 16 Nov 2021 08:46:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6e7214a6-9863-4786-aa03-a578a81cc019</guid><dc:creator>Albrecht Markus Schellenberger</dc:creator><description>&lt;p lang="en-GB"&gt;Hello Rajender,&lt;/p&gt;
&lt;p lang="en-GB"&gt;I have to dive a little into this topic and make myself familiar with the API usage. I will come back to you as soon as possible.&lt;/p&gt;
&lt;p lang="en-GB"&gt;Regards,&lt;/p&gt;
&lt;p lang="en-GB"&gt;Markus&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>