<?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>nrf52 not entering sleep mode when accelerometer kx022 is used with twi manager</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/45301/nrf52-not-entering-sleep-mode-when-accelerometer-kx022-is-used-with-twi-manager</link><description>On a NRF52832 based beacon I use to sensors, a SHT3 temperature and humidity sensor and a KX022 accelerometer. 
 I&amp;#39;m using the twi_manager library as it is used in the example. 
 With the SHT3 everything is fine, the overall power consumption is ok. </description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 29 Mar 2019 11:14:38 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/45301/nrf52-not-entering-sleep-mode-when-accelerometer-kx022-is-used-with-twi-manager" /><item><title>RE: nrf52 not entering sleep mode when accelerometer kx022 is used with twi manager</title><link>https://devzone.nordicsemi.com/thread/179200?ContentTypeID=1</link><pubDate>Fri, 29 Mar 2019 11:14:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:448c7fd1-f857-4d97-92e0-745404821a26</guid><dc:creator>Bj&amp;#248;rn Kvaale</dc:creator><description>&lt;p&gt;I would use either RTC or the &lt;a href="https://devzone.nordicsemi.com/tutorials/b/software-development-kit/posts/application-timer-tutorial"&gt;app_timer&lt;/a&gt;. It seems that you have already solved this, so I would just use what you have. I do not believe there are any advantages of using the first option I discussed in my last comment.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf52 not entering sleep mode when accelerometer kx022 is used with twi manager</title><link>https://devzone.nordicsemi.com/thread/179049?ContentTypeID=1</link><pubDate>Thu, 28 Mar 2019 17:30:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b23402e7-f8c0-416b-99db-802008d3252a</guid><dc:creator>an-erd</dc:creator><description>&lt;p&gt;Ok, but I didn&amp;#39;t found on a packet timer concept in TWI transaction manager?&lt;/p&gt;
&lt;p&gt;For my application with the sensors mentioned I need the delay between to packets send to the device. It&amp;#39;s not just one time when initializing the sensor, but every cycle it&amp;#39;s necessary. So it would be good to have something like a &amp;quot;delay package&amp;quot; for a specific device handover to the TWI transaction manager to wait for that specific TWI address.&lt;/p&gt;
&lt;p&gt;In my current implementation I use RTC to do exactly this, but here I need to take care that the different device communications don&amp;#39;t collide. So I need a combination of both, transaction manager and packet timer functionality.&lt;/p&gt;
&lt;p&gt;Is there something like this available? If not, the ticket can be closed because the problem is solved.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf52 not entering sleep mode when accelerometer kx022 is used with twi manager</title><link>https://devzone.nordicsemi.com/thread/178974?ContentTypeID=1</link><pubDate>Thu, 28 Mar 2019 14:22:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ca834b41-3eaa-4e45-8f23-d2c60fb6a397</guid><dc:creator>Bj&amp;#248;rn Kvaale</dc:creator><description>[quote user="an-erd"]But which is the best way to implement a delay using transaction manager transactions?[/quote]
&lt;p&gt;&amp;nbsp;You could consider setting in a delay in between sending packets with the packet timer. Otherwise, you could also use the RTC or app_timer to sleep while you are waiting for the KX022 accelerometer to initialize.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf52 not entering sleep mode when accelerometer kx022 is used with twi manager</title><link>https://devzone.nordicsemi.com/thread/178469?ContentTypeID=1</link><pubDate>Tue, 26 Mar 2019 15:55:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0f089271-da65-4926-8205-5fa3ba3a121e</guid><dc:creator>an-erd</dc:creator><description>&lt;p&gt;Overall power consumption is not a problem, with the temperature/humidity sensor everything is fine, UART is no problem, I&amp;#39;m using RTT.&lt;/p&gt;
&lt;p&gt;I rewrote the code part to use blocking TWI (without transaction manager) and also read the data sheet again.&amp;nbsp;I found that the KX022 accel needs some delays (1.2/ODR) before putting in operation, and this seems to be the problem. With the blocking TWI and nfr_delay() the power consumption is ok, too.&lt;/p&gt;
&lt;p&gt;The posted link 2 is a good reference, I didn&amp;#39;t know, that I can schedule blocking transactions with the transaction manager, too.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;But which is the best way to implement a delay using transaction manager transactions?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf52 not entering sleep mode when accelerometer kx022 is used with twi manager</title><link>https://devzone.nordicsemi.com/thread/178417?ContentTypeID=1</link><pubDate>Tue, 26 Mar 2019 14:19:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1c0dec26-16a3-4f69-ab5d-9f0aba694b07</guid><dc:creator>Bj&amp;#248;rn Kvaale</dc:creator><description>&lt;p&gt;It seems like the CPU is still running (check electrical specifications for the CPU from &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/33353/nrf52-twi-high-consumption-when-sleep-mode"&gt;this link&lt;/a&gt;). Like you mentioned, for some reason it seems the TWI manager is keeping the CPU awake.&lt;/p&gt;
&lt;p&gt;Could you try turning TWI off via the nrf_twi_mngr_uninit() function just to double check that it is the TWI manager that is leading to the interrupt from sleep issue?&lt;/p&gt;
&lt;p&gt;This could also be related to the UART logging to the computer. Have you tested the sleep current by turning the UART off?&lt;/p&gt;
&lt;p&gt;The documentation present here may also be helpful if you have not already seen it: &lt;a href="https://www.nordicsemi.com/DocLib/Content/SDK_Doc/nRF5_SDK/v15-2-0/twi_transaction_mgr_example"&gt;link 1&lt;/a&gt;, &lt;a href="https://www.nordicsemi.com/DocLib/Content/SDK_Doc/nRF5_SDK/v15-2-0/lib_nrf_twi_mngr"&gt;link 2&lt;/a&gt;, &lt;a href="https://www.nordicsemi.com/DocLib/Content/SDK_Doc/nRF5_SDK/v15-2-0/group__nrf__twi__mngr"&gt;link 3&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/16069/twi-causing-nrf52-not-to-sleep"&gt;This case&lt;/a&gt; may also be helpful.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf52 not entering sleep mode when accelerometer kx022 is used with twi manager</title><link>https://devzone.nordicsemi.com/thread/177970?ContentTypeID=1</link><pubDate>Sun, 24 Mar 2019 19:05:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9663a0c4-4cb8-413e-a5f6-5d93a467bc14</guid><dc:creator>an-erd</dc:creator><description>&lt;p&gt;I added two breakpoints in the function nrf_pwr_mgmt_run(), breakpoint A in the line with the first __WFE(), and the second breakpoint B when leaving the function again.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;void nrf_pwr_mgmt_run(void)
{
    PWR_MGMT_FPU_SLEEP_PREPARE();
    PWR_MGMT_SLEEP_LOCK_ACQUIRE();
    PWR_MGMT_CPU_USAGE_MONITOR_SECTION_ENTER();
    PWR_MGMT_DEBUG_PIN_SET();

    // Wait for an event.
#ifdef SOFTDEVICE_PRESENT
    if (nrf_sdh_is_enabled())
    {
        ret_code_t ret_code = sd_app_evt_wait();
        ASSERT((ret_code == NRF_SUCCESS) || (ret_code == NRF_ERROR_SOFTDEVICE_NOT_ENABLED));
        UNUSED_VARIABLE(ret_code);
    }
    else
#endif // SOFTDEVICE_PRESENT
    {
        // Wait for an event.
        __WFE();
        // Clear the internal event register.
        __SEV();
        __WFE();
    }

    PWR_MGMT_DEBUG_PIN_CLEAR();
    PWR_MGMT_CPU_USAGE_MONITOR_SECTION_EXIT();
    PWR_MGMT_SLEEP_LOCK_RELEASE();
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;In Keil debugging i get the figures, that between breakpoint A and B it&amp;#39;s ~40 ns, and between B and A (so next entry of the function) ~223 usec.&lt;/p&gt;
&lt;p&gt;Where to look why it&amp;#39;s leaving __WFE() so fast again?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>