<?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>Zephyr API for getting SPI reading data length</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/104150/zephyr-api-for-getting-spi-reading-data-length</link><description>I would like to read data through SPI interface. But I can&amp;#39;t find any API can get reading data length from https://docs.zephyrproject.org/apidoc/latest/group__spi__interface.html . Is there any API can get SPI reading data length?</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 29 Sep 2023 15:07:43 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/104150/zephyr-api-for-getting-spi-reading-data-length" /><item><title>RE: Zephyr API for getting SPI reading data length</title><link>https://devzone.nordicsemi.com/thread/448383?ContentTypeID=1</link><pubDate>Fri, 29 Sep 2023 15:07:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1e461808-bde0-407b-8012-8493632fb2cf</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;As long as you are the master, you decide how much data should be read out from the slave. If the slave only have 100bytes to clock out, and you read 300 bytes, the slave will typically clock out the &lt;a href="https://infocenter.nordicsemi.com/topic/ps_nrf5340/spis.html#register.ORC"&gt;ORC&lt;/a&gt; for the remaining 200 bytes. This is implementation dependent, and should be specified in the datasheet of the SPI slave device.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Zephyr API for getting SPI reading data length</title><link>https://devzone.nordicsemi.com/thread/447996?ContentTypeID=1</link><pubDate>Wed, 27 Sep 2023 14:45:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:37b270a6-8772-4951-9562-61303fee6227</guid><dc:creator>snowuyl</dc:creator><description>&lt;p&gt;Thanks for your reply! If I request more data than actual data (E.g. I request 300 bytes data, but only 100 bytes), what will happen?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Zephyr API for getting SPI reading data length</title><link>https://devzone.nordicsemi.com/thread/447985?ContentTypeID=1</link><pubDate>Wed, 27 Sep 2023 14:19:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:07141212-bf72-47df-9335-153fe83c5177</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;&lt;a href="https://docs.zephyrproject.org/apidoc/latest/structspi__buf__set.html"&gt;spi_buf_set&lt;/a&gt;&amp;nbsp;is a struct that contains a pointer to the buffer and the count of number of bytes in the buffer. The function will not return the actual read length, but the read length will always be what you request when calling the function.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Zephyr API for getting SPI reading data length</title><link>https://devzone.nordicsemi.com/thread/447952?ContentTypeID=1</link><pubDate>Wed, 27 Sep 2023 12:48:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:be2d9224-848f-4f70-a66d-4a2c7bdaa91c</guid><dc:creator>snowuyl</dc:creator><description>&lt;p&gt;Thanks for your reply! From&amp;nbsp;&lt;a class="el" href="https://docs.zephyrproject.org/apidoc/latest/group__spi__interface.html#ga41f771785a4fa9ca0954125d1e97959e"&gt;spi_read&lt;/a&gt;&lt;span&gt; (const struct &lt;/span&gt;&lt;a class="el" href="https://docs.zephyrproject.org/apidoc/latest/structdevice.html"&gt;device&lt;/a&gt;&lt;span&gt;*dev, const struct &lt;/span&gt;&lt;a class="el" href="https://docs.zephyrproject.org/apidoc/latest/structspi__config.html"&gt;spi_config&lt;/a&gt;&lt;span&gt;*config, const struct &lt;/span&gt;&lt;a class="el" href="https://docs.zephyrproject.org/apidoc/latest/structspi__buf__set.html"&gt;spi_buf_set&lt;/a&gt;&lt;span&gt;*rx_bufs), how to decide rx_bugs array size and does spi_read() returns actual reading data length?&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Zephyr API for getting SPI reading data length</title><link>https://devzone.nordicsemi.com/thread/447942?ContentTypeID=1</link><pubDate>Wed, 27 Sep 2023 12:26:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f5b98997-5e97-424b-9909-4b6900d84441</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;What do you mean by&amp;nbsp;this?&lt;/p&gt;
[quote user=""]can&amp;#39;t find any API can get reading data length[/quote]
&lt;p&gt;The API&amp;nbsp;&lt;a href="https://docs.zephyrproject.org/apidoc/latest/group__spi__interface.html#ga41f771785a4fa9ca0954125d1e97959e"&gt;spi_read&lt;/a&gt;() is used to read a specified number if bytes on the SPI bus.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;br /&gt;Jørgen&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>