<?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>32-BITS SPI READ</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/95893/32-bits-spi-read</link><description>Good morning everyone, 
 
 I need to read a 32-bits register using 8-bits communication (I have already set up spi configuration structure to communicate over 8-bits transactions). 
 Can you please tell me how I should size data structures required by</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 23 Jan 2023 07:28:37 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/95893/32-bits-spi-read" /><item><title>RE: 32-BITS SPI READ</title><link>https://devzone.nordicsemi.com/thread/405954?ContentTypeID=1</link><pubDate>Mon, 23 Jan 2023 07:28:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:76d7b381-36fa-41c4-85ca-abf3cbb54094</guid><dc:creator>Marte Myrvold</dc:creator><description>&lt;p&gt;Hi Gianmarco,&lt;/p&gt;
&lt;p&gt;Most likely, yes. You can use .count=1 instead.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Marte&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: 32-BITS SPI READ</title><link>https://devzone.nordicsemi.com/thread/405916?ContentTypeID=1</link><pubDate>Sat, 21 Jan 2023 14:20:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a8f985dc-0e77-484c-af5d-24689a749031</guid><dc:creator>gianmarcod</dc:creator><description>&lt;p&gt;Hi Marte,&lt;/p&gt;
&lt;p&gt;Thanks for your feedback. I usually set .count=1, which is probably wrong.&lt;/p&gt;
&lt;p&gt;Setting count=ARRAY_SIZE(rx_buf) triggers the error you can see in the picture below.&lt;/p&gt;
&lt;p&gt;Do you think that it may be due to the fact that spi_buf has size 1?&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/22841.err.PNG" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Gianmarco&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: 32-BITS SPI READ</title><link>https://devzone.nordicsemi.com/thread/405852?ContentTypeID=1</link><pubDate>Fri, 20 Jan 2023 14:06:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e7ca4281-7212-4af2-8003-ea161e4bf530</guid><dc:creator>Marte Myrvold</dc:creator><description>&lt;p&gt;Hi&amp;nbsp;Gianmarco,&lt;/p&gt;
&lt;p&gt;For 32-bit (or 4 byte) you can do the following:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;static uint8_t rx_buffer[4];

const struct spi_buf rx_buf = {
   .buf = rx_buffer,
   .len = sizeof(rx_buffer)
}

const struct spi_buf_set rx = {
   .buffers = &amp;amp;rx_buf,
   .count = ARRAY_SIZE(rx_buf)
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Marte&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>