<?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 initialization according to spec</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/7441/spi-initialization-according-to-spec</link><description>I am initializing an SPI master to talk to ADXL362 accelerometer using NRF51-DK. 
 Datasheet page 19: www.analog.com/.../ADXL362.pdf 
 No matter what I do connected or disconnected, I always get 0xFF back. Makes no difference changing transfer speed</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 10 Jun 2015 12:54:36 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/7441/spi-initialization-according-to-spec" /><item><title>RE: SPI initialization according to spec</title><link>https://devzone.nordicsemi.com/thread/26522?ContentTypeID=1</link><pubDate>Wed, 10 Jun 2015 12:54:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:32bfc082-07f8-4dff-9fa0-a8ebc682a813</guid><dc:creator>Emil</dc:creator><description>&lt;p&gt;By the way  - The gap is as much as &amp;gt; 40us between the 2 first bytes and the 3rd byte. This can be a problem when reading X Y Z data. I read a post here about having &amp;quot;gapless&amp;quot; burst transfers here: &lt;a href="https://devzone.nordicsemi.com/question/7934/speed-up-spi-burst-reads/"&gt;devzone.nordicsemi.com/.../&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;But is this relevant with the current SDK? I&amp;#39;d like to just use the buffer directly to have optimum burst performance.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI initialization according to spec</title><link>https://devzone.nordicsemi.com/thread/26521?ContentTypeID=1</link><pubDate>Wed, 10 Jun 2015 10:31:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d224e06d-0fae-4820-b86c-5bf76341db46</guid><dc:creator>Emil</dc:creator><description>&lt;p&gt;It is the ADXL362 itself I think. I searched on various forums etc, and they had to be careful about cable lengths and add  filtering caps to ground etc.&lt;/p&gt;
&lt;p&gt;A Rigol 1054Z is on the way so I can see how that behaves in comparison :)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI initialization according to spec</title><link>https://devzone.nordicsemi.com/thread/26520?ContentTypeID=1</link><pubDate>Wed, 10 Jun 2015 10:20:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:23fef60d-64ef-43ea-916a-5973185336c2</guid><dc:creator>MartinBL</dc:creator><description>&lt;p&gt;Happy to help.
Is it the ADXL362 itself or a combination of the sensor and the PCB that makes it is sensitive? Just curious. I use a Saleae logic analyzer myself and has never had a problem with it.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI initialization according to spec</title><link>https://devzone.nordicsemi.com/thread/26519?ContentTypeID=1</link><pubDate>Wed, 10 Jun 2015 09:28:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ccd1147a-c4b3-4093-9470-f3c2138651c2</guid><dc:creator>Emil</dc:creator><description>&lt;p&gt;Thanks for all your help! I actually had to use all the standard settings, and use MSB configuration. In practice the buffers have to be the same size or rx &amp;gt; tx if I want to get anything from the dummy bytes I suppose. I am glad I finally sorted out SPI with your API.&lt;/p&gt;
&lt;p&gt;The ADXL362 is VERY sensitive to noise so I have to do some analog design to give it a nicer and more noise free transmission line.&lt;/p&gt;
&lt;p&gt;So a reminder: CPOL = 0 = SPI_CONFIG_CPOL_ActiveHigh&lt;/p&gt;
&lt;p&gt;CPHA = 0 = SPI_CONFIG_CPHA_Leading&lt;/p&gt;
&lt;p&gt;This = MODE 0&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI initialization according to spec</title><link>https://devzone.nordicsemi.com/thread/26518?ContentTypeID=1</link><pubDate>Wed, 10 Jun 2015 09:19:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:59d0cffc-a3b1-4352-b345-07f539202ac9</guid><dc:creator>MartinBL</dc:creator><description>&lt;p&gt;Glad it finally works :)
No, they don&amp;#39;t need to be the same size. If the SPI executes a transfer with a rx_buffer larger than the tx_buffer it will shift out dummy bytes until the rx_buffer is full. If the tx_buffer is larger than the rx_buffer the redundant received bytes will be discarded. E.g. if your tx_buffer is 10 bytes and the rx_buffer is 3 then the first three incoming bytes will be put in the rx_buffer and the last 7 will be discarded.&lt;/p&gt;
&lt;p&gt;Regarding one large vs two small buffers I don&amp;#39;t know really. Personally I think it would be easier to read and use the code with two arrays. But it is really up to you.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI initialization according to spec</title><link>https://devzone.nordicsemi.com/thread/26517?ContentTypeID=1</link><pubDate>Wed, 10 Jun 2015 08:56:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:983866ca-0717-4c08-933d-d1fe04d8d84f</guid><dc:creator>Emil</dc:creator><description>&lt;p&gt;RESPONSE TO RESPONSE TO EDIT 2 :)&lt;/p&gt;
&lt;p&gt;I made it work with this dummy byte! I had to remove the Saleae Logic from the circuit since it introduced noise and it didn&amp;#39;t work reliably.&lt;/p&gt;
&lt;p&gt;So let me  get this straight. The RX and TX buffers passed in must be in the same size. Is it sensible to have one big buffer of 10 bytes as opposed to 2 buffers with 5 bytes each?&lt;/p&gt;
&lt;p&gt;The command is 2 bytes + dummy byte = 3 bytes.&lt;/p&gt;
&lt;p&gt;The response can either be a byte or an uint = 1-2 = 2 at most.
= 4 bytes total.&lt;/p&gt;
&lt;p&gt;So then I have a buffer with 8 bytes, where the offset 4 is passed to the RX. I then read 4+2 = 6th index to get the response which is 1 or 2 bytes.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;static uint8_t _buf[8];
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;...&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;_buf[0] = ADXL34X_CMD_READ;
_buf[1] = reg;
_buf[2] = SPI_DEFAULT_TX_BYTE;

if (reg &amp;amp; REG_2B) {
	rxcnt = 2;
	_buf[3] = SPI_DEFAULT_TX_BYTE;
}
else {
	rxcnt = 1;
}
uint32_t status = spi_master_send_recv(SPI_MASTER_HW, &amp;amp;_buf[0], 2 + rxcnt, &amp;amp;_buf[4], 2 + rxcnt);
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;...&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;return _buf[6]; // add conversion for 16 bit values
&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI initialization according to spec</title><link>https://devzone.nordicsemi.com/thread/26505?ContentTypeID=1</link><pubDate>Wed, 10 Jun 2015 07:25:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:07c59e7a-8232-4cf5-a944-99a464d66b4e</guid><dc:creator>MartinBL</dc:creator><description>&lt;p&gt;Had to edit my answer due to character limitations in the comment section.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI initialization according to spec</title><link>https://devzone.nordicsemi.com/thread/26524?ContentTypeID=1</link><pubDate>Wed, 10 Jun 2015 06:43:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5c0beb1e-53fd-4dd7-94f9-dd12557de9de</guid><dc:creator>Emil</dc:creator><description>&lt;p&gt;It was LSB / MSB confusion in analyzer vs code&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI initialization according to spec</title><link>https://devzone.nordicsemi.com/thread/26523?ContentTypeID=1</link><pubDate>Wed, 10 Jun 2015 03:55:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9383674c-7aac-4557-9258-696764852f7c</guid><dc:creator>Milad</dc:creator><description>&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/2388.Capture.PNG" alt="image description" /&gt;&lt;/p&gt;
&lt;p&gt;Here is a problem I noticed about your SPI communication. Your clock and MOSI has to happen in correlation. But from the picture you post I see your clock leads the MOSI by at least 4 bits meaning it is not understood by the ADXL62 at all&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI initialization according to spec</title><link>https://devzone.nordicsemi.com/thread/26504?ContentTypeID=1</link><pubDate>Tue, 09 Jun 2015 14:03:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2ccc7819-c0b9-4f38-8862-b309e892ada4</guid><dc:creator>Emil</dc:creator><description>&lt;p&gt;Right, I assumed that the softdevice / SPI master library did this for you as you need a clock to even receive anything. I specify 1 byte rx count, and then I would assume that the SPI library understands that it has to send 8 additional clock pulses to read the response. Is this not the case? I double and triple checked that I pass rxcount = 1.&lt;/p&gt;
&lt;p&gt;uint32_t spi_master_send_recv(const spi_master_hw_instance_t spi_master_hw_instance,
uint8_t * const p_tx_buf, const uint16_t tx_buf_len,
uint8_t * const p_rx_buf, &lt;strong&gt;const uint16_t rx_buf_len&lt;/strong&gt;)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI initialization according to spec</title><link>https://devzone.nordicsemi.com/thread/26503?ContentTypeID=1</link><pubDate>Tue, 09 Jun 2015 14:01:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a49e2d80-eb03-4bd0-ba00-048215b7fc78</guid><dc:creator>MartinBL</dc:creator><description>&lt;p&gt;Looking at the Register Read timing diagram in the ADXL362 datasheet, Figure 36, pp 20, it actually seems like you are supposed to send an instruction byte, an address byte and &lt;em&gt;then&lt;/em&gt; you can expect to get data back. While transferring the two first bytes the MISO line will be in an undefined state (that is how I read the timing diagram anyway). Looking at your image again it looks like you are only sending two bytes and then no more clocks. You should try to send a third &amp;quot;dummy byte&amp;quot;, with just ones or zeroes.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI initialization according to spec</title><link>https://devzone.nordicsemi.com/thread/26502?ContentTypeID=1</link><pubDate>Tue, 09 Jun 2015 12:48:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fd2a4269-e824-42ba-9b98-df4a633358e6</guid><dc:creator>Emil</dc:creator><description>&lt;p&gt;Good :)&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Yes&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Yes - it matches &lt;a href="http://www.analog.com/media/en/technical-documentation/data-sheets/ADXL362.pdf"&gt;www.analog.com/.../ADXL362.pdf&lt;/a&gt; page 20&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;No&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;I am as sure as can be. Made sure I have power connection all the way. This is my 2nd eval sensor&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;which I &lt;em&gt;carefully&lt;/em&gt; soldered, and made sure there were no shorts, and I didn&amp;#39;t reverse polarity.&lt;/p&gt;
&lt;p&gt;I am pretty desperate right now as I have used a good week on this.&lt;/p&gt;
&lt;p&gt;But the question: Shouldn&amp;#39;t clock be sent when it waits for that byte with an answer? I would expect 8 more clocks. No clocks, no response right?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI initialization according to spec</title><link>https://devzone.nordicsemi.com/thread/26501?ContentTypeID=1</link><pubDate>Tue, 09 Jun 2015 12:42:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:37bd5384-ede8-434d-a87e-2e123c1d8052</guid><dc:creator>MartinBL</dc:creator><description>&lt;p&gt;Seems like imgur was blocked on our network, but I found a way ;). It looks like your sensor is either dead/unresponsive or that there is still something wrong with your pin mapping.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Are your read/write command bytes defined correctly?&lt;/li&gt;
&lt;li&gt;Did you experiment with least/most significant byte order, polarity and phase settings?&lt;/li&gt;
&lt;li&gt;Are you able to test the SPI by e.g. using the &lt;a href="https://developer.nordicsemi.com/nRF51_SDK/nRF51_SDK_v8.x.x/doc/8.1.0/s110/html/a00051.html"&gt;master loopback example&lt;/a&gt;?&lt;/li&gt;
&lt;li&gt;Are you sure that the sensor is powered up and running?&lt;/li&gt;
&lt;/ul&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI initialization according to spec</title><link>https://devzone.nordicsemi.com/thread/26500?ContentTypeID=1</link><pubDate>Tue, 09 Jun 2015 12:19:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7b404969-5a5a-469f-8bec-892ad1696e19</guid><dc:creator>Emil</dc:creator><description>&lt;p&gt;&lt;a href="http://i.imgur.com/1eLzbgU.png"&gt;http://i.imgur.com/1eLzbgU.png&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI initialization according to spec</title><link>https://devzone.nordicsemi.com/thread/26499?ContentTypeID=1</link><pubDate>Tue, 09 Jun 2015 12:17:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:19d04cd5-aaa9-45dd-a7a3-0233aa2becd2</guid><dc:creator>MartinBL</dc:creator><description>&lt;p&gt;Something went wrong when you uploaded the image and I am not able to see it.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI initialization according to spec</title><link>https://devzone.nordicsemi.com/thread/26516?ContentTypeID=1</link><pubDate>Fri, 05 Jun 2015 13:32:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:00677f39-cc14-44c9-a86e-7eb593da56f3</guid><dc:creator>MartinBL</dc:creator><description>&lt;p&gt;It can certainly be the problem, but that is impossible for me to say for sure. You will just need to experiment and see if it shows any signs of life at all.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI initialization according to spec</title><link>https://devzone.nordicsemi.com/thread/26515?ContentTypeID=1</link><pubDate>Fri, 05 Jun 2015 13:25:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4330755d-50f4-455a-aebd-12bd0d3c73ab</guid><dc:creator>Emil</dc:creator><description>&lt;p&gt;Thanks a lot. I get NRF_ERROR_BUSY (17) from spi_master_send_recv, I made sure the connections are correct. When disconnecting everything I get no errors. Today I had some bad luck with the accelerometer (reversed the polarity, VS and GND are right next to eachother!) So that might be a problem. Could a toasted device cause the busy error or can it be something else?
Thanks, and have a nice weekend :)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI initialization according to spec</title><link>https://devzone.nordicsemi.com/thread/26514?ContentTypeID=1</link><pubDate>Fri, 05 Jun 2015 12:57:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7f830c36-a963-49ec-a919-6a570df5635a</guid><dc:creator>MartinBL</dc:creator><description>&lt;p&gt;No worries. Hope it works out for you.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI initialization according to spec</title><link>https://devzone.nordicsemi.com/thread/26513?ContentTypeID=1</link><pubDate>Fri, 05 Jun 2015 12:35:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8ecb84e0-9e13-4cbe-822f-24ce598dac7a</guid><dc:creator>Emil</dc:creator><description>&lt;p&gt;Thank you so much! This is exactly the document I was looking for (Page 11)!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI initialization according to spec</title><link>https://devzone.nordicsemi.com/thread/26512?ContentTypeID=1</link><pubDate>Fri, 05 Jun 2015 12:28:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3010ffb8-c8ee-4d9f-b847-f412d3818a69</guid><dc:creator>MartinBL</dc:creator><description>&lt;p&gt;If you have defined SPI_MASTER_0_ENABLE in your makefile, as you say in your first post, you will need to use the upper block, SPIM0_SCK_PIN, etc. But, of course you will need to connect your sensor to the matching pin numbers &lt;em&gt;OR&lt;/em&gt; change the defines in your code.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;: Yes AIN2 is mapped to pin 1, you can e.g. see this in the Pin Assignment chapter in the Product Specification document.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI initialization according to spec</title><link>https://devzone.nordicsemi.com/thread/26511?ContentTypeID=1</link><pubDate>Fri, 05 Jun 2015 12:12:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b78b8457-dc30-49b3-80ba-5b658866e865</guid><dc:creator>Emil</dc:creator><description>&lt;p&gt;You are right. This is my pca10028.h (nRF51_SDK\examples\bsp\pca10028.h). release_notes.txt says &amp;quot;nRF51 SDK v8.1.0&amp;quot;.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;#define SPIM0_SCK_PIN       4     /**&amp;lt; SPI clock GPIO pin number. */
#define SPIM0_MOSI_PIN      1     /**&amp;lt; SPI Master Out Slave In GPIO pin number. */
#define SPIM0_MISO_PIN      3     /**&amp;lt; SPI Master In Slave Out GPIO pin number. */
#define SPIM0_SS_PIN        2     /**&amp;lt; SPI Slave Select GPIO pin number. */
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;...&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;#define SER_APP_SPIM0_SCK_PIN       29     // SPI clock GPIO pin number.
#define SER_APP_SPIM0_MOSI_PIN      25     // SPI Master Out Slave In GPIO pin number
#define SER_APP_SPIM0_MISO_PIN      28     // SPI Master In Slave Out GPIO pin number
#define SER_APP_SPIM0_SS_PIN        12     // SPI Slave Select GPIO pin number
#define SER_APP_SPIM0_RDY_PIN       14     // SPI READY GPIO pin number
#define SER_APP_SPIM0_REQ_PIN       13     // SPI REQUEST GPIO pin number
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The SPIM0_SCK_PIN etc was pulled from the master slave example. (nRF51_SDK\examples\peripheral\spi_master_with_spi_slave\main.c(92)) Which one should I actually use? :)&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt;
And NRF_ADC_CONFIG_INPUT_2 or ADC_CONFIG_PSEL_AnalogInput2 is actually P0.01 on the NRF51-DK board... But how I found out I can&amp;#39;t even remember. :) I am already using ADC_CONFIG_PSEL_AnalogInput2 so if I use SPIM0_MOSI_PIN  it will conflict? Aren&amp;#39;t P0.01-P0.06 ADC inputs?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI initialization according to spec</title><link>https://devzone.nordicsemi.com/thread/26510?ContentTypeID=1</link><pubDate>Fri, 05 Jun 2015 12:07:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c8474b5b-0835-4cc4-a135-a8d7c4832d0a</guid><dc:creator>MartinBL</dc:creator><description>&lt;p&gt;Alright, I found &lt;a href="https://developer.mbed.org/users/mbed_official/code/mbed/file/cbbeb26dbd92/TARGET_NRF51_DK/TARGET_NORDIC/TARGET_MCU_NRF51822/TARGET_NRF51_DK/PinNames.h"&gt;this file&lt;/a&gt;. Which defines:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;SPI_PSELMOSI0 = p25,
SPI_PSELMISO0 = p28,
SPI_PSELSS0   = p24,
SPI_PSELSCK0  = p29,
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;But I am still confused since in the code block in your initial post you use the define names SPIM0_SCK_PIN, SPIM0_MISO_PIN, SPIM0_MOSI_PIN and SPIM0_SS_PIN. These names resembles the defines in the pca10028.h file and not the defines in the file in my link.&lt;/p&gt;
&lt;p&gt;I don&amp;#39;t know whether least significant bit first is standard or not and I couldn&amp;#39;t find the info in the datasheet so you will have to trial and error on this one.&lt;/p&gt;
&lt;p&gt;I guess CSN stands for &lt;strong&gt;C&lt;/strong&gt;hip &lt;strong&gt;S&lt;/strong&gt;elect &lt;strong&gt;N&lt;/strong&gt;egative, meaning that the signal is active low.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI initialization according to spec</title><link>https://devzone.nordicsemi.com/thread/26509?ContentTypeID=1</link><pubDate>Fri, 05 Jun 2015 11:49:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:42b12ad6-ccd1-4b47-9b90-bc32cf637eda</guid><dc:creator>Emil</dc:creator><description>&lt;p&gt;&lt;strong&gt;RESPONSE TO EDIT&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Thanks, I have actually looked in the file before, but trusted the MBED one.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;#define SER_CON_SPIS_SCK_PIN        29    // SPI SCK signal.
#define SER_CON_SPIS_MOSI_PIN       25    // SPI MOSI signal.
#define SER_CON_SPIS_MISO_PIN       28    // SPI MISO signal.
#define SER_CON_SPIS_CSN_PIN        12    // SPI CSN signal. &amp;lt;--- CS / SS / SEL???
#define SER_CON_SPIS_RDY_PIN        14    // SPI READY GPIO pin number.
#define SER_CON_SPIS_REQ_PIN        13    // SPI REQUEST GPIO pin number.
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;So CS is Pin 12 then.&lt;/p&gt;
&lt;p&gt;I am doing a soft reset of the chip and wait 100 ms and you should be able to get manufacturer ID etc from it before doing anything.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;#define ADXL_REG_DEVID_AD	0x00
#define ADXL_REG_PARTID		0x02

// ...

Adxl362_Write(ADXL_REG_SOFT_RESET, &amp;#39;R&amp;#39;);

// A latency of approximately 0.5 ms is required after soft reset.
nrf_delay_ms(100);

manId = Adxl362_Read(ADXL_REG_DEVID_AD);
partId = Adxl362_Read(ADXL_REG_PARTID);
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Read function:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;static int Adxl362_Read(unsigned reg)
{
	unsigned char buf[4];
	unsigned rxcnt;
	uint32_t status;

	buf[0] = ADXL34X_CMD_READ;
	buf[1] = reg;

	if (reg &amp;amp; REG_2B) {
		rxcnt = 2;
	}
	else {
		rxcnt = 1;
		buf[3] = 0;
	}

	status = spi_master_send_recv(SPI_MASTER_HW, &amp;amp;buf[0], 2, &amp;amp;buf[2], rxcnt);

	return (status &amp;lt; 0) ? status : (uint16_t)buf[2];
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Yes everything is connected correctly now I hope since pin 24 is moved to pin 12! I will do some more testing. Thanks a lot.&lt;/p&gt;
&lt;p&gt;My current config is:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;spi_config.SPI_CONFIG_ORDER = SPI_CONFIG_ORDER_LsbFirst; // : SPI_CONFIG_ORDER_MsbFirst);
spi_config.SPI_CONFIG_CPOL = SPI_CONFIG_CPOL_ActiveLow;
spi_config.SPI_CONFIG_CPHA = SPI_CONFIG_CPHA_Leading;
spi_config.SPI_Freq = SPI_FREQUENCY_FREQUENCY_M1;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;It is LsbFirst that is the standard right?&lt;/p&gt;
&lt;p&gt;Thanks again!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI initialization according to spec</title><link>https://devzone.nordicsemi.com/thread/26508?ContentTypeID=1</link><pubDate>Fri, 05 Jun 2015 11:35:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:61879dde-9f9a-440d-a11e-831b12b6fc83</guid><dc:creator>MartinBL</dc:creator><description>&lt;p&gt;Edited my answer above.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI initialization according to spec</title><link>https://devzone.nordicsemi.com/thread/26507?ContentTypeID=1</link><pubDate>Fri, 05 Jun 2015 10:35:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:38e0a178-dd20-406e-adaa-e8e4d5813691</guid><dc:creator>Emil</dc:creator><description>&lt;p&gt;Thank you for your response and sorry for the confusion ! When I say &amp;quot;pin&amp;quot; I mean the pin number on the NRF51-DK pinout on the actual board. Like P0.24, not in the .h file :)&lt;/p&gt;
&lt;p&gt;The pinout image is here:
&lt;a href="https://developer.mbed.org/platforms/Nordic-nRF51-DK"&gt;developer.mbed.org/.../Nordic-nRF51-DK&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;quot;SEL&amp;quot; is LED 4 and P0.24. This is what I connected to &amp;quot;CS&amp;quot; on the ADXL632Z eval kit. I assume this is pin_slave_select.
This is a correct mapping for SDK 8 right? I am using SDK 8.&lt;/p&gt;
&lt;p&gt;I tried SPI_CONFIG_CPOL_ActiveLow before, but there wasn&amp;#39;t any difference. Good to hear that the rest is OK.&lt;/p&gt;
&lt;p&gt;Also, 0xFF is returned when I disconnect everything. So it behaves just like it wasn&amp;#39;t connected at all. I have ordered another eval kit from them and will see if I get the same results.&lt;/p&gt;
&lt;p&gt;A suggestion for the SDK to clear up the CPOL stuff in the comments in the SDK :)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>