<?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>Doubts about the use of PIPEs in Zephyr</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/112894/doubts-about-the-use-of-pipes-in-zephyr</link><description>Hi . I have two questions about the PIPEs in Zephyr RTOS , especially regarding the correct use of the k _pipe _put and k _pipe _get functions : 
 1 ) In both functions , what is the meaning of the min _xfer parameter ? According to the documentation</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 11 Jul 2024 12:23:26 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/112894/doubts-about-the-use-of-pipes-in-zephyr" /><item><title>RE: Doubts about the use of PIPEs in Zephyr</title><link>https://devzone.nordicsemi.com/thread/493414?ContentTypeID=1</link><pubDate>Thu, 11 Jul 2024 12:23:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b873102e-5415-4054-a3b4-d3e95fbe1232</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;Hi!&lt;/p&gt;
[quote user=""]&lt;span&gt;1&lt;/span&gt;&lt;span&gt;) In both functions&lt;/span&gt;&lt;span&gt;, what is the meaning of the min&lt;/span&gt;&lt;span&gt;_xfer parameter&lt;/span&gt;&lt;span&gt;? According to the documentation&lt;/span&gt;&lt;span&gt;, if they process fewer bytes than min&lt;/span&gt;&lt;span&gt;_xfer &lt;/span&gt;&lt;span&gt;(between zero and min&lt;/span&gt;&lt;span&gt;_xfer minus one&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;span&gt;, they return &lt;/span&gt;&lt;span&gt;-EAGAIN&lt;/span&gt;&lt;span&gt;. But why is this necessary&lt;/span&gt;&lt;span&gt;? Can’t I simply check the number of bytes processed with the bytes&lt;/span&gt;&lt;span&gt;_written parameter&lt;/span&gt;&lt;span&gt;?&lt;/span&gt;[/quote]
&lt;p&gt;Looking at at the example code here,&amp;nbsp;&lt;a href="https://docs.zephyrproject.org/2.7.5/reference/kernel/data_passing/pipes.html#writing-to-a-pipe"&gt;https://docs.zephyrproject.org/2.7.5/reference/kernel/data_passing/pipes.html#writing-to-a-pipe&lt;/a&gt;&amp;nbsp;, the use-case seem to be that&amp;nbsp;e.g. a message header is sent in 1 go.&amp;nbsp;&lt;/p&gt;
[quote user=""]&lt;span&gt;2&lt;/span&gt;&lt;span&gt;) Is the timeout parameter only involved when the bytes written do not exceed min&lt;/span&gt;&lt;span&gt;_xfer&lt;/span&gt;&lt;span&gt;? Or is it also involved when the bytes written are between min&lt;/span&gt;&lt;span&gt;_xfer and bytes&lt;/span&gt;&lt;span&gt;_to&lt;/span&gt;&lt;span&gt;_write&lt;/span&gt;&lt;span&gt;? &lt;a href="https://github.com/zephyrproject-rtos/zephyr/issues/24485#issuecomment-617337647"&gt;I read a post&lt;/a&gt;&lt;/span&gt;&lt;a href="https://github.com/zephyrproject-rtos/zephyr/issues/24485#issuecomment-617337647"&gt;&lt;span&gt;&amp;nbsp;about this&lt;/span&gt;&lt;/a&gt;&lt;span&gt;, and it confused me&lt;/span&gt;&lt;span&gt;: can the functions return before the timeout if the number of bytes written is between min&lt;/span&gt;&lt;span&gt;_xfer and bytes&lt;/span&gt;&lt;span&gt;_to&lt;/span&gt;&lt;span&gt;_write&lt;/span&gt;&lt;span&gt;?&lt;/span&gt;[/quote]
&lt;p&gt;I think this was fixed as part of this PR:&amp;nbsp;&lt;a href="https://github.com/zephyrproject-rtos/zephyr/pull/24486"&gt;https://github.com/zephyrproject-rtos/zephyr/pull/24486&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;If you want more info on this topic, I suggest getting in contact with the Zephyr community at Discord. See this page:&amp;nbsp;&lt;a href="https://docs.zephyrproject.org/latest/develop/getting_started/index.html#asking-for-help"&gt;https://docs.zephyrproject.org/latest/develop/getting_started/index.html#asking-for-help&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>