<?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>Issues working with lis2dh12 in FIFO mode</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/59239/issues-working-with-lis2dh12-in-fifo-mode</link><description>Hi 
 
 I&amp;#39;m working on a project interfacing the nRF52840 board with the lis2dh12 accelerometer 
 I&amp;#39;m using SDK 15.3, basing my code on the provided driver and information I&amp;#39;ve found here 
 I&amp;#39;ve used the TWI manager configuration native to the example</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Sun, 22 Mar 2020 09:11:49 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/59239/issues-working-with-lis2dh12-in-fifo-mode" /><item><title>RE: Issues working with lis2dh12 in FIFO mode</title><link>https://devzone.nordicsemi.com/thread/240997?ContentTypeID=1</link><pubDate>Sun, 22 Mar 2020 09:11:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:baf60e9a-f11a-4688-9f46-afb91597b9f7</guid><dc:creator>Aviv Okon</dc:creator><description>&lt;p&gt;I was able to solve this issue&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;what I failed to understand was what the watermark interrupt meant. after speaking to a co-worker who used a similar device, we realized that the correct method of operation is to use the watermark interrupt, not the FIFO overrun interrupt. this results in the FIFO never getting full, and thus never needing to be reset&lt;/p&gt;
&lt;p&gt;however, this also requires that only a part of the FIFO is read every time, resulting in more frequent interrupts and reads, so this is something to consider&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;feel free to close this, though if someone would be able to explain how to properly reset the FIFO with the nRF driver, that would also help&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Issues working with lis2dh12 in FIFO mode</title><link>https://devzone.nordicsemi.com/thread/240564?ContentTypeID=1</link><pubDate>Thu, 19 Mar 2020 08:40:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:62178134-1b9f-4cb3-b614-1861ffea99ae</guid><dc:creator>Aviv Okon</dc:creator><description>&lt;p&gt;thanks for the explanation&lt;/p&gt;
&lt;p&gt;I&amp;#39;ll have to dive into this and test it&lt;/p&gt;
&lt;p&gt;I&amp;#39;ll update after I&amp;#39;ve had some time to go through it&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Issues working with lis2dh12 in FIFO mode</title><link>https://devzone.nordicsemi.com/thread/240549?ContentTypeID=1</link><pubDate>Thu, 19 Mar 2020 06:56:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:24928dc2-ede7-4233-a63a-80dee91a285f</guid><dc:creator>Nguyen Hoan Hoang</dc:creator><description>&lt;p&gt;The code Mojo showed you&amp;nbsp;is a generic lis2dh12 driver. &amp;nbsp;It works with both i2c and spi. &amp;nbsp;It works with any mcu from nRF5x series to STM32. &amp;nbsp;&lt;/p&gt;
&lt;p&gt;Here is how to use with i2c.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;b&gt;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;static const I2CCFG s_I2cCfg = {
	.DevNo = I2C_DEVNO,
	.Pins = {
		{I2C_SDA_PORT, I2C_SDA_PIN, I2C_SDA_PINOP, IOPINDIR_BI, IOPINRES_PULLUP, IOPINTYPE_NORMAL},	// SDA
		{I2C_SCL_PORT, I2C_SCL_PIN, I2C_SCL_PINOP, IOPINDIR_OUTPUT, IOPINRES_PULLUP, IOPINTYPE_NORMAL},	// SCL
	},
	.Rate = 100000,
	.Mode = I2CMODE_MASTER,
	.MaxRetry = 5,
};

I2C g_I2c;

static const ACCELSENSOR_CFG s_AccelCfg = {
	.DevAddr = LIS2DH12_I2C_DEVADDR,
	.OpMode = SENSOR_OPMODE_CONTINUOUS,
	.Freq = 10000,
	.Scale = 2,
	.bInter = true,
};

AccelLis2dh12 g_Accel;

void main()
{
   g_I2C.Init(s_I2cCfg);
   g_Accel.Init(s_AccelCfg, &amp;amp;g_I2C);
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;To use with SPI, replace the I2C object with SPI object. As simple as that.&lt;/p&gt;
&lt;p&gt;That driver works with fifo mode. you can cherry pick the code you need.&lt;/p&gt;
&lt;p&gt;Other&amp;nbsp;example&amp;nbsp;using an Invensense IMU and stream it to Thingy App using the same SPI &amp;amp; I2C interface object.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://github.com/IOsonata/IOsonata/tree/master/ARM/Nordic/exemples/BlueIOThingy"&gt;github.com/.../BlueIOThingy&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Other sensor example including BMI160 with same SPI, I2C interface.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://github.com/IOsonata/IOsonata/blob/master/exemples/sensor/mot_sensor_demo.cpp"&gt;https://github.com/IOsonata/IOsonata/blob/master/exemples/sensor/mot_sensor_demo.cpp&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;You can browse the repo for more examples&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Issues working with lis2dh12 in FIFO mode</title><link>https://devzone.nordicsemi.com/thread/240542?ContentTypeID=1</link><pubDate>Thu, 19 Mar 2020 06:07:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1afad545-c5ed-40f2-a633-4634a06b6871</guid><dc:creator>Aviv Okon</dc:creator><description>&lt;p&gt;what exactly is that code? I don&amp;#39;t see any documentation there.....&lt;/p&gt;
&lt;p&gt;Is that module controlling the accelerometer directly, without the need of the TWI\SPI interface?&lt;/p&gt;
&lt;p&gt;which interface is used here? where are the pins configured?&lt;/p&gt;
&lt;p&gt;have you ever seen this used on an nRF card? because I can&amp;#39;t see which drivers this is using, and it doesn&amp;#39;t really look like plug and play drivers would work on such systems.......&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Issues working with lis2dh12 in FIFO mode</title><link>https://devzone.nordicsemi.com/thread/240505?ContentTypeID=1</link><pubDate>Wed, 18 Mar 2020 17:15:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:10d06c40-0ce7-43b9-88ec-76cdbb4a2e4c</guid><dc:creator>Mojo</dc:creator><description>&lt;p&gt;try this&amp;nbsp;&lt;a href="https://github.com/IOsonata/IOsonata/blob/master/src/sensors/accel_lis2dh12.cpp"&gt;https://github.com/IOsonata/IOsonata/blob/master/src/sensors/accel_lis2dh12.cpp&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>