<?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>3 WIRE SPI bi-directional communication</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/68214/3-wire-spi-bi-directional-communication</link><description>Hello! 
 Does the SDK support a 3-wire SPI interface with bi-directional communication? 
 Like this: 
 
 
 
 Thanks!</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 22 Feb 2021 08:41:40 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/68214/3-wire-spi-bi-directional-communication" /><item><title>RE: 3 WIRE SPI bi-directional communication</title><link>https://devzone.nordicsemi.com/thread/295494?ContentTypeID=1</link><pubDate>Mon, 22 Feb 2021 08:41:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1188277e-e4e9-420d-8bd3-29bff3542968</guid><dc:creator>A.P</dc:creator><description>&lt;p&gt;Hi! I&amp;#39;ve tried what you&amp;#39;ve mentioned here, and it works as far as enabling SPI communication.&lt;/p&gt;
[quote userid="85543" url="~/f/nordic-q-a/68214/3-wire-spi-bi-directional-communication/279989#279989"]We ended using the same SPI instance with different pins, we just need to enable/disable it every time we switch the device we are talking to[/quote]
&lt;p&gt;However, after configuring 2 SPI instances where one has MISO=PINX, MOSI unconnected, and the other has MISO= unconnected, MOSI=PINX, I see significant current leaks in all system modes (system on and system off).&lt;/p&gt;
&lt;p&gt;I&amp;nbsp;disable and uninit both SPI instances before entering low power mode.&lt;/p&gt;
&lt;p&gt;Have you tested power consumption after using this solution? Have you modified your board in any way to accommodate this solution or was this strictly software?&lt;/p&gt;
&lt;p&gt;Thanks!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: 3 WIRE SPI bi-directional communication</title><link>https://devzone.nordicsemi.com/thread/279990?ContentTypeID=1</link><pubDate>Sat, 14 Nov 2020 01:33:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b75454f9-3b7e-4ee2-a7ef-a5531bc52535</guid><dc:creator>Nguyen Hoan Hoang</dc:creator><description>&lt;p&gt;You can try this driver here that supports 3 wires directly no resistor require&lt;/p&gt;
&lt;p&gt;&lt;a href="https://github.com/IOsonata/IOsonata/blob/master/ARM/Nordic/src/spi_nrfx.cpp"&gt;https://github.com/IOsonata/IOsonata/blob/master/ARM/Nordic/src/spi_nrfx.cpp&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: 3 WIRE SPI bi-directional communication</title><link>https://devzone.nordicsemi.com/thread/279989?ContentTypeID=1</link><pubDate>Sat, 14 Nov 2020 01:08:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ea4d6da2-7659-4a01-87c9-ae864ec58e08</guid><dc:creator>Jose Cazarin</dc:creator><description>&lt;p&gt;We rather not access the registers directly in our code, but thanks for the answer&lt;br /&gt;We ended using the same SPI instance with different pins, we just need to enable/disable it every time we switch the device we are talking to&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: 3 WIRE SPI bi-directional communication</title><link>https://devzone.nordicsemi.com/thread/279985?ContentTypeID=1</link><pubDate>Fri, 13 Nov 2020 22:28:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b641ed81-d2bd-481e-b36b-a45463f93acf</guid><dc:creator>hmolesworth</dc:creator><description>&lt;p&gt;Yes&amp;nbsp; you can :-) This is a bare-metal example, but the same idea can be used with the Nordic drivers.&lt;/p&gt;
&lt;p&gt;Start in 3-wire command transmit;&amp;nbsp;Send the command, then configure for 3-wire receive:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;  // Send 3-wire whoami command byte (1 byte only)
  // Connect output drive, connect 1-wire rx/tx output to MOSI
  NRF_SPIM0-&amp;gt;PSEL.MISO = 0xFFFFFFFF; // MISOPIN;
  NRF_SPIM0-&amp;gt;PSEL.MOSI = MOSIPIN;
  NRF_GPIO-&amp;gt;PIN_CNF[MOSIPIN] = 1;    // output
  NRF_SPIM0-&amp;gt;TXD.PTR = (uint32_t)spi3wTXBuf;
  NRF_SPIM0-&amp;gt;TXD.MAXCNT = 1;
  NRF_SPIM0-&amp;gt;RXD.PTR = NULL;
  NRF_SPIM0-&amp;gt;RXD.MAXCNT = 0;
  NRF_SPIM0-&amp;gt;EVENTS_ENDTX = 0;
  NRF_GPIO-&amp;gt;OUTCLR = 1 &amp;lt;&amp;lt; CSPIN;       // drive cs low to initiate spi comm
  NRF_SPIM0-&amp;gt;TASKS_START = 1;
  while(!NRF_SPIM0-&amp;gt;EVENTS_ENDTX);     // last byte transmitted

  // Manual says disable SPI before changing pins, but actually doesn&amp;#39;t matter
  NRF_SPIM0-&amp;gt;ENABLE = 0;               // disable SPI
  // Disconnect output drive, connect 1-wire rx/tx input to MISO
  NRF_SPIM0-&amp;gt;PSEL.MOSI = 0xFFFFFFFFUL; // MOSIPIN;
  NRF_GPIO-&amp;gt;PIN_CNF[MOSIPIN] = 0;      // input pin, input buffer connected, no pull, S0S1, sense disabled
  NRF_SPIM0-&amp;gt;PSEL.MISO = MOSIPIN;      // MISOPIN;
  NRF_SPIM0-&amp;gt;ENABLE = 7;               // enable SPI if it was disabled&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;This works fine; on some SPI devices remember the internal 3-wire register mode has to be set first before reading.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: 3 WIRE SPI bi-directional communication</title><link>https://devzone.nordicsemi.com/thread/279570?ContentTypeID=1</link><pubDate>Wed, 11 Nov 2020 16:23:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:00d6e88c-1c8c-4de9-99cf-659509774d0a</guid><dc:creator>Jose Cazarin</dc:creator><description>&lt;p&gt;That would require a hardware change in our custom board&lt;/p&gt;
&lt;p&gt;Ok, thanks for the answer&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: 3 WIRE SPI bi-directional communication</title><link>https://devzone.nordicsemi.com/thread/279489?ContentTypeID=1</link><pubDate>Wed, 11 Nov 2020 13:08:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d3e994a4-c177-4006-9ad1-f1c351590f12</guid><dc:creator>ketiljo</dc:creator><description>&lt;p&gt;No initially, but you can connect the MISO and MOSI pins externally with a resistor.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>