<?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>SPI register-based read</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/47817/spi-register-based-read</link><description>I am using the nRF52840 DK to read data from an IMU sensor (STm LSM9DS1 9DOF). Like most sensors, you transmit the register number first (on MOSI), then continue clocking and the sensor returns the value. 
 I have based my code on the SDK v15.3.0 example</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 28 May 2019 22:32:19 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/47817/spi-register-based-read" /><item><title>RE: SPI register-based read</title><link>https://devzone.nordicsemi.com/thread/189726?ContentTypeID=1</link><pubDate>Tue, 28 May 2019 22:32:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:db039908-fbd0-403b-9968-94463235b297</guid><dc:creator>DamonKelly</dc:creator><description>&lt;p&gt;Thanks Kenneth,&lt;/p&gt;
&lt;p&gt;I figured I would have to do that i.e. set up a pair of buffers in RAM, and build a multi-byte message, and then copy the received data to the intended target ignoring the first byte.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI register-based read</title><link>https://devzone.nordicsemi.com/thread/189586?ContentTypeID=1</link><pubDate>Tue, 28 May 2019 11:03:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4df35411-7120-49ef-8530-dc28669058f8</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;Some quick background: Typically one setup a TX and RX buffer of the same length, then you fill up the TX buffer with what data you want to send (e.g.&amp;nbsp;the first byte(s) is typically a command byte that tell if it&amp;#39;s a read/write and the register to access), the length of the transfer equal the size of the complete transfer (command byte(s) + data). Then after the transfer you analyze the RX data as you see fit, in your case you should ideally just ignoring the first byte(s) in the buffer.&amp;nbsp;No need to do this in two transfers unless you are very tight on RAM usage. Ideally one could wish some kind of offset of data&amp;nbsp;written to the RX buffer depending on where the actual data start etc, but it would just complicate/over engineer the hardware, so it&amp;#39;s not supported.&lt;/p&gt;
&lt;p&gt;To answer/solve your question: I don&amp;#39;t see any easy solution to your problem, other than you manipulate the buffers in some way, such that the underlying spi transfer will see a rx buffer that start a fixed number of bytes ahead of the buffer seen by the library.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;br /&gt;Kenneth&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>