<?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>nrf5340 I2C peripheral power management query</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/113915/nrf5340-i2c-peripheral-power-management-query</link><description>Hi, I have a question regarding the nRF power management APIs. I&amp;#39;m trying to implement power management in my code, and I found that the pm_device_action_run() API can be used to manage peripheral power consumption by putting the peripheral into a PM_DEVICE_ACTION_SUSPEND</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 14 Aug 2024 11:55:04 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/113915/nrf5340-i2c-peripheral-power-management-query" /><item><title>RE: nrf5340 I2C peripheral power management query</title><link>https://devzone.nordicsemi.com/thread/498264?ContentTypeID=1</link><pubDate>Wed, 14 Aug 2024 11:55:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2d02ad4b-53fe-46e8-8c62-4d99eb2bd515</guid><dc:creator>Susheel Nuguru</dc:creator><description>[quote user=""]Is it necessary to call the &lt;code&gt;pm_device_action_run()&lt;/code&gt; API to put the I2C peripheral to sleep, or is the power management of I2C peripherals already handled by the I2C driver provided by Zephyr?[/quote]
&lt;p&gt;When you get an error of -120 that the driver is already in that requested state when you run&amp;nbsp;&lt;span&gt;pm_device_action_run, then most likely&amp;nbsp;pm_device_action_run was run before. The&amp;nbsp;zephyr\drivers\i2c\i2c_nrfx_twim.c implements the pm_device plugins, so no, it does not handle the RTOS specific power management by itself.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I would suggest you to put a breakpoint in&amp;nbsp;&lt;/span&gt;twim_nrfx_pm_action function and run your application in debugger to see if there has been any other calls to&amp;nbsp;twim_nrfx_pm_action prior to you calling&amp;nbsp;&lt;span&gt;pm_device_action_run&amp;nbsp;. If yes, then check the function call stack to understand the context of when it was called before.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>