<?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>turning off i2c in nrfconnectsdk which uses TWIM peripheral.  making sure easy dma is off</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/103495/turning-off-i2c-in-nrfconnectsdk-which-uses-twim-peripheral-making-sure-easy-dma-is-off</link><description>i am using I2C in nrfconnectsdk and i 
 init the I2C device as follows 
 
 
 int nStatus = 0 ; 
 
 i2c_dev = DEVICE_DT_GET ( DT_NODELABEL (i2c1)); 
 if ( ! i2c_dev ) 
 return nStatus ; 
 
 i2c_configure ( i2c_dev , I2C_SPEED_SET ( I2C_SPEED_STANDARD </description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 01 Feb 2024 18:20:39 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/103495/turning-off-i2c-in-nrfconnectsdk-which-uses-twim-peripheral-making-sure-easy-dma-is-off" /><item><title>RE: turning off i2c in nrfconnectsdk which uses TWIM peripheral.  making sure easy dma is off</title><link>https://devzone.nordicsemi.com/thread/467243?ContentTypeID=1</link><pubDate>Thu, 01 Feb 2024 18:20:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:30ba8abe-d82f-44ba-9693-b322eb2183ee</guid><dc:creator>weightwatcherphil</dc:creator><description>&lt;p&gt;please close this ticket.&amp;nbsp; I am not working on this project any more&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: turning off i2c in nrfconnectsdk which uses TWIM peripheral.  making sure easy dma is off</title><link>https://devzone.nordicsemi.com/thread/452033?ContentTypeID=1</link><pubDate>Tue, 24 Oct 2023 14:45:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:193b6f35-59e6-48a4-97fd-0661d7e85f22</guid><dc:creator>weightwatcherphil</dc:creator><description>&lt;p&gt;my power profiler shows i am pulling 800 ua in the power off state..&amp;nbsp; this is due to other chips on my custom board and I will be getting a new board..&amp;nbsp; so I would like to close this case until i get a new board.&amp;nbsp; then i will open a new ticket.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: turning off i2c in nrfconnectsdk which uses TWIM peripheral.  making sure easy dma is off</title><link>https://devzone.nordicsemi.com/thread/449269?ContentTypeID=1</link><pubDate>Mon, 09 Oct 2023 04:00:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:38b4b59c-3d6b-487b-a380-f609ede5d18a</guid><dc:creator>weightwatcherphil</dc:creator><description>&lt;p&gt;i have been on another part of the project for awahile.&amp;nbsp; I iwll read the RESETREAS register..&amp;nbsp; i also have a power profiller kit to use now.&lt;/p&gt;
&lt;p&gt;thanks,&lt;/p&gt;
&lt;p&gt;now&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: turning off i2c in nrfconnectsdk which uses TWIM peripheral.  making sure easy dma is off</title><link>https://devzone.nordicsemi.com/thread/447041?ContentTypeID=1</link><pubDate>Thu, 21 Sep 2023 11:33:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:251ae6e2-ac83-49ee-8105-818de2bc97de</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hi Phil,&lt;/p&gt;
&lt;p&gt;The only&amp;nbsp;thing that might prevent the device from entering System OFF mode is if the chip is in debug interface mode. But in that case, the current would be in the mA range. Additionally, there could be issues with the chip unexpectedly waking up after entering System OFF mode.&lt;/p&gt;
&lt;p&gt;You can read the&amp;nbsp;&lt;a title="RESETREAS" href="https://infocenter.nordicsemi.com/topic/ps_nrf5340/chapters/reset/doc/reset.html?cp=4_0_0_3_9_10_0#register.RESETREAS"&gt;RESETREAS&lt;/a&gt;&amp;nbsp;register on startup to determine if the system woke up from the System OFF state. Just remember to clear the reset bit after reading as this is a retained register.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Vidar&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: turning off i2c in nrfconnectsdk which uses TWIM peripheral.  making sure easy dma is off</title><link>https://devzone.nordicsemi.com/thread/446511?ContentTypeID=1</link><pubDate>Mon, 18 Sep 2023 16:58:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a822ab05-93b8-4f2e-aa60-5bc8f691a3ed</guid><dc:creator>weightwatcherphil</dc:creator><description>&lt;p&gt;i am still working on trying this.&amp;nbsp; i have a custom board with some current leakage but right now I have about 100-200 ua of unexplained leakage and I am wondering if some how when i call&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;div&gt;
&lt;div&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span&gt;nrf_regulators_system_off&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;NRF_REGULATORS&lt;/span&gt;&lt;span&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;zephyr is keeping the nrf5430 from going into the deep sleep mode.&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;so my questionis can calling&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;div&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span&gt;nrf_regulators_system_off&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;NRF_REGULATORS&lt;/span&gt;&lt;span&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;fail to put the processor in deep sleep mode?&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;thanks&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;phil&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: turning off i2c in nrfconnectsdk which uses TWIM peripheral.  making sure easy dma is off</title><link>https://devzone.nordicsemi.com/thread/445379?ContentTypeID=1</link><pubDate>Mon, 11 Sep 2023 11:02:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:af675dc6-11bb-411e-8eec-25739a5664eb</guid><dc:creator>runsiv</dc:creator><description>&lt;p&gt;The blog is a few years old, so there&amp;#39;s allways that which may cause troubles but the example I linked under works. I will set the case to idle while you try&lt;/p&gt;
&lt;p&gt;Regards&lt;/p&gt;
&lt;p&gt;Runar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: turning off i2c in nrfconnectsdk which uses TWIM peripheral.  making sure easy dma is off</title><link>https://devzone.nordicsemi.com/thread/445240?ContentTypeID=1</link><pubDate>Sat, 09 Sep 2023 16:18:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:78201f07-1bca-4280-9afc-e68e18d1c957</guid><dc:creator>weightwatcherphil</dc:creator><description>&lt;p&gt;i tried this&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;/* Above we disabled entry to deep sleep based on duration of
	 * controlled delay.  Here we need to override that, then
	 * force entry to deep sleep on any delay.
	 */
	pm_state_force(0u, &amp;amp;(struct pm_state_info){PM_STATE_SOFT_OFF, 0, 0});

	/* Now we need to go sleep. This will let the idle thread runs and
	 * the pm subsystem will use the forced state. To confirm that the
	 * forced state is used, lets set the same timeout used previously.
	 */
	k_sleep(K_SECONDS(SLEEP_S));

	printk(&amp;quot;ERROR: System off failed\n&amp;quot;);
	while (true) {
		/* spin to avoid fall-off behavior */
	}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;and it printed failed.&amp;nbsp; but now i am not sure i had power management configured correctly.&lt;/p&gt;
&lt;p&gt;I think i need to go back and try it again.&lt;/p&gt;
&lt;p&gt;phil&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: turning off i2c in nrfconnectsdk which uses TWIM peripheral.  making sure easy dma is off</title><link>https://devzone.nordicsemi.com/thread/445161?ContentTypeID=1</link><pubDate>Fri, 08 Sep 2023 13:33:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2d230efb-460a-49eb-bb49-b38f03a85c4f</guid><dc:creator>runsiv</dc:creator><description>&lt;p&gt;Hi,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;How did you try to use the Power Managent API?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;If you are using PM you can enable and disable the PWM with calling&amp;nbsp;&lt;span&gt;&lt;span dir="ltr"&gt;pwm_nrfx_pm_action() with&amp;nbsp;PM_DEVICE_ACTION_SUSPEND and PM_DEVICE_ACTION_RESUME.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;The PWM driver in zephyr also supports 4 channels, you just have to list&amp;nbsp; them in pinctrl.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;You can also have a look at the &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/samples/nfc/system_off/README.html#nfc-system-off"&gt;System Off sample&lt;/a&gt; on how to enter sleep and waking up using an external event like a button or in the case of the example NFC.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Regards&lt;/p&gt;
&lt;p&gt;Runar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: turning off i2c in nrfconnectsdk which uses TWIM peripheral.  making sure easy dma is off</title><link>https://devzone.nordicsemi.com/thread/444785?ContentTypeID=1</link><pubDate>Wed, 06 Sep 2023 17:46:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b0e52b87-60ec-41d2-a647-fe08c0534f83</guid><dc:creator>weightwatcherphil</dc:creator><description>&lt;p&gt;if i invoke the nrfx PWM as follows does zephyr power managment even know about it?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;#include &amp;lt;stdio.h&amp;gt;
#include &amp;lt;string.h&amp;gt;
#include &amp;lt;nrfx_pwm.h&amp;gt;
#include &amp;lt;zephyr/drivers/gpio.h&amp;gt;


//#include &amp;lt;zephyr.h&amp;gt;


#include &amp;lt;zephyr/device.h&amp;gt;
#include &amp;lt;zephyr/devicetree.h&amp;gt;
#include &amp;lt;errno.h&amp;gt;
#include &amp;lt;zephyr/drivers/led.h&amp;gt;
#include &amp;lt;zephyr/sys/util.h&amp;gt;
#include &amp;lt;zephyr/kernel.h&amp;gt;

#include &amp;quot;glove_led.h&amp;quot;


#define TOP_VALUE 1000

#define PIN_LED_RED 46 //_PINNUM(1,14)
#define PIN_LED_GREEN 47 //_PINNUM(1,15)
#define PIN_LED_BLUE 44 //_PINNUM(1,12)


static nrfx_pwm_t m_pwm1 = NRFX_PWM_INSTANCE(1);
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt; GLOVE_DEBUG_LOG( GLOVE_LOG_INFO, TAG, &amp;quot;glove_led_init&amp;quot; );

    
    // Start clock for accurate frequencies
    NRF_CLOCK-&amp;gt;TASKS_HFCLKSTART = 1; 
    // Wait for clock to start
    while(NRF_CLOCK-&amp;gt;EVENTS_HFCLKSTARTED == 0) 
        ;

    
    
    nrfx_pwm_config_t const config1 =
    {
        .output_pins =
        {
            PIN_LED_RED,            // channel 0 Red LED
            PIN_LED_GREEN,          // channel 1 Green LED
            PIN_LED_BLUE,           // channel 2 Blue LED
            NRFX_PWM_PIN_NOT_USED,  // channel 3 
        },
        .irq_priority = NRFX_PWM_DEFAULT_CONFIG_IRQ_PRIORITY,
        .base_clock   = NRF_PWM_CLK_500kHz,
        .count_mode   = NRF_PWM_MODE_UP,
        .top_value    = TOP_VALUE,
        .load_mode    = NRF_PWM_LOAD_INDIVIDUAL,
        .step_mode    = NRF_PWM_STEP_AUTO
        //.skip_gpio_cfg = true,
        //.skip_psel_cfg =false
    };



	
// remove interrupts to see if i can get it to shutdown.
 //   printf(&amp;quot; perform PWM1_IRQn connect\n&amp;quot;);
//	IRQ_DIRECT_CONNECT(PWM1_IRQn,0,led_pwm_isr_handler,0);

	uint32_t out_pins = {PIN_LED_RED,PIN_LED_GREEN,PIN_LED_BLUE,NRFX_PWM_PIN_NOT_USED};
	nrf_pwm_pins_set	(&amp;amp;m_pwm1,out_pins);    




    // Init PWM with handler
    //nrfx_pwm_init(&amp;amp;m_pwm1, &amp;amp;config1, led_pwm_isr_handler, NULL);
    // remove interrupts to see if i can get it to shutdown correctly
    nrfx_pwm_init(&amp;amp;m_pwm1, &amp;amp;config1, NULL, NULL);
    led_pwm_is_avaiable=1;
	
    
//  nrfx_pwm_simple_playback(&amp;amp;m_pwm1, &amp;amp;seq_off, 1, NRFX_PWM_FLAG_LOOP);
//	glove_led_set( GLOVE_LED_COLOR_RED, true, 100, 100, 1 );
    printf(&amp;quot;glove led init complete\n&amp;quot;);
}
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;and will this turn it off ?&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;  // if you call the nrfx_pwm_stop function with true it 
    // is possible for it to wait
    // in an infinite loop.
    led_pwm_is_avaiable=0;
    k_sleep( K_MSEC( 100 ) );// phil_hunting - time to stop trying to turn on the ledsd
    nrfx_pwm_stop(&amp;amp;m_pwm1,false);
    if (nrfx_pwm_is_stopped(&amp;amp;m_pwm1)) {
        printf(&amp;quot;led pwm is stopped\n&amp;quot;);
    }
    else {
        printf(&amp;quot;led pwm failed to stop\n&amp;quot;);
    }

    nrfx_pwm_uninit(&amp;amp;m_pwm1);
    
    // TODO:  do we have to wait for it to shut off
	return 0;
}
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;when i run the above code i get&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;div&gt;
&lt;div&gt;&lt;span&gt;&amp;nbsp; &lt;/span&gt;&lt;span&gt;printf&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;&amp;quot;led pwm failed to stop&lt;/span&gt;&lt;span&gt;\n&lt;/span&gt;&lt;span&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;and&lt;span&gt;&amp;nbsp;i have no idea why.&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;thanks for all your help.&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;phil&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: turning off i2c in nrfconnectsdk which uses TWIM peripheral.  making sure easy dma is off</title><link>https://devzone.nordicsemi.com/thread/444782?ContentTypeID=1</link><pubDate>Wed, 06 Sep 2023 17:40:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0da6981b-2a7b-478b-8b0d-3cb123655f9a</guid><dc:creator>weightwatcherphil</dc:creator><description>&lt;p&gt;i am using ncs v2.4.0&lt;/p&gt;
&lt;p&gt;nrf5340&lt;/p&gt;
&lt;p&gt;i tried using the power management to call NRF_REGULATORS directly but it said it failed.&lt;/p&gt;
&lt;p&gt;I have two PWM instances running using nrfx because i need to use all four channels of the PWM&amp;nbsp;&lt;/p&gt;
&lt;p&gt;and zephyr only uses one. channel.&lt;/p&gt;
&lt;p&gt;so I am stuck manually shutting things down.for the moment until i can get PM to work.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;i am still puzzled why easy DMA needs to be off since in regulators off the HF CLK to my PWM is off.&amp;nbsp; how can it do anything ?&lt;/p&gt;
&lt;p&gt;thanks&lt;/p&gt;
&lt;p&gt;phil&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: turning off i2c in nrfconnectsdk which uses TWIM peripheral.  making sure easy dma is off</title><link>https://devzone.nordicsemi.com/thread/444636?ContentTypeID=1</link><pubDate>Wed, 06 Sep 2023 07:43:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:231349b5-2e32-45ec-91c2-ed227ee4dd34</guid><dc:creator>runsiv</dc:creator><description>&lt;p&gt;Hi,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Which version of the SDK are you using and which device are you using?&lt;/p&gt;
&lt;p&gt;The easyDMA is only enabled if there is an ongoing transacation, so it should not be any need to handle only the easyDMA manually.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Normally I would rather use the &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/zephyr/services/pm/device.html#pm-device-runtime-pm"&gt;Power Managment API &lt;/a&gt;then calling NRF_REGULATORS directly. We also have this blog where they explain a bit regarding the &lt;a href="https://devzone.nordicsemi.com/nordic/nordic-blog/b/blog/posts/optimizing-power-on-nrf53-designs"&gt;power management API&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Regards&lt;/p&gt;
&lt;p&gt;Runar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>