<?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>SPIS on nRF51822</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/3408/spis-on-nrf51822</link><description>Hello, 
 While I was making SPIS part, I got several issues. 
 I am using STM32L151CB for SPI Master and nRF51822 for SPI Slave.
It seems many people had issues with SPIS. 
 SPIS Setting Code is here. 
 /*****************************************</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 01 Oct 2014 11:03:43 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/3408/spis-on-nrf51822" /><item><title>RE: SPIS on nRF51822</title><link>https://devzone.nordicsemi.com/thread/12376?ContentTypeID=1</link><pubDate>Wed, 01 Oct 2014 11:03:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6cd58576-5925-4a56-83ea-5e85808751e1</guid><dc:creator>Stefan Birnir Sverrisson</dc:creator><description>&lt;p&gt;You can not use the SPI slave with the first revision hardware, you need to buy a new kit/chip. See the &lt;a href="https://www.nordicsemi.com/eng/nordic/Products/nRF51822/PCN-082/24631"&gt;PCN-082 document&lt;/a&gt; to realize what chips are first revision and what chips are second revision.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPIS on nRF51822</title><link>https://devzone.nordicsemi.com/thread/12375?ContentTypeID=1</link><pubDate>Wed, 13 Aug 2014 10:57:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5efa8d95-cac0-4ad7-86b6-c651131ac5a7</guid><dc:creator>amposlove</dc:creator><description>&lt;p&gt;Oh, I just checked it. Then, is there any way to use SPI in first revision hardware as a slave mode? To update hardware means I should buy new model, right?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPIS on nRF51822</title><link>https://devzone.nordicsemi.com/thread/12374?ContentTypeID=1</link><pubDate>Wed, 13 Aug 2014 09:13:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:28f83f99-3ebb-465b-9796-5272c40f2f35</guid><dc:creator>Stefan Birnir Sverrisson</dc:creator><description>&lt;p&gt;You have the first revision hardware for the nRF51 (QFAAC0), which simply did not have SPI slave present, so that is the reason for your troubles. You should update your hardware to the second revision hardware where the SPIS is present. You can see this in the nRF51 compatibility matrix in nWP_018_v1.3 document found on our web site, in table 1.&lt;/p&gt;
&lt;p&gt;nRF51 SDK 5.1.0 is fine with S110 v6.0.0, however nRF51 SDK v5.2.0 is the latest SDK that is compatible with S110 v6.0.0, which includes the most fetures and bugfixes, so it is recommended to use SDK 5.2.0. SDK 5.2.0 however does not include any changes/improvements for SPI/SPIS, so in terms of SPI/SPIS, you should be fine with SDK 5.1.0 (see SDK 5.2.0 release notes).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPIS on nRF51822</title><link>https://devzone.nordicsemi.com/thread/12373?ContentTypeID=1</link><pubDate>Wed, 13 Aug 2014 06:44:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5ae7f4e1-745a-49a0-83c6-e504421b7f7e</guid><dc:creator>amposlove</dc:creator><description>&lt;p&gt;Package number is marked as N51822QFAAC01319AR, and I&amp;#39;m using softdevice S110 v6.0.0 and nRF51 SDK 5.1.0. Do I need to use SDK 5.2.0?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPIS on nRF51822</title><link>https://devzone.nordicsemi.com/thread/12372?ContentTypeID=1</link><pubDate>Wed, 13 Aug 2014 03:52:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2ce43bc3-d9c0-432c-adb4-324546fe2735</guid><dc:creator>Stefan Birnir Sverrisson</dc:creator><description>&lt;p&gt;What version of nRF51822 do you have, i.e. what are the chip markings on your three nRF51822 chips? Also, are you using softdevice S110 v6.0.0 and nRF51 SDK 5.2.0?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPIS on nRF51822</title><link>https://devzone.nordicsemi.com/thread/12371?ContentTypeID=1</link><pubDate>Tue, 12 Aug 2014 01:03:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:61035fef-d086-4c65-9fe1-f50d801740a9</guid><dc:creator>amposlove</dc:creator><description>&lt;p&gt;Thank you for your answer.&lt;/p&gt;
&lt;p&gt;First of all, I tested with spi_master_example_with_spi_slave example and the spi_slave_example example together, and it doesn&amp;#39;t work.&lt;/p&gt;
&lt;p&gt;I have 3 RF51822 modules, and every module looks work well on master side, but slave side seems strange include the problems which I report.&lt;/p&gt;
&lt;p&gt;Could you check that SPIS-&amp;gt;ORC register is changed(I&amp;#39;m sure p_spi_slave_config-&amp;gt;orc_tx_character value is 0x55)? Because my code doesn&amp;#39;t change the register value, I want check it. I&amp;#39;m using s110_nRF51922_6.0.0 softdevice.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPIS on nRF51822</title><link>https://devzone.nordicsemi.com/thread/12370?ContentTypeID=1</link><pubDate>Fri, 08 Aug 2014 11:04:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5c708cf8-4e25-4349-8b84-966547ee71f6</guid><dc:creator>Stefan Birnir Sverrisson</dc:creator><description>&lt;p&gt;Hi Ryan&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;STM32L151 is using CPOL as 0 and CPHA as 0, so I set SPI_MODE as SPI_MODE_1, and it uses MSB_First&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Shouldn&amp;#39;t you choose the same configuration for the nRF51 SPIS, i.e. SPI_MODE_0?&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Are initial values of MAXRX and MAXTX registers right values?&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;When you set the buffers in main with spi_slave_buffers_set, a state change is performed with call to&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;sm_state_change(SPI_BUFFER_RESOURCE_REQUESTED);
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;that will acquire the semaphore by calling the ACQUIRE task. The application receives in turn the ACQUIRED event where the following code is executed in the SPI1_TWI1_IRQHandler which actually sets the buffer configuration&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;NRF_SPIS1-&amp;gt;TXDPTR = (uint32_t)mp_spi_tx_buf;
NRF_SPIS1-&amp;gt;RXDPTR = (uint32_t)mp_spi_rx_buf;
NRF_SPIS1-&amp;gt;MAXRX  = m_spi_rx_buf_size;
NRF_SPIS1-&amp;gt;MAXTX  = m_spi_tx_buf_size;
            
NRF_SPIS1-&amp;gt;TASKS_RELEASE = 1u;
            
sm_state_change(SPI_BUFFER_RESOURCE_CONFIGURED);
&lt;/code&gt;&lt;/pre&gt;
&lt;ul&gt;
&lt;li&gt;NRF_SPIS1-&amp;gt;ORC = 0x55 doesn&amp;#39;t work at all. See below 2 capture images.&lt;/li&gt;
&lt;li&gt;NRF_SPIS1-&amp;gt;SHORTS register is not able to change. See below 2 capture images. Of course, I checked SPIS_SHORTS_END_ACQUIRE_Enabled is 0x01.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Hmm, that is strange, works fine on my side. Are you sure the value of p_spi_slave_config-&amp;gt;orc_tx_character is 0x55? Try to set the compiler optimization level to 0 and disable cache as shown below, clean target and rebuild&lt;/p&gt;
&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/Capture-_2D00_-Keil-compiler-optimization.JPG" alt="image description" /&gt;
&lt;img src="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/Capture-_2D00_-Keil-cache-options.JPG" alt="image description" /&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;NRF_SPIS1-&amp;gt;INTENCLR is set automatically when NRF_SPIS1-&amp;gt;INTENSET is set&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;I can aggree with you, the representation in the debugger is somewhat confusing, but if you disable the interrupts again by writing into the INTENCLR register with the code below then you can see that the interrupt becomes disabled again&lt;/p&gt;
&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/Capture-_2D00_-Keil-debugger-_2D00_-SPIS-interrupts-disabled.JPG" alt="image description" /&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Because my code can&amp;#39;t jump into spi_slave_event_handle(SPIS handler)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;You should get an SPIS-&amp;gt;END event (which will in turn call your spi_slave_event_handle) when the SPI master finishes the transaction by setting CSN high (CSN is active low). Initialize the CSN by letting the SPI master set the CSN to high at the start of your main function. When you want to transmit data, let the SPI master set CSN low, then transmit your data. Then to finish the transaction and get the SPIS-&amp;gt;END event, set the CSN high.&lt;/p&gt;
&lt;p&gt;What SPI clock frequency have you selected?&lt;/p&gt;
&lt;p&gt;Have you tried to run the spi_master_example_with_spi_slave example with the spi_slave_example example, on two boards. Does that work?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>