<?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>Watermark interrupt not working correctly  with nrf52832 due to spi overhead</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/72506/watermark-interrupt-not-working-correctly-with-nrf52832-due-to-spi-overhead</link><description>Hi, 
 -I have a custom board using nrf 52832 and I have interfaced LIS2DH12 using an SPI interface. -I am using SDK 15.2.0. -I am collecting raw data using FIFO mode and send them serially. -I have configured watermark interrupt on INT1 of Lis2dh12. </description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 09 Mar 2021 09:43:36 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/72506/watermark-interrupt-not-working-correctly-with-nrf52832-due-to-spi-overhead" /><item><title>RE: Watermark interrupt not working correctly  with nrf52832 due to spi overhead</title><link>https://devzone.nordicsemi.com/thread/298610?ContentTypeID=1</link><pubDate>Tue, 09 Mar 2021 09:43:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c524145d-6b4b-4e82-af07-28e95b3df052</guid><dc:creator>pd@learner</dc:creator><description>&lt;p&gt;&lt;span&gt;I think is what you have (if you read the FIFO status before reading XYZ values out of the FIFO) ie not 2&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;=&amp;gt; yes if I have read&amp;nbsp;FIFO status before reading XYZ values out of the FIFO then the first time it is 11 i.e watermark interrupt occurs. For next time it is 29.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;=&amp;gt;I want to read multiple bytes at a time i.e 12 byte Can you tell me how to read it using nrf spi driver.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Watermark interrupt not working correctly  with nrf52832 due to spi overhead</title><link>https://devzone.nordicsemi.com/thread/298534?ContentTypeID=1</link><pubDate>Tue, 09 Mar 2021 01:17:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1a4f4004-e38d-439f-885a-75757119fbc2</guid><dc:creator>hmolesworth</dc:creator><description>&lt;p&gt;The watermark register is being set to 10, and so the number of data samples waiting (&lt;em&gt;register bits FSS[4:0]&lt;/em&gt;) when reading following the interrupt will be &lt;em&gt;at least&lt;/em&gt; 10, which I think is what you have (if you read the FIFO status before reading XYZ values out of the FIFO) ie not 2. It could be more than 10 depending on how long the code takes to eventually read the FIFO status, but following a 10-reading readout it should not go active again until the next 10 samples have been accumulated in the FIFO; FIFO overflow should probably be handled; unexpected results might occur otherwise.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt; spi_write_reg(LIS2DH_FIFO_CTRL_REG, 0X8A); 	// FIFO MODE -STREAM ENABLE AND NO SAMPLE 10&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Usually the 12-bit XYZ registers - which&amp;nbsp;occupy&amp;nbsp; consecutive bytes on the LIS2DH12 - would be read in a single multi-byte SPI transfer; not quite sure if there is an issue reading just 1 byte at a time.&lt;/p&gt;
&lt;p&gt;By the way, using high-drive on /CS, SCK and MOSI allows 8MHz operation.&lt;/p&gt;
&lt;p&gt;Note if 10 readings are read out then the FIFO status no&amp;nbsp; longer has those 10 readings to report, and might indeed report 1 or 2 depending how long the code took. Better to read status both before and after reading out the FiFO to see what is happening.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>