<?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 example: MOD BLOCK Register Adress</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/55612/spi-example-mod-block-register-adress</link><description>Hey guys, 
 I&amp;#39;m working with a Laird BL652-DVK (nrF 52832 - Chip) and Nordic SDK v.14.2.0. Now I try the SPI example and I don&amp;#39;t know which register is adressed in the last line? I can&amp;#39;t find it in LIS3DH-Datasheet (accelerometer). 
 &amp;quot; 
 //MOD BLOCK FOR</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Sun, 05 Jan 2020 16:12:39 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/55612/spi-example-mod-block-register-adress" /><item><title>RE: SPI example: MOD BLOCK Register Adress</title><link>https://devzone.nordicsemi.com/thread/227543?ContentTypeID=1</link><pubDate>Sun, 05 Jan 2020 16:12:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:73c7c233-035e-48f5-b6ee-7d2037d9cb32</guid><dc:creator>Christoph_I</dc:creator><description>&lt;p&gt;Hi Vidar, &lt;/p&gt;
&lt;p&gt;I hadn&amp;#39;t read your text. Thanks, I hope you had a nice Christmas! I wish you a happy new Year.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Christoph&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI example: MOD BLOCK Register Adress</title><link>https://devzone.nordicsemi.com/thread/226336?ContentTypeID=1</link><pubDate>Thu, 19 Dec 2019 10:42:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fd04324a-8162-48b2-8241-95fdcf7567f4</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hi&amp;nbsp;&lt;span&gt;Christoph,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;No worries. That explains everything, thanks for the update. And Merry Christmas to you.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Vidar&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI example: MOD BLOCK Register Adress</title><link>https://devzone.nordicsemi.com/thread/226326?ContentTypeID=1</link><pubDate>Thu, 19 Dec 2019 10:21:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a4140339-dfef-49d8-8089-d3268490a7e7</guid><dc:creator>Christoph_I</dc:creator><description>&lt;p&gt;Hi Vidar,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;apologize, you are right. I got the project from a colleaguq without a note or explanation. So I assumed that the SPI example was not modified. But after you wrote that you can not find my code, I started to ponder and I downloaded the SDK v.14.2.0 again and looked it up in main.c. The result: my SPI example was modfied by my colleague. I&amp;#39;m sorry and thank you for your help.&lt;/p&gt;
&lt;p&gt;I wish you a nice thursday and Merry Christmas.&lt;/p&gt;
&lt;p&gt;Christoph&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI example: MOD BLOCK Register Adress</title><link>https://devzone.nordicsemi.com/thread/225877?ContentTypeID=1</link><pubDate>Tue, 17 Dec 2019 12:53:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:65c9d5e2-9168-4eb3-9e3e-356db9c1c31d</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hi&amp;nbsp;&lt;span&gt;Christoph,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I&amp;#39;m confused, the code you posted is not&amp;nbsp;from the original SDK example. Did you&amp;nbsp;define the&amp;nbsp;m_config_buf[] arrays yourself or is it from a third party?&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI example: MOD BLOCK Register Adress</title><link>https://devzone.nordicsemi.com/thread/225850?ContentTypeID=1</link><pubDate>Tue, 17 Dec 2019 11:04:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c843177e-ed32-4379-9761-0be0d5cf14a8</guid><dc:creator>Christoph_I</dc:creator><description>&lt;p&gt;Hey Vidar,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Yes it&amp;#39;s from the SPI example (.../examples/peripheral/spi). The whole code is below.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;/*Copyright (c) 2015 - 2017, Nordic Semiconductor ASA
 * 
 * All rights reserved.
 * 
 * Redistribution and use in source and binary forms, with or without modification,
 * are permitted provided that the following conditions are met:
 * 
 * 1. Redistributions of source code must retain the above copyright notice, this
 *    list of conditions and the following disclaimer.
 * 
 * 2. Redistributions in binary form, except as embedded into a Nordic
 *    Semiconductor ASA integrated circuit in a product or a software update for
 *    such product, must reproduce the above copyright notice, this list of
 *    conditions and the following disclaimer in the documentation and/or other
 *    materials provided with the distribution.
 * 
 * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
 *    contributors may be used to endorse or promote products derived from this
 *    software without specific prior written permission.
 * 
 * 4. This software, with or without modification, must only be used with a
 *    Nordic Semiconductor ASA integrated circuit.
 * 
 * 5. Any software provided in binary form under this license must not be reverse
 *    engineered, decompiled, modified and/or disassembled.
 * 
 * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA &amp;quot;AS IS&amp;quot; AND ANY EXPRESS
 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 * 
 */
#include &amp;lt;nrf_drv_spi.h&amp;gt;
#include &amp;quot;app_util_platform.h&amp;quot;
#include &amp;quot;nrf_gpio.h&amp;quot;
#include &amp;quot;nrf_delay.h&amp;quot;
#include &amp;quot;boards.h&amp;quot;
#include &amp;quot;app_error.h&amp;quot;
#include &amp;lt;string.h&amp;gt;
#include &amp;quot;nrf_log.h&amp;quot;
#include &amp;quot;nrf_log_ctrl.h&amp;quot;
#include &amp;quot;nrf_log_default_backends.h&amp;quot;
#include &amp;lt;stdint.h&amp;gt;
#include &amp;lt;stdbool.h&amp;gt;

#define SPI_INSTANCE  0 /**&amp;lt; SPI instance index. */
static const nrf_drv_spi_t spi = NRF_DRV_SPI_INSTANCE(SPI_INSTANCE);  /**&amp;lt; SPI instance. */
static volatile bool spi_xfer_done = false;  /**&amp;lt; Flag used to indicate that SPI instance completed the transfer. */

//MOD BLOCK FOR NEW REG

static uint8_t       m_config_buf1[] = {0x20,0x97};
static uint8_t       m_config_buf2[] = {0x23,0x88};
static uint8_t       m_config_buf3[] = {0x22,0x10};
static uint8_t       m_config_buf4[] = {0x1F,0x80};
static uint8_t       m_config_buf5[] = {0x23,0x88};
static uint8_t       m_config_buf6[] = {0xA3,0x00};

uint8_t read_data[7];

static uint8_t		 m_get_buf1[] = {0xE8,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA};



void config_accel(){

    nrf_drv_spi_transfer(&amp;amp;spi, m_config_buf1, sizeof(m_config_buf1), NULL, 0);
    nrf_delay_us(160);
    nrf_drv_spi_transfer(&amp;amp;spi, m_config_buf2, sizeof(m_config_buf2), NULL, 0);
    nrf_delay_us(160);
    nrf_drv_spi_transfer(&amp;amp;spi, m_config_buf3, sizeof(m_config_buf3), NULL, 0);
    nrf_delay_us(160);
	nrf_drv_spi_transfer(&amp;amp;spi, m_config_buf4, sizeof(m_config_buf4), NULL, 0);
    nrf_delay_us(160);
    nrf_drv_spi_transfer(&amp;amp;spi, m_config_buf5, sizeof(m_config_buf5), NULL, 0);
    nrf_delay_us(160);
    nrf_drv_spi_transfer(&amp;amp;spi, m_config_buf6, sizeof(m_config_buf6), NULL, 0);
    nrf_delay_ms(1000);

}

void get_accel(){
	while (1){
				nrf_drv_spi_transfer(&amp;amp;spi, m_get_buf1, sizeof(m_get_buf1), read_data, sizeof(read_data));
	    		nrf_delay_ms(20);
	        }
}

void spi_event_handler(nrf_drv_spi_evt_t const * p_event,
                       void *                    p_context)
{
    spi_xfer_done = true;
}

int main(void)
{

    nrf_drv_spi_config_t spi_config = NRF_DRV_SPI_DEFAULT_CONFIG;
    spi_config.ss_pin   = 22;
    spi_config.miso_pin = 24;
    spi_config.mosi_pin = 23;
    spi_config.sck_pin  = 25;
	spi_config.frequency = NRF_DRV_SPI_FREQ_2M;
    spi_config.mode     = NRF_DRV_SPI_MODE_3;
    nrf_drv_spi_init(&amp;amp;spi, &amp;amp;spi_config, spi_event_handler, NULL);

	config_accel();

	get_accel();
}
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I just see that there is nothing in the description of an acceleration sensor or that an acceleration sensor should be adressed. Do you know which sensor is adressesd / should be adressed with the SPI example? (I want to address an accelerometer.)&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;And you are right, some adresses are missing. I think that these addresses will not be changed and should remain set to default.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Christoph&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI example: MOD BLOCK Register Adress</title><link>https://devzone.nordicsemi.com/thread/225734?ContentTypeID=1</link><pubDate>Mon, 16 Dec 2019 16:42:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:87b98cee-cc1a-4bee-95d9-cfad6461e5c6</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hi&amp;nbsp;&lt;span&gt;Christoph,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Is this code from a Nordic SDK? I searched through SDK 14.2.0 but couldn&amp;#39;t find it. Also, it looks like only a few of the registers above actually match the datasheet. E.g., the address to CTRL_REG2 is 0x21 in the datasheet, but 0x23 in the code.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Best regards,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Vidar&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>