<?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>nRF52832 Errata 58 SPIM Fix</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/100324/nrf52832-errata-58-spim-fix</link><description>Hi All, 
 Project Information: nrf52832 nRF5 SDK 17.1.0 
 Segger 5.70a 
 We have a custom board design that is using the Analog Devices AD7785 AFE to interface with strain gauges. The AFE uses SPI to communicate. According to the datasheet and an FAE</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 07 Jun 2023 15:32:27 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/100324/nrf52832-errata-58-spim-fix" /><item><title>RE: nRF52832 Errata 58 SPIM Fix</title><link>https://devzone.nordicsemi.com/thread/429827?ContentTypeID=1</link><pubDate>Wed, 07 Jun 2023 15:32:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:102a2445-f58d-4f2f-b952-3d1bc9e23606</guid><dc:creator>hmolesworth</dc:creator><description>&lt;p&gt;You may have already tried this, but if not it will improve reliability of reception. Increase the nRF52 drive strength to CS, SCK and MOSI output drivers to H0H1 instead of the default S0S1. This can be done after the SPI init&amp;nbsp;nrfx_spim_init() if you are using Nordic libraries and want to avoid editing those.&lt;/p&gt;
&lt;p&gt;H0H1 on the clock pin SCK in particular can avoid incorrect data reception on MISO and only a very high bandwidth &amp;#39;scope will show the jitter on the AFE clock in pin transition which can cause bit corruption.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52832 Errata 58 SPIM Fix</title><link>https://devzone.nordicsemi.com/thread/429641?ContentTypeID=1</link><pubDate>Tue, 06 Jun 2023 17:15:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1e41e9ac-70ad-49f3-8b74-53c071471cbb</guid><dc:creator>dlewis</dc:creator><description>&lt;p&gt;After looking into this solution, it looks like the AFE can be communicated with using multi-byte transactions. There are 2 issues we are still running into. One is that the data being sent from the AFE to the micro is not consistent with what the datasheet says to expect. We are getting elevated within the manufacturer dev team for assistance on that. The other issue is that the nordic SPI driver appears to &amp;quot;miss&amp;quot; bits on the MISO pin. For instance, a logic analyzer shows MISO sends 0x8B (which is what the datasheet says to expect), but the nordic driver returns with a value of 0x83. This happens in many occasions, but I will make a separate post for this topic. Thanks for your help!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52832 Errata 58 SPIM Fix</title><link>https://devzone.nordicsemi.com/thread/428773?ContentTypeID=1</link><pubDate>Thu, 01 Jun 2023 13:45:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:91baea6a-5fb5-4f06-9b4b-aa36e0505e3b</guid><dc:creator>dlewis</dc:creator><description>&lt;p&gt;Okay thanks, I will look into this. The FAE I spoke to thinks you may be correct, but I will test and comment on the results when I get to it.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52832 Errata 58 SPIM Fix</title><link>https://devzone.nordicsemi.com/thread/428546?ContentTypeID=1</link><pubDate>Wed, 31 May 2023 16:08:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ca27dff4-1c2e-4ee9-9d36-6155378808d4</guid><dc:creator>hmolesworth</dc:creator><description>&lt;p&gt;Nope, multibyte transfer works. Try something like this (not tested) to read a number of registers (set CREAD to 1 if want to keep reading same register n times)&lt;/p&gt;
&lt;p&gt;Edit: Correction, consecutive register writes must prefix each register with the register address even in a block read/write (ie no auto-increment as in other similar parts). A multi-byte operation still works, however: &amp;lt;reg1&amp;gt;&amp;lt;data&amp;gt;&amp;lt;reg2&amp;gt;&amp;lt;data&amp;gt;.. &amp;quot;&lt;em&gt;For read or write operations, once the subsequent read or write operation to the selected register is complete, the interface returns to where it expects a write operation to the communications register&lt;/em&gt;&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;// ADC commands - check these, just did quick read of datasheet
#define ADC_COMMAND_WR ( 0xC0 )  // write register command
#define ADC_COMMAND_RR ( 0x00 )  // read register command

  uint8_t spiBuffer[5] = {0};
  // Read some registers (see datasheet for sizes) starting at (say) address 0
  spiBuffer[0] = ADC_COMMAND_RR + firstreg;  // command id + register 0 id then read 4 registers
  spiBuffer[1] = 0; // dummy tx value to read 8-bit reg 0
  spiBuffer[2] = ADC_COMMAND_RR + nextreg;
  spiBuffer[3] = 0; // dummy tx value to read 16-bit reg 2
  spiBuffer[4] = 0; // dummy tx value to read 16-bit reg 2
  // Send command and read the response
  spiTransact(sizeof(spiBuffer));&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52832 Errata 58 SPIM Fix</title><link>https://devzone.nordicsemi.com/thread/428535?ContentTypeID=1</link><pubDate>Wed, 31 May 2023 15:37:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b3c58f0b-8325-4250-b687-83c34346d226</guid><dc:creator>dlewis</dc:creator><description>&lt;p&gt;Hi&amp;nbsp;&lt;a class="internal-link view-user-profile" href="https://devzone.nordicsemi.com/members/hmolesworth"&gt;hmolesworth&lt;/a&gt;, thanks for the reply! I will contact the FAE again to confirm. I just took a look at the figures in the datasheet you mentioned, they appear to be referencing the collection of data from the AFE.&lt;/p&gt;
&lt;p&gt;The image below from page 14 of the datasheet is where the issue in question is arising from. In order to write to/read from the non data registers of the chip, it appears to require a single byte write to the comms register, and then require another CS toggle with 8 clocks to read from registers (i.e. status registers/identification registers). I originally tried using a multibyte transmission (1 transmit byte, 1 receive byte) but the&amp;nbsp;AFE did not operate correctly doing so in this manner. That is when I contacted the FAE and was told that these specific communications required the individual SPI transmissions/receptions.&amp;nbsp;&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/pastedimage1685547223920v1.png" alt=" " /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52832 Errata 58 SPIM Fix</title><link>https://devzone.nordicsemi.com/thread/428534?ContentTypeID=1</link><pubDate>Wed, 31 May 2023 15:28:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:16fba1b0-a635-4803-b2ce-9e955a3672b5</guid><dc:creator>hmolesworth</dc:creator><description>&lt;p&gt;The datasheet clearly indicates multi-byte transfer is possible and indeed expected; see Fig 18 and Fig 19. Perhaps the FAE didn&amp;#39;t gather what you were seeking. If using /CS repeated byte transfer is reliable. If not using /CS it might be wise to priodically use a reset sequence thus:&lt;/p&gt;
&lt;p&gt;&amp;quot;&lt;em&gt;The serial interface can be reset by writing a series of 1s on the DIN input. If a Logic 1 is written to the AD7785 line for at least 32 serial clock cycles, the serial interface is reset&lt;/em&gt;&amp;quot;&lt;/p&gt;
&lt;p&gt;Always wise to ensure transfers are reliable by a periodic readback of registers to ensure 1) the registers are set correctly and 2) the SPI sync is intact in case not using /CS&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>