<?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>SPI AND SPIM  READING ISSUES</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/43007/spi-and-spim-reading-issues</link><description>hi all i am trying to read data from a sensor in burst mode i can&amp;quot;t able to read all datas from the register .I tried to read the data in both spi and spim(with easydma) . spim is more better it reads data from 2 register(i am trying to read data of 3</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 14 Feb 2019 07:30:14 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/43007/spi-and-spim-reading-issues" /><item><title>RE: SPI AND SPIM  READING ISSUES</title><link>https://devzone.nordicsemi.com/thread/171018?ContentTypeID=1</link><pubDate>Thu, 14 Feb 2019 07:30:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8f7a1d74-fe0d-42b5-a399-876b7782c8e0</guid><dc:creator>NANDHU</dc:creator><description>&lt;p&gt;SIR PLEASE REPLY&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;WHY WE CAN&amp;#39;T READ MORE THAN I BYTE USEING&amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;quot;nrf_drv_spi_transfer(i_spi_address,NULL,0,&amp;amp;rx_bm_data[0],3)&amp;quot; THIS FUNCTION&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;BY THIS CONFIGURATION&lt;/p&gt;
&lt;p&gt;spi_config.ss_pin = SPI_MOUSE_CSN_PIN;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;THE WRITE OPERATION OF MORE THEN 2 BYTE IS GETTING PROPERLY WITH THIS FUNCTION&lt;/p&gt;
&lt;p&gt;&amp;quot;nrf_drv_spi_transfer(i_spi_address,(const uint8_t *)&amp;amp;tx_data[0],2,&amp;amp;rx_data[0],2)&amp;quot;&lt;/p&gt;
&lt;p&gt;BY THIS CONFIGURATION&lt;/p&gt;
&lt;p&gt;spi_config.ss_pin = SPI_MOUSE_CSN_PIN;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI AND SPIM  READING ISSUES</title><link>https://devzone.nordicsemi.com/thread/170494?ContentTypeID=1</link><pubDate>Tue, 12 Feb 2019 06:41:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6486b09a-5cac-4845-8264-b6c605f6cecd</guid><dc:creator>NANDHU</dc:creator><description>&lt;p&gt;BUT I WANT READ THE DATA IN BURST MODE . THEN ONLY THE DEVICE WORK PROPERLY.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI AND SPIM  READING ISSUES</title><link>https://devzone.nordicsemi.com/thread/170493?ContentTypeID=1</link><pubDate>Tue, 12 Feb 2019 06:38:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d48ff537-fcdc-441a-a96a-547520cfb686</guid><dc:creator>NANDHU</dc:creator><description>&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/Screenshot-2019_2D00_02_2D00_12-12.07.53.png" alt=" " /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI AND SPIM  READING ISSUES</title><link>https://devzone.nordicsemi.com/thread/170492?ContentTypeID=1</link><pubDate>Tue, 12 Feb 2019 06:38:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:eeb5b30e-74b1-4888-949d-153214768d0a</guid><dc:creator>NANDHU</dc:creator><description>&lt;p&gt;SIR WHEN I USED SPI (NOT SPIM &amp;quot;&lt;span&gt;SPI0_USE_EASY_DMA 0 &amp;quot;IN&amp;nbsp;&amp;nbsp;sdk_config.h) AND NORMAL READ OPERATION THE VALUES FROM ALL THREE REGISTER GETTING PROPERLY.I WILL PLACE THE CODE FOR NORMAL READ BELOW&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;uint32_t adns_reg_read(const nrf_drv_spi_t * i_spi_address,uint8_t i_reg, uint8_t *io_data)&lt;br /&gt;{&lt;br /&gt; uint32_t err_code;&lt;br /&gt; &lt;br /&gt; /* Read operation. See ADNS-3530 datasheet (p.12). &lt;br /&gt; &lt;br /&gt; A read operation, defined as data going from the ADNS-3530 Sensor to the&lt;br /&gt; micro-controller, is always initiated by the micro-controller and consists&lt;br /&gt; of two bytes. The first byte contains the address, is sent by the micro-controller&lt;br /&gt; over MOSI, and has a &amp;quot;0&amp;quot; as its MSB to indicate data direction. The second byte&lt;br /&gt; contains the data and is driven by the ADNS-3530 Sensor over MISO. The sensor outputs&lt;br /&gt; MISO bits on falling edges of SCLK and samples MOSI bits on every rising edge of SCLK. &lt;br /&gt; &lt;br /&gt; */&lt;br /&gt; uint8_t tx_data[2];&lt;br /&gt; uint8_t rx_data[2];&lt;/p&gt;
&lt;p&gt;// Reset serial port&lt;br /&gt; adns_ncs_assert(i_spi_address,1); //disable ncs&lt;br /&gt; adns_ncs_assert(i_spi_address,0); //enable ncs&lt;br /&gt; &lt;br /&gt; if(i_spi_address == NULL | io_data == NULL)&lt;br /&gt; {&lt;br /&gt; return NRF_ERROR_INVALID_PARAM;&lt;br /&gt; }&lt;br /&gt; &lt;br /&gt; // The MSB to &amp;quot;0&amp;quot; to indicate a read operation&lt;br /&gt; tx_data[0]= i_reg &amp;amp; 0x7f; &lt;br /&gt; tx_data[1]= 0xff; // Buffer to provide clock for rx data. &lt;br /&gt; &lt;br /&gt; // Send the address to read&lt;br /&gt; APP_ERROR_CHECK(nrf_drv_spi_transfer(i_spi_address,(const uint8_t *)&amp;amp;tx_data[0],1,&amp;amp;rx_data[0],1));&lt;/p&gt;
&lt;p&gt;nrf_delay_us(4); // tSRAD delay&lt;br /&gt; &lt;br /&gt; // Read the data by sending a dummy byte&lt;br /&gt; APP_ERROR_CHECK(nrf_drv_spi_transfer(i_spi_address,(const uint8_t *)&amp;amp;tx_data[1],1,&amp;amp;rx_data[1],1));&lt;/p&gt;
&lt;p&gt;adns_ncs_assert(i_spi_address,1); //disable ncs&lt;br /&gt; &lt;br /&gt; // Return the second byte from rx_data&lt;br /&gt; *io_data = rx_data[1];&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;return NRF_SUCCESS;&lt;br /&gt;}&lt;/p&gt;
&lt;p&gt;/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI AND SPIM  READING ISSUES</title><link>https://devzone.nordicsemi.com/thread/170480?ContentTypeID=1</link><pubDate>Tue, 12 Feb 2019 04:16:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a7522595-938c-4573-92ff-6a3a729cc53d</guid><dc:creator>NANDHU</dc:creator><description>&lt;p&gt;sir is there any major difference between spi and spim data transfer except that easydma involvement&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI AND SPIM  READING ISSUES</title><link>https://devzone.nordicsemi.com/thread/170261?ContentTypeID=1</link><pubDate>Mon, 11 Feb 2019 06:21:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0856b410-a103-4894-933e-ff011b9db27c</guid><dc:creator>NANDHU</dc:creator><description>&lt;p&gt;sir pls help&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI AND SPIM  READING ISSUES</title><link>https://devzone.nordicsemi.com/thread/170260?ContentTypeID=1</link><pubDate>Mon, 11 Feb 2019 06:20:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4f3e7369-1753-405c-a1d6-ef2ab452164a</guid><dc:creator>NANDHU</dc:creator><description>&lt;p&gt;sir i changed&amp;nbsp;&lt;span&gt;tx_bm_dummy to NULL in second call to&amp;nbsp;nrf_drv_spi_transfer, and set the tx_length parameter to 0 put datas are not getting i don&amp;#39;t known why&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI AND SPIM  READING ISSUES</title><link>https://devzone.nordicsemi.com/thread/170212?ContentTypeID=1</link><pubDate>Sat, 09 Feb 2019 10:49:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b4ac7438-f128-440b-9aa8-44a39d2cabfc</guid><dc:creator>NANDHU</dc:creator><description>&lt;p&gt;i will try it sir&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI AND SPIM  READING ISSUES</title><link>https://devzone.nordicsemi.com/thread/170117?ContentTypeID=1</link><pubDate>Fri, 08 Feb 2019 12:34:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:353e9690-4be0-4237-b3f4-0910a17fd066</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Try changing&amp;nbsp;&lt;span&gt;tx_bm_dummy to NULL in second call to&amp;nbsp;nrf_drv_spi_transfer, and set the tx_length parameter to 0. In your current code you will write three bytes from whatever you have initialized&amp;nbsp;tx_bm_dummy&amp;nbsp;to (or garbage data from RAM if not initialized), to the SPI slave. The peripheral will automatically clock out dummy bytes when you do a read operation.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;You say that you can only receive the data once, how do you start the transfer? Have you tried &lt;a href="https://www.youtube.com/watch?v=uP8RYgYGRvI"&gt;debugging the application&lt;/a&gt;, to see if any error codes are reported?&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI AND SPIM  READING ISSUES</title><link>https://devzone.nordicsemi.com/thread/170116?ContentTypeID=1</link><pubDate>Fri, 08 Feb 2019 12:14:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:50fe6dcc-7d43-4bee-a66e-243661b1b010</guid><dc:creator>NANDHU</dc:creator><description>&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/Screenshot-2019_2D00_02_2D00_08-17.42.39.png" alt=" " /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;THIS IS HOW WE WANT TO READ&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI AND SPIM  READING ISSUES</title><link>https://devzone.nordicsemi.com/thread/170111?ContentTypeID=1</link><pubDate>Fri, 08 Feb 2019 11:59:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:87f287e8-7805-469f-9e06-b64f2a240a7c</guid><dc:creator>NANDHU</dc:creator><description>&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/Screenshot-2019_2D00_02_2D00_08-17.24.24.png" alt=" " /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;look the screen short i can get the value only once in the intial then it well not get&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI AND SPIM  READING ISSUES</title><link>https://devzone.nordicsemi.com/thread/170089?ContentTypeID=1</link><pubDate>Fri, 08 Feb 2019 10:10:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:37204893-f5f9-45ac-a906-01c153548cb8</guid><dc:creator>NANDHU</dc:creator><description>&lt;p&gt;when i debugged it shows the value of all three register once then no value is reading&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI AND SPIM  READING ISSUES</title><link>https://devzone.nordicsemi.com/thread/170085?ContentTypeID=1</link><pubDate>Fri, 08 Feb 2019 10:02:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e8eca14b-7f29-4a9d-8e19-08c589d46a30</guid><dc:creator>NANDHU</dc:creator><description>&lt;p&gt;CONFIGURATION OF SPI&lt;/p&gt;
&lt;p&gt;nrf_drv_spi_config_t spi_config = NRF_DRV_SPI_DEFAULT_CONFIG;&lt;br /&gt; spi_config.ss_pin = NRF_DRV_SPI_PIN_NOT_USED;&lt;br /&gt; spi_config.miso_pin = SPI_MOUSE_MISO_PIN;&lt;br /&gt; spi_config.mosi_pin = SPI_MOUSE_MOSI_PIN;&lt;br /&gt; spi_config.sck_pin = SPI_MOUSE_SCK_PIN;&lt;br /&gt; spi_config.frequency = NRF_SPI_FREQ_1M;&lt;br /&gt; spi_config.bit_order = NRF_DRV_SPI_BIT_ORDER_MSB_FIRST;&lt;br /&gt; spi_config.irq_priority = SPI_DEFAULT_CONFIG_IRQ_PRIORITY;&lt;br /&gt; spi_config.mode = NRF_DRV_SPI_MODE_0;&lt;br /&gt; spi_config.orc = 0xFF;&lt;/p&gt;
&lt;p&gt;err_code = nrf_drv_spi_init(&amp;amp;spi, &amp;amp;spi_config,NULL, NULL);&lt;br /&gt; if(err_code != NRF_SUCCESS)&lt;br /&gt; return NRF_ERROR_SPI;&lt;/p&gt;
&lt;p&gt;////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////&lt;/p&gt;
&lt;p&gt;FUNCTION FOR READING DATA IN BURST MODE&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;uint32_t adns_motion_burst_read(const nrf_drv_spi_t * i_spi_address , uint8_t * motion , uint8_t * deltaY , uint8_t * deltaX)&lt;br /&gt;{&lt;br /&gt; &lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;uint32_t err_code;&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;if (i_spi_address == NULL )&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;return NRF_ERROR_INVALID_PARAM;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;br /&gt; &lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;uint8_t tx_bm_data;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;uint8_t rx_bm_dummy; //receive buffer for dummy&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;uint8_t i_reg;&lt;br /&gt; &lt;br /&gt;&amp;nbsp; &amp;nbsp; // Reset serial port&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;adns_ncs_assert(i_spi_address,1); //disable ncs&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;adns_ncs_assert(i_spi_address,0); //enable nc&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;i_reg = ADNS_REG_MOTION_BURST;&lt;br /&gt;&amp;nbsp; &amp;nbsp; // Format for register in burstmode read &lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;tx_bm_data = i_reg &amp;amp; 0x7f; // The MSB to &amp;quot;0&amp;quot; to indicate a read operation&lt;br /&gt; &lt;br /&gt; &amp;nbsp; &amp;nbsp;// Write to Motion_Burst register. &lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;APP_ERROR_CHECK(nrf_drv_spi_transfer(i_spi_address,(const uint8_t&amp;nbsp; *)&amp;amp;tx_bm_data,1,&amp;amp;rx_bm_dummy,1));&lt;br /&gt;&amp;nbsp; &amp;nbsp;*motion = rx_bm_dummy; // Execute dummy read to clear RX buffer for motion&lt;br /&gt; &lt;br /&gt; &lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;nrf_delay_us(4); //tSRAD &lt;br /&gt; &lt;br /&gt;&amp;nbsp; &amp;nbsp;//Read motion datas by Writing out a dummy data byte which will be ignored&amp;nbsp;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;APP_ERROR_CHECK(nrf_drv_spi_transfer(i_spi_address,(const uint8_t&amp;nbsp; *)&amp;amp;tx_bm_dummy[0],3,&amp;amp;rx_bm_data[0],3)); &lt;br /&gt; &lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp; adns_ncs_assert(i_spi_address,1); //disable ncs&lt;br /&gt; &lt;br /&gt; &lt;br /&gt;&amp;nbsp; &amp;nbsp; *motion = rx_bm_data[0];&lt;br /&gt;&amp;nbsp; &amp;nbsp; *deltaY = rx_bm_data[1];&lt;br /&gt;&amp;nbsp; &amp;nbsp; *deltaX = rx_bm_data[2];&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;nrf_delay_us(1); //tBEXIT&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;return NRF_SUCCESS;&lt;br /&gt;}&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////&lt;/p&gt;
&lt;p&gt;sdk_config.h&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;#ifndef SPI0_ENABLED&lt;br /&gt;#define SPI0_ENABLED 1&lt;br /&gt;#endif&lt;br /&gt;// &amp;lt;q&amp;gt; SPI0_USE_EASY_DMA - Use EasyDMA&lt;/p&gt;
&lt;p&gt;#ifndef SPI0_USE_EASY_DMA&lt;br /&gt;#define SPI0_USE_EASY_DMA 0&lt;br /&gt;#endif&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI AND SPIM  READING ISSUES</title><link>https://devzone.nordicsemi.com/thread/170076?ContentTypeID=1</link><pubDate>Fri, 08 Feb 2019 09:38:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bf8538b8-7d13-46c8-b6af-2e2cdf4a7c73</guid><dc:creator>NANDHU</dc:creator><description>&lt;p&gt;SIR I CHANGED &amp;quot;spi_config.ss_pin = SPI_MOUSE_CSN_PIN;&amp;quot; TO &amp;quot;spi_config.sck_pin = NRF_DRV_SPI_PIN_NOT_USED;&lt;/p&gt;
&lt;p&gt;BUT I CAN&amp;quot;T ABLE TO READ DATA FROM ALL 3 REGISTERS&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI AND SPIM  READING ISSUES</title><link>https://devzone.nordicsemi.com/thread/169619?ContentTypeID=1</link><pubDate>Wed, 06 Feb 2019 04:08:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e13361e3-0676-47a1-93de-113002f245e2</guid><dc:creator>NANDHU</dc:creator><description>&lt;p&gt;thanks for your clarification i will try it&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI AND SPIM  READING ISSUES</title><link>https://devzone.nordicsemi.com/thread/169589?ContentTypeID=1</link><pubDate>Tue, 05 Feb 2019 16:46:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6099a342-8c7a-420b-98c7-3ffe325dd3e7</guid><dc:creator>hmolesworth</dc:creator><description>&lt;p&gt;Yes, I thought I made that clear. You require the following if you are manually driving NCS before and after the two transfers:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;spi_config.sck_pin = NRF_DRV_SPI_PIN_NOT_USED;&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;This is the default, as I posted above, so you can also just remove .sck_pin in initialisation&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI AND SPIM  READING ISSUES</title><link>https://devzone.nordicsemi.com/thread/169588?ContentTypeID=1</link><pubDate>Tue, 05 Feb 2019 16:36:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fc668c5a-a1a6-4c89-a995-dd6290f1a457</guid><dc:creator>NANDHU</dc:creator><description>&lt;p&gt;pls reply sir&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI AND SPIM  READING ISSUES</title><link>https://devzone.nordicsemi.com/thread/169200?ContentTypeID=1</link><pubDate>Mon, 04 Feb 2019 04:01:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a702c0de-e573-4255-9885-4a32316b8748</guid><dc:creator>NANDHU</dc:creator><description>&lt;p&gt;so i want to remove this&amp;nbsp; &amp;quot;spi_config.ss_pin = SPI_MOUSE_CSN_PIN;&amp;quot; portion from the code&amp;nbsp; then only i get correct data from burst mode read.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI AND SPIM  READING ISSUES</title><link>https://devzone.nordicsemi.com/thread/169158?ContentTypeID=1</link><pubDate>Sat, 02 Feb 2019 16:51:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ab0849dd-a59f-42f9-a6db-25455fd64453</guid><dc:creator>hmolesworth</dc:creator><description>&lt;p&gt;I assume you control NCS correctly, setting low before the first of two transfers and only high after the second with the 4 uSec delay between the two transfers. However your code shows that you are also telling the nRF SPI code to take control of NCS. Here is the default setting for NCS and the handler for init:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;// Starts by assuming NCS is not required

/**
 * @brief SPI master instance default configuration.
 */
#define NRF_DRV_SPI_DEFAULT_CONFIG                           \
{                                                            \
    .sck_pin      = NRF_DRV_SPI_PIN_NOT_USED,                \
    .mosi_pin     = NRF_DRV_SPI_PIN_NOT_USED,                \
    .miso_pin     = NRF_DRV_SPI_PIN_NOT_USED,                \
    .ss_pin       = NRF_DRV_SPI_PIN_NOT_USED,                \
    .irq_priority = SPI_DEFAULT_CONFIG_IRQ_PRIORITY,         \
    .orc          = 0xFF,                                    \
    .frequency    = NRF_DRV_SPI_FREQ_4M,                     \
    .mode         = NRF_DRV_SPI_MODE_0,                      \
    .bit_order    = NRF_DRV_SPI_BIT_ORDER_MSB_FIRST,         \
}

// Tests if NCS is not required

    // - Slave Select (optional) - output with initial value 1 (inactive).
    if (p_config-&amp;gt;ss_pin != NRF_DRV_SPI_PIN_NOT_USED)
    {
        nrf_gpio_pin_set(p_config-&amp;gt;ss_pin);
        nrf_gpio_cfg_output(p_config-&amp;gt;ss_pin);
    }
    m_cb[p_instance-&amp;gt;drv_inst_idx].ss_pin = p_config-&amp;gt;ss_pin;

&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;However your code shows that you are requesting the nRF SPI driver to take over NCS:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;spi_config.ss_pin = SPI_MOUSE_CSN_PIN;&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;The nRF handler will now drive NCS low before and high after every transaction, including between the two transactions you require, for example sww nrf_drv_spi.c&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;static void finish_transfer(spi_control_block_t * p_cb)
{
    // If Slave Select signal is used, this is the time to deactivate it.
    if (p_cb-&amp;gt;ss_pin != NRF_DRV_SPI_PIN_NOT_USED)
    {
        nrf_gpio_pin_set(p_cb-&amp;gt;ss_pin);
    }

&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI AND SPIM  READING ISSUES</title><link>https://devzone.nordicsemi.com/thread/169140?ContentTypeID=1</link><pubDate>Sat, 02 Feb 2019 04:20:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3399195c-a9b3-41c9-808d-c47e47617361</guid><dc:creator>NANDHU</dc:creator><description>&lt;p&gt;sir how &amp;quot;spi_config.ss_pin = SPI_MOUSE_CSN_PIN;&amp;quot;&lt;span&gt;&amp;nbsp;causes the SPIM driver to de-activate NCS between the first byte and the next 3 bytes, which terminates the burst transfer.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;i&amp;nbsp; am changeing&amp;nbsp; manually NCS low before and after the transfers( and not between look at the code i posted at the beginning)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;adns_ncs_assert(i_spi_address,1); //disable ncs&lt;br /&gt;adns_ncs_assert(i_spi_address,0); //enable ncs&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;look this&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI AND SPIM  READING ISSUES</title><link>https://devzone.nordicsemi.com/thread/168309?ContentTypeID=1</link><pubDate>Mon, 28 Jan 2019 16:34:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ea96b317-c243-4866-a8ca-3d18309cbc57</guid><dc:creator>hmolesworth</dc:creator><description>&lt;p&gt;This is the problem, I think:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;spi_config.ss_pin = SPI_MOUSE_CSN_PIN;&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;This causes the SPIM driver to de-activate NCS between the first byte and the next 3 bytes, which terminates the burst transfer. Change this to manually drive NCS low before and after the transfers, not between.&lt;/p&gt;
&lt;p&gt;From the data sheet &amp;quot;&lt;em&gt;After sending the register address, the microcontroller must wait tSRAD and then begin reading data. All data bits can be read with no delay between bytes by driving SCLK at the normal rate.&lt;/em&gt;&amp;quot; tSRAD is 4uSecs, so for the &amp;quot;burst&amp;quot; read you are using the first byte is sent without removing NCS the three bytes are read in in the next SPI transfer, So send two commands and do not allow the spim handler to drive NCS and ensure there is at least 4 usec delay between 1st and second commands.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI AND SPIM  READING ISSUES</title><link>https://devzone.nordicsemi.com/thread/168125?ContentTypeID=1</link><pubDate>Mon, 28 Jan 2019 05:42:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a712ce6c-aead-4623-a2a5-ddf1a6b510f5</guid><dc:creator>NANDHU</dc:creator><description>&lt;p&gt;SPI initialization was correct and the data from sensor registers are getting when the sensor registers read separately (SPI USED NOT SPIM). If BURST MODE(SPIM IS USED) is used motion register data getting data from x and y register is not getting.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;nrf_drv_spi_config_t spi_config = NRF_DRV_SPI_DEFAULT_CONFIG;&lt;br /&gt; spi_config.ss_pin = SPI_MOUSE_CSN_PIN;&lt;br /&gt; spi_config.miso_pin = SPI_MOUSE_MISO_PIN;&lt;br /&gt; spi_config.mosi_pin = SPI_MOUSE_MOSI_PIN;&lt;br /&gt; spi_config.sck_pin = SPI_MOUSE_SCK_PIN;&lt;br /&gt; spi_config.frequency = NRF_SPI_FREQ_1M;&lt;br /&gt; spi_config.bit_order = NRF_DRV_SPI_BIT_ORDER_MSB_FIRST;&lt;br /&gt; spi_config.irq_priority = SPI_DEFAULT_CONFIG_IRQ_PRIORITY;&lt;br /&gt; spi_config.mode = NRF_DRV_SPI_MODE_0;&lt;br /&gt; spi_config.orc = 0xFF;&lt;br /&gt; &lt;br /&gt; err_code = nrf_drv_spi_init(&amp;amp;spi, &amp;amp;spi_config,NULL, NULL);&lt;br /&gt; if(err_code != NRF_SUCCESS)&lt;br /&gt; return NRF_ERROR_SPI;&lt;/p&gt;
&lt;p&gt;SPI INSTANCE 0 IS USED&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI AND SPIM  READING ISSUES</title><link>https://devzone.nordicsemi.com/thread/168124?ContentTypeID=1</link><pubDate>Mon, 28 Jan 2019 05:32:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:18a74507-9fa5-48a8-8232-88d48065ffc6</guid><dc:creator>NANDHU</dc:creator><description>&lt;p&gt;&amp;nbsp;yes uint8_t rx_bm_dummy;&amp;nbsp; is a single byte&amp;nbsp; this byte is only used when there is a w&lt;span&gt;rite to &amp;quot;Motion_Burst register&amp;quot; the value received in these variable has no use.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;For receiving&amp;nbsp; valued datas from motion register ,x_Delta register and y_Delta register i used&amp;nbsp; uint8_t rx_bm_data[3]; its declared globally&amp;nbsp; its not in the above code i posted.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Sir i also tried with&amp;nbsp; transmit&amp;nbsp; byte instead of null in this function&amp;nbsp;&amp;quot;nrf_drv_spi_transfer(i_spi_address,NULL,0,&amp;amp;rx_bm_data[0],1));&amp;quot; call but not receiving all three&amp;nbsp; datas&amp;nbsp;correctly.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;i can&amp;quot;t find out what the issue is . when reading the register data individually&amp;nbsp; its getting correctly but using burst mode not receiving correctly&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI AND SPIM  READING ISSUES</title><link>https://devzone.nordicsemi.com/thread/168110?ContentTypeID=1</link><pubDate>Sun, 27 Jan 2019 20:24:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5ff23730-d6de-4031-ba63-4b625f015156</guid><dc:creator>hmolesworth</dc:creator><description>&lt;p&gt;In passing I would suggest your code will not work as NULL or 0 for tx buffer and length is not valid and will cause an assert; this is the assert trap discussed in&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/42126/spi-master-pin-set-and-clear"&gt;this&lt;/a&gt; thread (have to keep loading more to see the that post):&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;    ASSERT(p_cb-&amp;gt;state != NRF_DRV_STATE_UNINITIALIZED);
    ASSERT(p_xfer_desc-&amp;gt;p_tx_buffer != NULL || p_xfer_desc-&amp;gt;tx_length == 0);
    ASSERT(p_xfer_desc-&amp;gt;p_rx_buffer != NULL || p_xfer_desc-&amp;gt;rx_length == 0);&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;At least 1 transmit byte is required. Typically one would read all 3 bytes in a single invocation, assuming the hardware device allows thatwhich your device may not&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;// Write out a dummy data byte which will be ignored and read motion data 
 APP_ERROR_CHECK(nrf_drv_spi_transfer(i_spi_address,tx_buf, 1, rx_bm_data, 3)); 
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;I haven&amp;#39;t looked at the rest of the code, but I think it requires review; for example, this is not a buffer but a single byte:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;uint8_t rx_bm_dummy; //receive buffer for dummy&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;This is probably the intention:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;uint8_t rx_bm_dummy[3]; // 3-byte receive buffer for dummy&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI AND SPIM  READING ISSUES</title><link>https://devzone.nordicsemi.com/thread/168097?ContentTypeID=1</link><pubDate>Sun, 27 Jan 2019 16:34:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:da2e93e8-cbd7-4e09-b69f-616df287f716</guid><dc:creator>NANDHU</dc:creator><description>&lt;p&gt;sir i answered to your question i didn&amp;quot;t got any replys&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>