<?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>implement 2 hardware SPI</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/32608/implement-2-hardware-spi</link><description>i want to implement 2 hardware SPI communication in my code. i have one already working. talking with LCD ILI9341. the functions are using spi_write / nrf_drv_spi_transfer for a single interface. what do i need to do to add another (4 pin) SPI interface</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 28 Mar 2018 19:15:58 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/32608/implement-2-hardware-spi" /><item><title>RE: implement 2 hardware SPI</title><link>https://devzone.nordicsemi.com/thread/126355?ContentTypeID=1</link><pubDate>Wed, 28 Mar 2018 19:15:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:dc47fc9b-731a-450b-9cbe-51195af7a7d4</guid><dc:creator>hmolesworth</dc:creator><description>&lt;p&gt;I notice I am using pull-up on MISO, not sure if that is relevant. Did you get your setup working?&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;// &amp;gt; P0.07 ACC-INT1    CNF: 0x00000000 [Sense: Off] [Drive: Normal] [Pull: None] [Input: Connected ] [Dir: Input ] (now 0) (no map)
// &amp;gt; P0.09 ACC-MISO    CNF: 0x0000000C [Sense: Off] [Drive: Normal] [Pull: P-Up] [Input: Connected ] [Dir: Input ] (now 1) (SPI2 MISO)
// &amp;gt; P0.17 ACC-SCK     CNF: 0x00000003 [Sense: Off] [Drive: Normal] [Pull: None] [Input: Disconnect] [Dir: Output] (now 0) (SPI2 SCK)
// &amp;gt; P0.19 ACC-MOSI    CNF: 0x00000003 [Sense: Off] [Drive: Normal] [Pull: None] [Input: Disconnect] [Dir: Output] (now 0) (SPI2 MOSI)
// &amp;gt; P0.20 ACC-CS      CNF: 0x00000003 [Sense: Off] [Drive: Normal] [Pull: None] [Input: Disconnect] [Dir: Output] (now 0) (no map)
&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: implement 2 hardware SPI</title><link>https://devzone.nordicsemi.com/thread/125881?ContentTypeID=1</link><pubDate>Sun, 25 Mar 2018 21:00:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ee69ca5b-9516-4f06-b48a-5d0ea7c2a262</guid><dc:creator>Dave_couling</dc:creator><description>&lt;p&gt;As Aryan mentioned you&amp;#39;d need to implement a method of selecting/deselecting the chip select pin on each of your SPI ICs.&amp;nbsp; I found the easier method for this is to writer a wrapper class around nrf_spi_drv&amp;nbsp; where you pass the chip select pins in at initialization.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: implement 2 hardware SPI</title><link>https://devzone.nordicsemi.com/thread/125879?ContentTypeID=1</link><pubDate>Sun, 25 Mar 2018 19:44:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:67d54565-4a96-4f6e-b928-529ea0859353</guid><dc:creator>hmolesworth</dc:creator><description>&lt;p&gt;If you are using standard Nordic libraries and so on then you just need to use a new instance and duplicate the code. ie if you are doing something like this:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;APP_ERROR_CHECK(nrf_drv_spi_init(&amp;amp;mAccSpiInstance, &amp;amp;spi_config, acc_spi_event_handler, NULL));
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Then all you need to do is duplicate the code - typically in a separate c module - and use a new instance thus:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;#define SPI_INSTANCE  1   // SPI instance index for 2nd SPI
static const nrf_drv_spi_t mAccSpiInstance = NRF_DRV_SPI_INSTANCE(SPI_INSTANCE);
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Ensure SPI1 is also enabled in sdk_config.h, of course, assuming you use SPI0 and SPI1.&lt;/p&gt;
&lt;p&gt;As an aside, I recommend your choice of hardware implementation as a physically separate SPI interconnect if you want the best analogue performance as any noise on the SPI lines - when updating the display, for instance - will inject some noise into the accelerometer unless you synchronously run the display interface outside of times when the accelerometer (or other SPI ADC or AFE) is being clocked&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: implement 2 hardware SPI</title><link>https://devzone.nordicsemi.com/thread/125866?ContentTypeID=1</link><pubDate>Sun, 25 Mar 2018 07:12:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:88aaf096-0265-4543-ad16-d480e9fb5e19</guid><dc:creator>yuval</dc:creator><description>&lt;p&gt;i already have another 4 pins connected to the acc chip:&lt;br /&gt;#define LSM6DS3_MOSI_PIN 12&lt;br /&gt;#define LSM6DS3_MISO_PIN 13&lt;br /&gt;#define LSM6DS3_SCK_PIN 14&lt;br /&gt;#define LSM6DS3_SS_PIN 15&lt;/p&gt;
&lt;p&gt;my question is , does anyone have a&amp;nbsp;code example of using 2 different SPI ?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: implement 2 hardware SPI</title><link>https://devzone.nordicsemi.com/thread/125554?ContentTypeID=1</link><pubDate>Thu, 22 Mar 2018 13:27:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a5da75aa-2014-4dc4-af07-6d3d2aee66de</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;You do not need to add another 4 pins, you can still use the same 4 pins to communicate with the accelerometer, but you need a new slave select pin for sending the data&amp;nbsp; to this slave. Please take a look at slave configuration at the &lt;a href="https://en.wikipedia.org/wiki/Serial_Peripheral_Interface_Bus"&gt;wiki&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>