<?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>Using LIS3dh with Thingy52</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/82591/using-lis3dh-with-thingy52</link><description>Hi 
 
 I am a student and this is my first project working on BLE. Please keep that in mind. 
 The end goal is to create a fingerprinting system with a Thingy (nRF6936) as a node. This Thingy currently broadcasts a UUID for gateways to pick up without</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 18 Jan 2022 17:57:38 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/82591/using-lis3dh-with-thingy52" /><item><title>RE: Using LIS3dh with Thingy52</title><link>https://devzone.nordicsemi.com/thread/348375?ContentTypeID=1</link><pubDate>Tue, 18 Jan 2022 17:57:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9fb5f646-e83d-4848-a631-b1c7c82b7f79</guid><dc:creator>willemvde</dc:creator><description>&lt;p&gt;The following code reads the whoAmI value from the lis2dh12 sensor inside the thingy52. I&amp;#39;m just leaving it here for&amp;nbsp;people who are having the same trouble as me in the future.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Greetings&lt;/p&gt;
&lt;p&gt;Willem&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;#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                = 15,
       .sda                = 14,
       .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(100);
        err = lis2dh12_who_am_i_read(&amp;amp;m_lis2dh12, print_identity, &amp;amp;m_sample);
        APP_ERROR_CHECK(err);
        NRF_LOG_INFO(&amp;quot;Who am I: %x&amp;quot;, m_sample);
        NRF_LOG_FLUSH();
    }
}&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using LIS3dh with Thingy52</title><link>https://devzone.nordicsemi.com/thread/344977?ContentTypeID=1</link><pubDate>Thu, 23 Dec 2021 14:24:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b6fbaa9e-1967-4305-b9be-9a6cf3225f58</guid><dc:creator>Sigurd Hellesvik</dc:creator><description>&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;When I was searching for drivers before, I was looking for LIS3DH. &lt;br /&gt;However, I just found that LIS2DH drivers are compatible(&lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/1.8.0/zephyr/samples/sensor/lis2dh/README.html"&gt;ref&lt;/a&gt;) with the LIS3DH.&lt;/p&gt;
&lt;p&gt;In the nRF Connect SDK, there is a &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/1.8.0/zephyr/samples/sensor/lis2dh/README.html"&gt;LIS2DH: Motion Sensor Monitor&lt;/a&gt; sample.&lt;/p&gt;
&lt;p&gt;In the nRF 5 SDK, there is a driver for the LIS2DH as well, see &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/48266/sample-code-interfacing-lis2dh12-with-nrf52"&gt;this previous case&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;I am sorry that I did not spot this compatibility earlier. I hope that this could still be of some use.&lt;/p&gt;
&lt;p&gt;Regards,&lt;br /&gt;Sigurd Hellesvik&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using LIS3dh with Thingy52</title><link>https://devzone.nordicsemi.com/thread/343438?ContentTypeID=1</link><pubDate>Tue, 14 Dec 2021 14:28:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3ad92201-5102-4b1d-b38a-58f50d83f8c0</guid><dc:creator>willemvde</dc:creator><description>&lt;p&gt;Thanks for making those 2 different SDKs clear for me. There is no time to switch SDK now, but I will keep this in mind when I&amp;#39;m starting a new BLE project.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;For now, I&amp;#39;ll keep trying to make the &amp;#39;old&amp;#39; SDK work with the Thiingy. I&amp;#39;m making some progress so I&amp;#39;m hopeful.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Greetings&lt;/p&gt;
&lt;p&gt;Willem&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using LIS3dh with Thingy52</title><link>https://devzone.nordicsemi.com/thread/343416?ContentTypeID=1</link><pubDate>Tue, 14 Dec 2021 13:20:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f29f0d17-542b-4dad-bfd4-87f3f7ce99eb</guid><dc:creator>Sigurd Hellesvik</dc:creator><description>&lt;p&gt;Hi Willem,&lt;/p&gt;
&lt;p&gt;See &lt;a href="https://infocenter.nordicsemi.com/index.jsp?topic=%2Fsdk_nrf5_v17.1.0%2Fsdk_for_custom_boards.html&amp;amp;cp=8_1_1_5"&gt; Using the SDK with other boards&lt;/a&gt; and our &lt;a href="https://github.com/NordicSemiconductor/Nordic-Thingy52-FW/tree/master/include/board"&gt;GitHub for Thingy 52 header fil&lt;/a&gt;e.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Side note:&lt;br /&gt;We have two different SDKs. The old nRF5 SDK, which you are using, and the newer nRF Connect SDK. See this &lt;a href="https://devzone.nordicsemi.com/nordic/nordic-blog/b/blog/posts/nrf-connect-sdk-and-nrf5-sdk-statement"&gt;nRF Connect SDK and nRF5 SDK statement&lt;/a&gt; for more information on the difference.&lt;br /&gt;Personally, I think development for the Thingy:52 would be easier on the nRF Connect SDK, as it has &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/1.7.1/zephyr/boards/arm/thingy52_nrf52832/doc/index.html?highlight=thingy"&gt;integrated support&lt;/a&gt; for the Thingy:52.&lt;/p&gt;
&lt;p&gt;Switching SDK would mean you have to learn the new one, and rewrite any code you have already made. So depending on how much time this would take, it could or could not be worth it. Up to you really, but now you know your alternatives.&lt;/p&gt;
&lt;p&gt;Regards,&lt;br /&gt;Sigurd Hellesvik&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using LIS3dh with Thingy52</title><link>https://devzone.nordicsemi.com/thread/343361?ContentTypeID=1</link><pubDate>Tue, 14 Dec 2021 10:29:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:14d74e4c-139c-49af-b917-941edac5e104</guid><dc:creator>willemvde</dc:creator><description>&lt;p&gt;Those standard drivers look very handy!&lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using LIS3dh with Thingy52</title><link>https://devzone.nordicsemi.com/thread/343360?ContentTypeID=1</link><pubDate>Tue, 14 Dec 2021 10:28:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:59b0824d-b8ad-4d9b-a4bb-8e9d69d69b36</guid><dc:creator>willemvde</dc:creator><description>&lt;p&gt;Hi Sigurd&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;This would help if I hadn&amp;#39;t stumbled upon another problem. Namely, flashing the Thingy. I tried using the pca10040 and pca10056 Makefiles from an example, but it seems that the Thingy uses pca20020. I couldn&amp;#39;t find a working Makefile online and making one by myself seems difficult.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Any suggestions on how to do this?&lt;/p&gt;
&lt;p&gt;If what I&amp;#39;m trying isn&amp;#39;t possible, I&amp;#39;ll have to find an external accelerometer and use it on my nrf52840 devkit.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Greetings&lt;/p&gt;
&lt;p&gt;Willem&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using LIS3dh with Thingy52</title><link>https://devzone.nordicsemi.com/thread/342832?ContentTypeID=1</link><pubDate>Fri, 10 Dec 2021 08:06:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:59f3b575-4809-44ac-9ef0-53d7efbf2e18</guid><dc:creator>Sigurd Hellesvik</dc:creator><description>&lt;p&gt;Hi Willem,&lt;/p&gt;
&lt;p&gt;For documentation for the Thingy:52, we got most of our documentation on our Infocenter. See &lt;a href="https://infocenter.nordicsemi.com/topic/ug_thingy52/UG/thingy52/intro/frontpage.html"&gt;this page for Thingy:52.&lt;/a&gt; And for the connectors of the Thingy:52, see &lt;a href="https://infocenter.nordicsemi.com/topic/ug_thingy52/UG/thingy52/hw_description/hw_connectors.html"&gt;Thnigy:52 Connectors&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Some extra useful information can be found at the &lt;a href="https://www.nordicsemi.com/Products/Development-hardware/Nordic-Thingy-52/Download?lang=en#infotabs"&gt;Thingy:52 Product page: Downloads&lt;/a&gt;, such as Hardware files, where you can find a pdf containing all block diagrams for the Thingy. This is often useful for finding pinouts as well.&lt;/p&gt;
[quote user=""]I couldn&amp;#39;t find any drivers for the LIS3dh that work on Thingies. That means I have to use SPI or I²C?&amp;nbsp;[/quote]
&lt;p&gt;If the sensor is interfaced using either SPI or I2C, it will always have to be interfaced using that communication protocol. Which communication protocol is up to the sensor, see the datasheet for each sensor to find how it can be interfaced.&lt;/p&gt;
&lt;p&gt;A driver for a sensor is premade code that will use said interface for the sensor. &lt;br /&gt;If you can not find any premade drivers for the sensor, you will have to write your own code to interface the sensor (using for example SPI). This would be called writing a custom driver for said sensor.&lt;/p&gt;
&lt;p&gt;Did this answer your questions?&lt;/p&gt;
&lt;p&gt;Regards,&lt;br /&gt;Sigurd Hellesvik&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using LIS3dh with Thingy52</title><link>https://devzone.nordicsemi.com/thread/342783?ContentTypeID=1</link><pubDate>Thu, 09 Dec 2021 17:14:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:166739f3-b377-463f-9b47-380fb9caf6e5</guid><dc:creator>AbhaySingh</dc:creator><description>&lt;p&gt;Hi willemvde,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;You can find driver for lis3dh and few example code from the below link.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://github.com/STMicroelectronics/STMems_Standard_C_drivers"&gt;https://github.com/STMicroelectronics/STMems_Standard_C_drivers&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;And then , you just have to write your own, plateform_write and plateform_read function.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>