<?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>Clarification on SPI double buffer and EVENTS_READY</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/67213/clarification-on-spi-double-buffer-and-events_ready</link><description>First: nRF52840 dongle or nRF52840-Preview_DK (doesn&amp;#39;t matter which I get the same issue), SDK17.0.2, Segger, Windows 10. I am trying to dump a FIFO buffer from a sensor as fast as possible. I thought I had it working, but then I realized that my rx_buffer</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 16 Oct 2020 15:59:28 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/67213/clarification-on-spi-double-buffer-and-events_ready" /><item><title>RE: Clarification on SPI double buffer and EVENTS_READY</title><link>https://devzone.nordicsemi.com/thread/275420?ContentTypeID=1</link><pubDate>Fri, 16 Oct 2020 15:59:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:dd8a7f6b-4bcf-477c-8d28-2ba2368f15b2</guid><dc:creator>hmolesworth</dc:creator><description>&lt;p&gt;You can ignore the non-resettable, saturating, hits and misses counters, I just use that to check the hit rate is high enough to be worth using in code which has lots of interrupts; there is a small power cost but a much bigger power saving for loop code like this which doesn&amp;#39;t sleep. The cache means this code runs from RAM instead of Flash, so saving 2 wait states for each flash memory access is significant. In this code, dunno; maybe 6MHz bit rate goes up to 6.4 (guess). We&amp;#39;d have to count the flash accesses (look at assembler) then calculate ratio of clocks saved, then allow a bit for AHB bus issues .. nah, just run it and time it :-) Use 0x1 instead of 0x101 if you don&amp;#39;t look at hits &amp;amp; misses. It&amp;#39;s only turned on once; can always turn if off after the bulk transfer (set 0x0).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Clarification on SPI double buffer and EVENTS_READY</title><link>https://devzone.nordicsemi.com/thread/275409?ContentTypeID=1</link><pubDate>Fri, 16 Oct 2020 14:18:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c3414789-810f-47a2-a6a0-ec3b628842ca</guid><dc:creator>SmallerPond</dc:creator><description>&lt;p&gt;No other interrupts should be firing, just dumping sensor buffer then transmitting to central.&amp;nbsp; I was unaware of this functionality, or maybe I should say I haven&amp;#39;t gotten this far down the rabbit hole yet.&amp;nbsp; The speed I&amp;#39;m getting hits my requirement, but I can always use a current reduction.&amp;nbsp; I guess the idea is to monitor hits vs misses and multiply by the number of cycles then use that to determine power consumption, but what about hits?&amp;nbsp; I&amp;#39;m not seeing figures on the average current for the cache.&amp;nbsp; Or maybe it&amp;#39;s just better to do a hard measurement over a full cycle both ways to determine which is optimal.&amp;nbsp; Do you happen to have a feel (since you appear to be some sort of wizard) for if the power consumption for cache is consistent across the product, or if there is a large variance between specimens?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Clarification on SPI double buffer and EVENTS_READY</title><link>https://devzone.nordicsemi.com/thread/275349?ContentTypeID=1</link><pubDate>Fri, 16 Oct 2020 12:15:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bd492c88-c7e9-45e7-af9e-98ca75634202</guid><dc:creator>hmolesworth</dc:creator><description>&lt;p&gt;6Mbps? Pretty good .. how about adding the piece de resistance?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;   // Enable cache and hit/miss tracking
   NRF_NVMC-&amp;gt;ICACHECNF = 0x101;&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;This will remove 2 wait-states per instruction, assuming you don&amp;#39;t have tons of interrupts thrashing away in the background.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Clarification on SPI double buffer and EVENTS_READY</title><link>https://devzone.nordicsemi.com/thread/275230?ContentTypeID=1</link><pubDate>Fri, 16 Oct 2020 01:38:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1723cf48-3062-44f8-bf3d-2093dc3112fd</guid><dc:creator>SmallerPond</dc:creator><description>&lt;p&gt;Works great!&amp;nbsp; Getting around 6Mbps, which is impressive for 8MHz clock plus SS toggle.&amp;nbsp; On to the next problem!&lt;/p&gt;
&lt;p&gt;Glad to supply you with any kind of beer you like, in any quantity, any time!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Clarification on SPI double buffer and EVENTS_READY</title><link>https://devzone.nordicsemi.com/thread/275215?ContentTypeID=1</link><pubDate>Thu, 15 Oct 2020 21:12:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:36ae44d8-25da-418a-b573-b8bdb27682e7</guid><dc:creator>hmolesworth</dc:creator><description>&lt;p&gt;Fingers crossed; a pint? - London Pride or Guinness, please :-)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Clarification on SPI double buffer and EVENTS_READY</title><link>https://devzone.nordicsemi.com/thread/275213?ContentTypeID=1</link><pubDate>Thu, 15 Oct 2020 21:04:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2d4460b4-b21d-4921-a7a1-1fec41a17993</guid><dc:creator>SmallerPond</dc:creator><description>&lt;p&gt;I need to give this a try still, but great idea bumping the rxd.ptr while keeping the rxd.maxcnt at 3.&amp;nbsp; I&amp;#39;m not sure why, but I didn&amp;#39;t think you could do that - so last time I tried using SPIM, I was copying the contents to the buffer every time, which took way too long.&lt;/p&gt;
&lt;p&gt;I believe I owe you a beer.&amp;nbsp; Well played.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Clarification on SPI double buffer and EVENTS_READY</title><link>https://devzone.nordicsemi.com/thread/275187?ContentTypeID=1</link><pubDate>Thu, 15 Oct 2020 17:43:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:dfe8a932-1fc7-46c9-964b-5fb0ca4533b2</guid><dc:creator>hmolesworth</dc:creator><description>&lt;p&gt;Try this, SPIM not using interrupts - not tested:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;uint8_t txBuf[1] = FIFO_DATA_OUT_L | 0x80;
static NRF_SPIM_Type* pSPIM = NRF_SPIM0;

  // Clear all events
  pSPIM-&amp;gt;EVENTS_STARTED = 0;
  pSPIM-&amp;gt;EVENTS_STOPPED = 0;
  pSPIM-&amp;gt;EVENTS_ENDTX = 0;
  pSPIM-&amp;gt;EVENTS_ENDRX = 0;
  pSPIM-&amp;gt;EVENTS_END = 0;

  // Enable SPI and set up buffers
  pSPIM-&amp;gt;ENABLE     = 7;
  pSPIM-&amp;gt;TXD.PTR    = (uint32_t)txBuf;
  pSPIM-&amp;gt;TXD.MAXCNT = 1;
  pSPIM-&amp;gt;ORC        = 0xFF;    // Unused Tx bytes 2nd and 3rd, set to 0xFF
  pSPIM-&amp;gt;RXD.PTR    = (uint32_t)ble_buff;
  pSPIM-&amp;gt;RXD.MAXCNT = 3;
  // Disable all interrupts
  pSPIM-&amp;gt;INTENCLR = 0xFFFFFFFFUL;
Loop
{
  pSPIM-&amp;gt;TASKS_START = 1;
  while(!pSPIM-&amp;gt;EVENTS_END) ;
  pSPIM-&amp;gt;EVENTS_END = 0;
//either:
  //ble_idx += 3;
  //pSPIM-&amp;gt;RXD.PTR = (uint32_t)&amp;amp;ble_buff[ble_idx];
//or, faster:
  pSPIM-&amp;gt;RXD.PTR += 3;
// CS stuff ..
}&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Clarification on SPI double buffer and EVENTS_READY</title><link>https://devzone.nordicsemi.com/thread/275182?ContentTypeID=1</link><pubDate>Thu, 15 Oct 2020 17:12:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1a1a7972-1c0c-4f27-8b0b-95eaa6bbd423</guid><dc:creator>hmolesworth</dc:creator><description>&lt;p&gt;0x40 is the EVENTS_END interrupt bit mask. One source of confusion is often that the SPI/SPIM/TWI/TWIM peripheral is a general purpose peripheral that supports all 4 modes, which means bits have meaning even if not expected. Side-effects are supposed to be benign. EVENTS_READY is EVENTS_RXREADY in TWI but has no listing in SPIM.&lt;/p&gt;
&lt;p&gt;I also mistyped earlier; 0x04 is the interrupt&amp;nbsp;enable/disable mask, READY is probably just 0 or 1 as you are using, it is not defined. I would disable all interrupts though, with 0xFFFFFFFF.&lt;/p&gt;
&lt;p&gt;SPIM using hardware registers is no slower than SPI, and the cpu is sleeping during transfer although of course DMA is running; unless I am missing something? SPIM3 works at 32MHz with cpu asleep; SPIM0 16MHz. 3-byte transfers are supported, but there is a bug with 1-byte transfers.&lt;/p&gt;
&lt;p&gt;Edit: also I would suggest allowing for the bus issues:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;    NRF_GPIO-&amp;gt;OUTSET = 1 &amp;lt;&amp;lt; SPIM_CS;
    // Data Synchronization Barrier: completes when all explicit memory accesses before this instruction complete
    __DSB();
    __NOP();
    __NOP();
    __NOP();
    __NOP();
    NRF_GPIO-&amp;gt;OUTCLR = 1 &amp;lt;&amp;lt; SPIM_CS;
    // Data Synchronization Barrier: completes when all explicit memory accesses before this instruction complete
    __DSB();&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Clarification on SPI double buffer and EVENTS_READY</title><link>https://devzone.nordicsemi.com/thread/275176?ContentTypeID=1</link><pubDate>Thu, 15 Oct 2020 16:24:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c09bc287-d12c-4003-b225-245ca3fecd61</guid><dc:creator>SmallerPond</dc:creator><description>&lt;p&gt;I&amp;#39;m not sure I understand why the SPIM master is better if it is so much slower, therefore leaving SPI enabled for longer - eating up the very tiny battery I have to work with.&amp;nbsp; Maybe you know how to use it more effectively than the&amp;nbsp;SDK example?&amp;nbsp; The best I could do was 14us between transactions (I have to have CS pin cycle every three bytes).&lt;/p&gt;
&lt;p&gt;I have used both while (!NRF_SPI0-&amp;gt;EVENTS_READY) and&amp;nbsp;&lt;span&gt;while (NRF_SPI0-&amp;gt;EVENTS_READY == 0), both to no avail.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Clarification on SPI double buffer and EVENTS_READY</title><link>https://devzone.nordicsemi.com/thread/275175?ContentTypeID=1</link><pubDate>Thu, 15 Oct 2020 16:20:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4d6f8c20-701b-4907-b5f0-dc9a292c3916</guid><dc:creator>SmallerPond</dc:creator><description>&lt;p&gt;Good idea... I have NRF_SPI0-&amp;gt;INTCLR = (1 &amp;lt;&amp;lt; 2) earlier in the code to prevent hitting another SPI interrupt, but maybe that is wrong?&amp;nbsp; What is the proper way to disable SPI interrupts?&amp;nbsp; The datasheet doesn&amp;#39;t give an examle, but the register list has the &amp;quot;A&amp;quot; ID in position 2 for both INTENSET and INTENCLR.&amp;nbsp; When I read INTENSET I get a 64 (0x40) instead of a 0x00.&amp;nbsp; So maybe I am doing that wrong?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Clarification on SPI double buffer and EVENTS_READY</title><link>https://devzone.nordicsemi.com/thread/275163?ContentTypeID=1</link><pubDate>Thu, 15 Oct 2020 15:23:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:12af1e2a-ae4a-441b-8311-d1db9af03c04</guid><dc:creator>hmolesworth</dc:creator><description>&lt;p&gt;Two things look suspicious, not that I have used the legacy SPI ever as the SPIM is so much better. The first is that READY is hex 0x04, not 0 or 1, so any logical test becomes compiler dependent. Safer to explicitly test for the actual value, ie == 0x04 or != 0x04. The second is that READY has to be cleared for every Rx byte as it is only set on transferring a byte into RXD after reading a prior byte in RXD if there is one; arguable that the byte doesn&amp;#39;t even have to be read, just clear READY. The 3rd byte will never be signaled READY until 2 x READY=0 have been issued.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Clarification on SPI double buffer and EVENTS_READY</title><link>https://devzone.nordicsemi.com/thread/275158?ContentTypeID=1</link><pubDate>Thu, 15 Oct 2020 15:09:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7b3a7d6a-bc00-49b2-a71e-e556ab1bf3cb</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;The only thing I can think of is that you may miss&amp;nbsp;EVENTS_READY here for some reason (e.g the while loop is interrupted),&amp;nbsp;the EVENTS_READY&amp;nbsp;will not stack. You should also make sure that the&amp;nbsp;EVENTS_READY is cleared before your outer while loop, since if it&amp;#39;s already pending that will become problematic.&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><item><title>RE: Clarification on SPI double buffer and EVENTS_READY</title><link>https://devzone.nordicsemi.com/thread/275137?ContentTypeID=1</link><pubDate>Thu, 15 Oct 2020 14:03:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:debeea6b-ffaa-4048-af03-4dba28dbf75b</guid><dc:creator>SmallerPond</dc:creator><description>&lt;p&gt;Okay, in an effort to further troubleshoot, I have been through many permutations of possibilities. I am beginning to think either there is something wrong with the nRF52840 or there is a typo somewhere in the datasheet. I have the following code:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;while (ble_idx &amp;lt; (fifo_buffer_size * 2))
{
    NRF_SPI0-&amp;gt;TXD = FIFO_DATA_OUT_L | 0x80;
    while (!NRF_SPI0-&amp;gt;EVENTS_READY);
    NRF_SPI0-&amp;gt;EVENTS_READY = 0;
    tmp = NRF_SPI0-&amp;gt;RXD;
    printf(&amp;quot;Finished first read, tmp is %&amp;quot; PRIu8 &amp;quot;, ER is %&amp;quot; PRIu32 &amp;quot;\r\n&amp;quot;, tmp, NRF_SPI0-&amp;gt;EVENTS_READY);

    NRF_SPI0-&amp;gt;TXD = 0xFF;
    //while (!NRF_SPI0-&amp;gt;EVENTS_READY);
    //NRF_SPI0-&amp;gt;EVENTS_READY = 0;
    tmp0 = (uint8_t)NRF_SPI0-&amp;gt;RXD;
    printf(&amp;quot;Finished second read, tmp0 is %&amp;quot; PRIu8 &amp;quot;\r\n&amp;quot;, tmp0);

    NRF_SPI0-&amp;gt;TXD = 0xFF;
    //while (!NRF_SPI0-&amp;gt;EVENTS_READY);
    //NRF_SPI0-&amp;gt;EVENTS_READY = 0;
    tmp1 = (uint8_t)NRF_SPI0-&amp;gt;RXD;
    printf(&amp;quot;Finished third read, tmp1 is %&amp;quot; PRIu8 &amp;quot;\r\n&amp;quot;, tmp1);

    nrf_delay_us(3);
    NRF_GPIO-&amp;gt;OUTSET = 1 &amp;lt;&amp;lt; SPIM_CS;
    __NOP();
    __NOP();
    __NOP();
    __NOP();
    NRF_GPIO-&amp;gt;OUTCLR = 1 &amp;lt;&amp;lt; SPIM_CS;
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;When I put in the last two&amp;nbsp;&lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt;while (!NRF_SPI0-&amp;gt;EVENTS_READY)&lt;/span&gt; lines, I only get the first print statement (which tells me that &lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt;tmp = 0&lt;/span&gt; and &lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt;EVENTS_READY = 0&lt;/span&gt;) and I only see two bytes of clocks on the oscilloscope. This pretty clearly indicates that the while loop hangs forever, which the datasheet indicates is not correct behavior.&lt;/p&gt;
&lt;p&gt;&lt;span&gt;When I&amp;nbsp;comment out the last two&amp;nbsp;&lt;/span&gt;&lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt;while (!NRF_SPI0-&amp;gt;EVENTS_READY)&lt;/span&gt;&lt;span&gt;&amp;nbsp;lines (as in the code sample above) I get the three transmissions on the oscilloscope, but tmp, tmp0, and tmp1 are all 0 even though the MISO line has non-zero data.&amp;nbsp; I also get a fourth transmit when the outer loop starts over, but then it hangs indefinitely - again indicating that the&amp;nbsp;&lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt;while (!NRF_SPI0-&amp;gt;EVENTS_READY)&lt;/span&gt; line is hanging in contradiction to the datasheet.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Also, for completeness I ran the equivalent code on several other Cortex M4F-based MCUs just to check, and sure enough, they all read it correctly. I know that Nordic products work differently than some other MCUs, but it seems odd.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Edit: I get the same behavior on two different nRF52840 Dongles as well, which seems to indicate that it is a problem with the nRF52840.&amp;nbsp; Also, in looking over the old spi_master example from 2015, I fail to see the effective difference between that code and what I have here.&amp;nbsp; If anyone could point it out (since I guess that would be equivalent to telling me how my code contradicts the datasheet) it would be extremely helpful.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Edit edit: I have a thought that somehow it could be the MISO pin.&amp;nbsp; I can&amp;#39;t find anywhere that says I can&amp;#39;t use 0.24 for MISO - but if not, then that might explain why I always see 0 instead of what I should see (at least I should be seeing 0xFF for the first read).&amp;nbsp; Then it might follow that since the RXD is never being read, the EVENTS_READY register might not ever update?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Here is my pic config:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;#define SPI_CS                         NRF_GPIO_PIN_MAP(0, 17) // Connected to P0.17
#define SPI_SCK                        NRF_GPIO_PIN_MAP(0, 20) // Connected to P0.20
#define SPI_MOSI                       NRF_GPIO_PIN_MAP(0, 22) // Connected to P0.22
#define SPI_MISO                       NRF_GPIO_PIN_MAP(0, 24) // Connected to P0.24&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I have verified that the jumpers on the DK are correct and the dongle doesn&amp;#39;t require jumpers for pin 0.24.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Clarification on SPI double buffer and EVENTS_READY</title><link>https://devzone.nordicsemi.com/thread/275112?ContentTypeID=1</link><pubDate>Thu, 15 Oct 2020 13:17:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d50c3900-f1f8-4912-89a1-55a1b007f04e</guid><dc:creator>SmallerPond</dc:creator><description>&lt;p&gt;I have used the SPIM module, but it is very slow by comparison.&amp;nbsp; The biggest problem is that the sensor I use requires CS to go high and low between each set of three bytes to read the FIFO, the three bytes being a TX of the FIFO address, then a RX of two bytes of data.&amp;nbsp; Using the SPIM module, each transaction of three bytes takes something like 14us, which is then multiplied about 8000 times.&amp;nbsp; Using the registers, it looks like I can get that down to around 6us (if I can get them to read correctly), for a time savings of about 10ms - which in turn adds up to a huge power savings.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;As far as following the datasheet carefully goes.&amp;nbsp; You can see that the pattern I implement follows the datasheet (the link is in my original post) precisely, although the datasheet doesn&amp;#39;t include an example with so few bytes of transfer.&amp;nbsp; Going by the datasheet, it would seem that you can only transfer a minimum of 6 bytes using the double buffer, but that doesn&amp;#39;t seem right.&amp;nbsp; In my application, where I&amp;#39;m transferring 3 bytes, my first TX byte is simultaneously the first byte (&lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt;TX = 0&lt;/span&gt; in the example from the datasheet) and the &lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt;TX = n-2&lt;/span&gt; byte from the example in the datasheet.&amp;nbsp; As a result, the datasheet isn&amp;#39;t very helpful.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Now if you could point out how my code differs from what the datasheet says, that would be very helpful - in fact, it&amp;#39;s why I posted this question asking for clarification on exactly that part of the datasheet.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Clarification on SPI double buffer and EVENTS_READY</title><link>https://devzone.nordicsemi.com/thread/275054?ContentTypeID=1</link><pubDate>Thu, 15 Oct 2020 11:36:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:18172661-4bc3-4211-b361-919e7d9de2ae</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;Seems you trying to use the old legacy implementation of SPI where you read and write individual bytes, it is better to use the SPIM module where you can prepare two buffers (rx and tx) and only execute the start task and the SPIM module will handle the rest until all data is sent/received.&lt;/p&gt;
&lt;p&gt;If you want to read and write low level registers using SPI peripheral you will need to follow the description in the datasheet carefully, you can also find an old implementation of&amp;nbsp;spi_master_tx_rx() in for instance nRF5 SDKv5.2 (\spi_master) from 2015 that you may find useful:&lt;br /&gt;&lt;a href="http://developer.nordicsemi.com/nRF5_SDK/nRF51_SDK_v5.x.x/"&gt;http://developer.nordicsemi.com/nRF5_SDK/nRF51_SDK_v5.x.x/&lt;/a&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>