<?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>how use nRF5 SDK14.2.0 SPI driver functions?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/30949/how-use-nrf5-sdk14-2-0-spi-driver-functions</link><description>Hi DevZone, 
 
 I am working on a CAN Bus library for communication between nRF52840 Preview DK and MCP2515 chipset. I am trying to modify base on an Arduino MCP2515 CAN Bus library but find many difficulties as I am a very junior Nordic board developer</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 02 Mar 2018 09:03:08 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/30949/how-use-nrf5-sdk14-2-0-spi-driver-functions" /><item><title>RE: how use nRF5 SDK14.2.0 SPI driver functions?</title><link>https://devzone.nordicsemi.com/thread/122569?ContentTypeID=1</link><pubDate>Fri, 02 Mar 2018 09:03:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c3aba280-9a35-4867-a877-003ac5f2e391</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;&lt;em&gt;&lt;a href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v14.2.0/group__nrf__drv__spi.html#gab022e003c9e5f0f946a5ecff0b455405"&gt;nrf_drv_spi_transfer&lt;/a&gt;&lt;/em&gt;() is used for both trasmitting and receiving data on SPI. SPI is normally implemented as a shift register, meaning you will have push bytes into the slave to get bytes back. Depending on what parameters you passed to&amp;nbsp;&lt;span&gt;&lt;em&gt;nrf_drv_spi_init&lt;/em&gt; when you setup the SPI driver, the driver can operate in blocking or non-blocking mode. If the value NULL were passed to the parameter &lt;em&gt;handler&lt;/em&gt; in &lt;em&gt;nrf_drv_spi_init&amp;nbsp;&lt;/em&gt;call, the received data will be available in&amp;nbsp;&lt;em&gt;p_rx_buffer&lt;/em&gt; when the call to&amp;nbsp;nrf_drv_spi_transfer returns. If you have passed a event handler, the driver will operate in non-blocking mode. The received data is then available in the buffer when you receive the&amp;nbsp;&lt;em&gt;&lt;a href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v14.2.0/group__nrf__drv__spi.html#ga352b9d6bd09a8bdf5bafe6e756cc5d50"&gt;NRF_DRV_SPI_EVENT_DONE&lt;/a&gt;&amp;nbsp;&lt;/em&gt;event in the handler.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;How you read/write registers should be described in the datasheet of the chip you are interfacing. Normally, you transmitt the address of the register you want to read/write to the slave, and&amp;nbsp;then keep on transfering the data, or read the data returned by the slave. Note that the SPI peripheral will fill the RX buffer while transmitting as well, which means that the RX buffer will have to have the size of the transmitted bytes pluss the received bytes, in case of a read operation.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: how use nRF5 SDK14.2.0 SPI driver functions?</title><link>https://devzone.nordicsemi.com/thread/122523?ContentTypeID=1</link><pubDate>Thu, 01 Mar 2018 23:27:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cfed8182-f2fc-4b67-853f-bb1fb800b496</guid><dc:creator>Ree Wang</dc:creator><description>&lt;p&gt;&lt;span&gt;Thanks,&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;I find function&amp;nbsp;&lt;a class="el" href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v14.2.0/group__nrf__drv__spi.html#gab022e003c9e5f0f946a5ecff0b455405"&gt;nrf_drv_spi_transfer&lt;/a&gt;&amp;nbsp;is used to transfer data from nRF to SPI peripheral device. Could you please tell me&amp;nbsp;&lt;/p&gt;
&lt;p&gt;1) which function is used to read&amp;nbsp;the data send from SPI peripheral device?&lt;/p&gt;
&lt;p&gt;2) Is it possible to&amp;nbsp;&lt;span&gt;read&amp;nbsp;and write the registers such as SPDR, SPSR and how to access the bit such as SPIF?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Sorry about these specific questions. The SPI peripheral I am using is a Arudino shield which uses a 3rd party library and AVR library, in that library, it uses SPDR, SPSR register and set register&amp;#39;s bit.&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: how use nRF5 SDK14.2.0 SPI driver functions?</title><link>https://devzone.nordicsemi.com/thread/122249?ContentTypeID=1</link><pubDate>Wed, 28 Feb 2018 09:55:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9783f70b-56f8-43ea-8650-e3b13c45acdc</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;There is an &lt;a href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v14.2.0/spi_master_example.html?cp=4_0_0_4_6_34"&gt;SPI master example application&lt;/a&gt; in our SDK, that show how to use the SPI master driver. The driver is also &lt;a href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v14.2.0/hardware_driver_spi_master.html?cp=4_0_0_2_12"&gt;described in details&lt;/a&gt; in the SDK documentation.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;br /&gt;Jørgen&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>