<?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>LIS2DH12 driver issue in nRF SDK v15.0</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/34710/lis2dh12-driver-issue-in-nrf-sdk-v15-0</link><description>Hi, 
 
 There are several new drivers under &amp;quot;nRF5_SDK_15.0.0_a53641a\components\drivers_ext\&amp;quot;, but no example now. 
 I have setup the HTS221 driver and it works. I turn to LIS2DH12 driver, but it not work. 
 For send and receive more i2c data then HTS221</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 27 May 2020 18:25:47 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/34710/lis2dh12-driver-issue-in-nrf-sdk-v15-0" /><item><title>RE: LIS2DH12 driver issue in nRF SDK v15.0</title><link>https://devzone.nordicsemi.com/thread/252043?ContentTypeID=1</link><pubDate>Wed, 27 May 2020 18:25:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:924c7ce8-c7b3-4bb9-8a46-a40b7eecb4e0</guid><dc:creator>Nats</dc:creator><description>&lt;p&gt;Hey, i tried the same program, and i can&amp;#39;t enter the print_identity function. The loop executes continuously, but except the twi started message , nothing else is printed&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: LIS2DH12 driver issue in nRF SDK v15.0</title><link>https://devzone.nordicsemi.com/thread/200395?ContentTypeID=1</link><pubDate>Thu, 25 Jul 2019 06:10:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2c4f01dd-9994-45c8-8cee-b9cfee921cca</guid><dc:creator>lhochstetter</dc:creator><description>&lt;p&gt;Hi lydie,&lt;br /&gt;&lt;br /&gt;checkout the LIS2DH12 datasheet p.31: &lt;a href="https://www.st.com/resource/en/datasheet/lis2dh12.pdf"&gt;https://www.st.com/resource/en/datasheet/lis2dh12.pdf&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The expected result is 51 (hex 33, bin 00110011).&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;EDIT 2019/07/27&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&amp;quot;According to&amp;quot; Mouser &lt;a href="https://eu.mouser.com/ProductDetail/STMicroelectronics/LIS2DH12?qs=yXzv9R%2FF42Ia01kPyHCTbw=="&gt;https://eu.mouser.com/ProductDetail/STMicroelectronics/LIS2DH12?qs=yXzv9R%2FF42Ia01kPyHCTbw==&lt;/a&gt;&amp;nbsp; the LIS2DH12 and a couple other sensors are EOL (&lt;a href="https://www.mouser.com/PCN/STMicroelectronics_9055.pdf"&gt;https://www.mouser.com/PCN/STMicroelectronics_9055.pdf&lt;/a&gt;). Depending on your needs you might need to find a suitable replacement.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Looks like I spoke too soon: according to ST &lt;a href="https://www.st.com/en/mems-and-sensors/lis2dh12.html"&gt;https://www.st.com/en/mems-and-sensors/lis2dh12.html&lt;/a&gt; the LIS2DH12 is still active ...&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;/EDIT&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Regards&lt;br /&gt;&lt;br /&gt;lhochstetter&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: LIS2DH12 driver issue in nRF SDK v15.0</title><link>https://devzone.nordicsemi.com/thread/200379?ContentTypeID=1</link><pubDate>Thu, 25 Jul 2019 01:37:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:87fe02fa-78d3-4611-8739-dfd3a509e36e</guid><dc:creator>lydie</dc:creator><description>&lt;p&gt;It&amp;#39;s ok, it works. But what is the expected result of who_am_i read and the function print_identity with this line:&lt;/p&gt;
&lt;p&gt;NRF_LOG_INFO(&amp;quot;Identity: %d&amp;quot;, *((uint8_t *)p_register_data));&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: LIS2DH12 driver issue in nRF SDK v15.0</title><link>https://devzone.nordicsemi.com/thread/200238?ContentTypeID=1</link><pubDate>Wed, 24 Jul 2019 09:29:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:baaa5396-e522-45d2-bc87-e92c5cc855b0</guid><dc:creator>awneil</dc:creator><description>[quote userid="81455" url="~/f/nordic-q-a/34710/lis2dh12-driver-issue-in-nrf-sdk-v15-0/200236"]how do you know the sensor instance name (m_lis2dh12)? [/quote]
&lt;p&gt;because &lt;em&gt;&lt;strong&gt;you&lt;/strong&gt;&lt;/em&gt; define it:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;LIS2DH12_INSTANCE_DEF( m_lis2dh12, &amp;amp;m_nrf_twi_sensor, LIS2DH12_BASE_ADDRESS_HIGH );&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
[quote userid="81455" url="~/f/nordic-q-a/34710/lis2dh12-driver-issue-in-nrf-sdk-v15-0/200236"]I have an error[/quote][quote userid="81455" url="~/f/nordic-q-a/34710/lis2dh12-driver-issue-in-nrf-sdk-v15-0/200236"]macro names must be identifiers[/quote]
&lt;p&gt;Where, exactly, do you get that?&lt;/p&gt;
&lt;p&gt;Post the full message: copy it, and paste as for source code, but leave the &amp;#39;Language&amp;#39; as &amp;#39;Text&amp;#39; - ie, just steps 1 &amp;amp; 2:&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/_5F00_Insert-Code-_2D00_-Nordic-2.png" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: LIS2DH12 driver issue in nRF SDK v15.0</title><link>https://devzone.nordicsemi.com/thread/200236?ContentTypeID=1</link><pubDate>Wed, 24 Jul 2019 09:25:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1afa474d-b8c2-48b5-a886-51584a871e3d</guid><dc:creator>lydie</dc:creator><description>&lt;p&gt;Hi,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;how do you know the sensor instance name (m_lis2dh12)? I try the same code and I have an error:&lt;/p&gt;
&lt;p&gt;macro names must be identifiers&lt;/p&gt;
&lt;p&gt;in lis2dh12.h&lt;/p&gt;
&lt;p&gt;Thanks!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: LIS2DH12 driver issue in nRF SDK v15.0</title><link>https://devzone.nordicsemi.com/thread/137207?ContentTypeID=1</link><pubDate>Fri, 22 Jun 2018 07:58:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:34bb802c-9ffe-4946-bd2f-f84cca955a90</guid><dc:creator>lhochstetter</dc:creator><description>&lt;p&gt;Hi everyone,&lt;br /&gt;&lt;br /&gt;sorry for the delayed reply. I managed to get it working thanks to &lt;a href="https://devzone.nordicsemi.com/members/spegs21"&gt;Spegs21&lt;/a&gt; - I was oblivious to the fact that you have to init m_nrf_twi_mngr and m_nrf_twi_sensor to configure the pins ...&lt;br /&gt;&lt;br /&gt;&lt;a href="https://devzone.nordicsemi.com/members/edvin-holmseth"&gt;Edvin&lt;/a&gt; the UART debug output went as follows&lt;br /&gt;&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;&amp;lt;info&amp;gt; app: TWI sensor example started.
&amp;lt;info&amp;gt; app: Here.
&amp;lt;error&amp;gt; app: Fatal error
&amp;lt;warning&amp;gt; app: System reset&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;My suspicion is that due to the uninitialized m_nrf_twi_mngr / m_nrf_twi_sensor the driver didn&amp;#39;t knew which pins belonged to the sensor / was getting an &amp;quot;uninitialized something&amp;quot; error at some point.&lt;br /&gt;&lt;br /&gt;It works fine now with the code provided below. Take note that I&amp;#39;m using the nRF52 DevKit and have hooked up the sensors SCL to P0.27 and SDA to P.026.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;/**
 * Copyright (c) 2015 - 2018, 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.
 * 
 */
/** @file
 * @defgroup tw_sensor_example main.c
 * @{
 * @ingroup nrf_twi_example
 * @brief TWI Sensor Example main file.
 *
 * This file contains the source code for a sample application using TWI.
 *
 */

#include &amp;lt;stdio.h&amp;gt;
#include &amp;quot;boards.h&amp;quot;
#include &amp;quot;app_util_platform.h&amp;quot;
#include &amp;quot;app_error.h&amp;quot;
#include &amp;quot;nrf_drv_twi.h&amp;quot;
#include &amp;quot;nrf_delay.h&amp;quot;


#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;quot;lis2dh12.h&amp;quot;

#include &amp;quot;nrf_twi_mngr.h&amp;quot;

/* TWI instance ID. */
#define TWI_INSTANCE_ID             0

#define MAX_PENDING_TRANSACTIONS    33

#define LIS2DH12_MIN_QUEUE_SIZE     32

NRF_TWI_MNGR_DEF(m_nrf_twi_mngr, MAX_PENDING_TRANSACTIONS, TWI_INSTANCE_ID);

NRF_TWI_SENSOR_DEF(m_nrf_twi_sensor, &amp;amp;m_nrf_twi_mngr, LIS2DH12_MIN_QUEUE_SIZE);

LIS2DH12_INSTANCE_DEF(m_lis2dh12, &amp;amp;m_nrf_twi_sensor, LIS2DH12_BASE_ADDRESS_HIGH);

static uint8_t m_sample = 0;

void print_identity(ret_code_t r, void *p_register_data)
{
    NRF_LOG_INFO(&amp;quot;Identity: %d&amp;quot;, *((uint8_t *)p_register_data));
}

/**
 * @brief Function for main application entry.
 */
int main(void)
{
    uint32_t err;

    nrf_drv_twi_config_t const config = {
       .scl                = 27,
       .sda                = 26,
       .frequency          = NRF_DRV_TWI_FREQ_100K,
       .interrupt_priority = APP_IRQ_PRIORITY_LOWEST,
       .clear_bus_init     = false
    };


    APP_ERROR_CHECK(NRF_LOG_INIT(NULL));
    NRF_LOG_DEFAULT_BACKENDS_INIT();

    NRF_LOG_INFO(&amp;quot;TWI sensor example started.&amp;quot;);
    NRF_LOG_FLUSH();

    err = nrf_twi_mngr_init(&amp;amp;m_nrf_twi_mngr, &amp;amp;config);
    APP_ERROR_CHECK(err);

    err = nrf_twi_sensor_init(&amp;amp;m_nrf_twi_sensor);
    APP_ERROR_CHECK(err);

    err = lis2dh12_init(&amp;amp;m_lis2dh12);
    APP_ERROR_CHECK(err);

    NRF_LOG_INFO(&amp;quot;Here.&amp;quot;);
    NRF_LOG_FLUSH();
    APP_ERROR_CHECK(err);

    while (true)
    {
        nrf_delay_ms(500);
        err = lis2dh12_who_am_i_read(&amp;amp;m_lis2dh12, print_identity, &amp;amp;m_sample);
        APP_ERROR_CHECK(err);
        NRF_LOG_FLUSH();
    }
}

/** @} */&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;br /&gt;Thanks a lot!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: LIS2DH12 driver issue in nRF SDK v15.0</title><link>https://devzone.nordicsemi.com/thread/136612?ContentTypeID=1</link><pubDate>Mon, 18 Jun 2018 17:15:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8c05bf28-84be-4183-9261-72b080574d38</guid><dc:creator>Spegs21</dc:creator><description>&lt;p&gt;Whoops! That fixed it. I changed that for some reason looking at your above post. Before it was failing because I wasn&amp;#39;t initiating twi_sensor.&lt;/p&gt;
&lt;p&gt;Edit: Actually it worked because it programmed the DK instead of the external board which does&amp;#39;t have the low frequency oscillator. Is it required for TWI?&lt;/p&gt;
&lt;p&gt;Edit 2: Changed it to RC in SDK config and it worked. I&amp;#39;ll take that as a yes to my question.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: LIS2DH12 driver issue in nRF SDK v15.0</title><link>https://devzone.nordicsemi.com/thread/136586?ContentTypeID=1</link><pubDate>Mon, 18 Jun 2018 14:13:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6127659a-18ad-42c4-bfea-151c9fbc4970</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;You are checking the address of err_code on line 27 in your snippet. It is obviously not 0, so APP_ERROR_CHECK(&amp;amp;err_code) stops the application. Remove the &amp;quot;&amp;amp;&amp;quot;&amp;nbsp; in APP_ERROR_CHECK(&amp;amp;err_code); and see if that helps.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;BR,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: LIS2DH12 driver issue in nRF SDK v15.0</title><link>https://devzone.nordicsemi.com/thread/136580?ContentTypeID=1</link><pubDate>Mon, 18 Jun 2018 13:59:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8534ae83-724c-4130-8961-51aaaddffc84</guid><dc:creator>Spegs21</dc:creator><description>&lt;p&gt;I&amp;#39;m&amp;nbsp;just trying to initialize with&amp;nbsp;lis2dh12_init after setting everything set up and I&amp;#39;m getting:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;&amp;lt;error&amp;gt; app: ERROR 536936356 [Unknown error code] at C:\SEGGER Embedded Studio for ARM Projects\Wireless_TCT_Device\main.c:203
PC at: 0x00000721
&amp;lt;error&amp;gt; app: End of error report
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;I have:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;#define MAX_PENDING_TRANSACTIONS    32

NRF_TWI_MNGR_DEF(m_nrf_twi_mngr, MAX_PENDING_TRANSACTIONS, TWI_INSTANCE_ID);
NRF_TWI_SENSOR_DEF(m_nrf_twi_sensor,&amp;amp;m_nrf_twi_mngr,32);
LIS2DH12_INSTANCE_DEF(m_lis2dh12,&amp;amp;m_nrf_twi_sensor,LIS2DH12_BASE_ADDRESS_HIGH);

int main()
{

    uint32_t err_code;
    
    nrf_drv_twi_config_t const config = {
       .scl                = 12,
       .sda                = 13,
       .frequency          = NRF_DRV_TWI_FREQ_100K,
       .interrupt_priority = APP_IRQ_PRIORITY_LOWEST,
       .clear_bus_init     = false
    };
    
    err_code = nrf_twi_mngr_init(&amp;amp;m_nrf_twi_mngr, &amp;amp;config);
    APP_ERROR_CHECK(err_code);
    
    err_code = nrf_twi_sensor_init(&amp;amp;m_nrf_twi_sensor);
    APP_ERROR_CHECK(err_code);
    
    err_code = lis2dh12_init(&amp;amp;m_lis2dh12);
    APP_ERROR_CHECK(&amp;amp;err_code);
    NRF_LOG_INFO(&amp;quot;LIS2DH Init.&amp;quot;);
    
}&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: LIS2DH12 driver issue in nRF SDK v15.0</title><link>https://devzone.nordicsemi.com/thread/136500?ContentTypeID=1</link><pubDate>Mon, 18 Jun 2018 08:49:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9ebaebad-7c9f-46b3-80f9-f7e5cb288dbd</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Maybe you could check the err from :&lt;/p&gt;
&lt;p&gt;ret_code_t err = lis2dh12_init(&amp;amp;m_lis2dh12);&lt;/p&gt;
&lt;p&gt;What is it?&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;BR,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: LIS2DH12 driver issue in nRF SDK v15.0</title><link>https://devzone.nordicsemi.com/thread/136356?ContentTypeID=1</link><pubDate>Fri, 15 Jun 2018 12:09:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0fe2d8a3-7b00-4679-bf83-bba21dfd6150</guid><dc:creator>lhochstetter</dc:creator><description>&lt;p&gt;Hi &lt;span class="user-name"&gt;&lt;a class="internal-link view-user-profile" href="https://devzone.nordicsemi.com/members/overheat"&gt;aaronxu &lt;/a&gt;&lt;/span&gt;,&lt;br /&gt;&lt;br /&gt;I&amp;#39;m too trying to setup the LIS2DH12 driver to read out the WHO_AM_I register. I&amp;#39;ve adapted the twi_sensor example code according to my needs and your code snippets. Due to some previous issues when compiling I used the sdk_config.h from the twi_master_using_nrf_twi_mngr example.&lt;br /&gt;&lt;br /&gt;When I run the attached code the application starts, runs to the &amp;quot;Here.&amp;quot; debug print, crashes and resets to continue in an endless cycle.&lt;br /&gt;&lt;br /&gt;Would you mind sharing a minimal example on how to read out the WHO_AM_I register using the drivers or point me in a general direction to keep searching?&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;/* TWI instance ID. */
#define TWI_INSTANCE_ID             0
#define MAX_PENDING_TRANSACTIONS    33
#define LIS2DH12_MIN_QUEUE_SIZE     32

NRF_TWI_MNGR_DEF(m_nrf_twi_mngr, MAX_PENDING_TRANSACTIONS, TWI_INSTANCE_ID);
NRF_TWI_SENSOR_DEF(m_nrf_twi_sensor, &amp;amp;m_nrf_twi_mngr, LIS2DH12_MIN_QUEUE_SIZE);
LIS2DH12_INSTANCE_DEF(m_lis2dh12, &amp;amp;m_nrf_twi_sensor, LIS2DH12_BASE_ADDRESS_HIGH);

static uint8_t m_sample = 0;

void print_identity(ret_code_t r, void *p_register_data)
{
    NRF_LOG_INFO(&amp;quot;Identity: %d&amp;quot;, *((uint8_t *)p_register_data));
}

/**
 * @brief Function for main application entry.
 */
int main(void)
{
    APP_ERROR_CHECK(NRF_LOG_INIT(NULL));
    NRF_LOG_DEFAULT_BACKENDS_INIT();

    NRF_LOG_INFO(&amp;quot;TWI sensor example started.&amp;quot;);
    NRF_LOG_FLUSH();

    ret_code_t err = lis2dh12_init(&amp;amp;m_lis2dh12);
    NRF_LOG_INFO(&amp;quot;Here.&amp;quot;);
    NRF_LOG_FLUSH();
    APP_ERROR_CHECK(err);
    while (true)
    {
        nrf_delay_ms(500);
        err = lis2dh12_who_am_i_read(&amp;amp;m_lis2dh12, print_identity, &amp;amp;m_sample);
        APP_ERROR_CHECK(err);
        NRF_LOG_FLUSH();
    }
}
&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: LIS2DH12 driver issue in nRF SDK v15.0</title><link>https://devzone.nordicsemi.com/thread/133671?ContentTypeID=1</link><pubDate>Mon, 28 May 2018 13:29:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:57770d57-2a1e-48b4-83fb-ef475b84177d</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;I am sorry for the late reply.&lt;/p&gt;
&lt;p&gt;I don&amp;#39;t have a LIS2DH sensor to test any of this on, but the parameters: LIS2DH12_MIN_QUEUE_SIZE and MAX_PENDING_TRANSACTIONS means the following in the application:&lt;/p&gt;
&lt;p&gt;NRF_TWI_MNGR_DEF(..., MAX_PENDING_TRANSACTIONS, ...)&lt;/p&gt;
&lt;p&gt;The second parameter of NRF_TWI_MNGR_DEF(...) is the size of the transaction queue. See &lt;a href="http://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.sdk5.v15.0.0%2Fgroup__nrf__twi__mngr.html&amp;amp;anchor=ga7fb8b167ff5673c4310dd9f03cf54e86" target="_blank" rel="noopener noreferrer"&gt;NRF_TWI_MNGR_DEF() on infocenter&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;NRF_TWI_SENSOR_DEF(..., ..., LIS2DH12_MIN_QUEUE_SIZE)&lt;/p&gt;
&lt;p&gt;The third parameter of NRF_TWI_SENSOR_DEF(...) is the buffer size of the TWI communication for that sensor.&amp;nbsp;&lt;a href="http://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.sdk5.v15.0.0%2Fgroup__nrf__twi__sensor.html&amp;amp;anchor=ga0e720f69464ae128effd566b8d880bed" target="_blank" rel="noopener noreferrer"&gt;See NRF_TWI_SENSOR_DEF() on infocenter&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Again, I haven&amp;#39;t got any LIS2DH sensor to test this on, so I haven&amp;#39;t tested this driver before. But I suppose that the sensor def is the queue of a single transaction in bytes, while the TWI_MNGR_DEF is the max number of pending transactions.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: LIS2DH12 driver issue in nRF SDK v15.0</title><link>https://devzone.nordicsemi.com/thread/133418?ContentTypeID=1</link><pubDate>Fri, 25 May 2018 12:07:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d379366e-a1f4-4ccc-afa0-17336dad9e1b</guid><dc:creator>aaronxu</dc:creator><description>&lt;p&gt;New commit:&lt;/p&gt;
&lt;p&gt;I found the reason of this Hard fault is that, I use&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;lis2dh12_data_read(&amp;amp;m_lis2dh12, lis2dh12_data_read_cb, &amp;amp;accel_data, sizeof(accel_data));&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;but the last parameter was multi by 6 inside lis2dh12 driver, so it&amp;#39;s bigger than&amp;nbsp;LIS2DH12_MIN_QUEUE_SIZE.&lt;/p&gt;
&lt;p&gt;So I change is to 1 and it work.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;But I still have question, How big can I set the &amp;quot;LIS2DH12_MIN_QUEUE_SIZE&amp;quot;. And do I need to set&amp;nbsp;MAX_PENDING_TRANSACTIONS bigger than&amp;nbsp;&lt;span&gt;LIS2DH12_MIN_QUEUE_SIZE?&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: LIS2DH12 driver issue in nRF SDK v15.0</title><link>https://devzone.nordicsemi.com/thread/133318?ContentTypeID=1</link><pubDate>Thu, 24 May 2018 23:42:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3fc69563-48d1-4993-9b5a-343a5338fdc3</guid><dc:creator>aaronxu</dc:creator><description>&lt;p&gt;More information here:&lt;/p&gt;
&lt;p&gt;Define and configuration:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;#define TWI_INSTANCE_ID             0

#define MAX_PENDING_TRANSACTIONS    33

#define LIS2DH12_MIN_QUEUE_SIZE       32

NRF_TWI_MNGR_DEF(m_nrf_twi_mngr, MAX_PENDING_TRANSACTIONS, TWI_INSTANCE_ID);

NRF_TWI_SENSOR_DEF(m_nrf_twi_sensor, &amp;amp;m_nrf_twi_mngr, LIS2DH12_MIN_QUEUE_SIZE);

LIS2DH12_INSTANCE_DEF(m_lis2dh12, &amp;amp;m_nrf_twi_sensor, LIS2DH12_BASE_ADDRESS_LOW);


...

    LIS2DH12_DATA_CFG(m_lis2dh12, LIS2DH12_ODR_100HZ, false, 1, 1, 1, LIS2DH12_SCALE_2G, 1);
    LIS2DH12_FIFO_CFG(m_lis2dh12, false, LIS2DH12_BYPASS, false, 0x00);

    err_code = lis2dh12_init(&amp;amp;m_lis2dh12);
    APP_ERROR_CHECK(err_code);

...


&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;after that,&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;lis2dh12_data_read(&amp;amp;m_lis2dh12, lis2dh12_data_read_cb, &amp;amp;accel_data, sizeof(accel_data));&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>