<?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>How to call &amp;quot;clock_control_off(const struct device *dev, clock_control_subsys_t sys)&amp;quot; on LFCLK</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/81558/how-to-call-clock_control_off-const-struct-device-dev-clock_control_subsys_t-sys-on-lfclk</link><description>Hi, 
 
 If i need to call zephyr driver API clock_control_off( ) present in zephyr\include\drivers\clock_control.h on LFCLK. How can I do it,.? As an example, to populate the argument &amp;#39;*dev&amp;#39; in Do I Use something like: 
 
 
 Will this give me dev struct</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 16 Nov 2021 14:29:36 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/81558/how-to-call-clock_control_off-const-struct-device-dev-clock_control_subsys_t-sys-on-lfclk" /><item><title>RE: How to call "clock_control_off(const struct device *dev, clock_control_subsys_t sys)" on LFCLK</title><link>https://devzone.nordicsemi.com/thread/339265?ContentTypeID=1</link><pubDate>Tue, 16 Nov 2021 14:29:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5a5492ba-da71-48e7-a4c3-feb120c690a6</guid><dc:creator>Priyanka</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;It is possible like we mentioned earlier, to turn on the HFCLK or turn off the LFCLK (which is not recommended as it will result in an error), but you do not specify the frequency requirement. You can only specify or configure the source of your clock, i.e. external crystal, internal RC, etc.&lt;/p&gt;
&lt;p&gt;Depending on your requirement, the system will automatically assign the required, based on your peripheral.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The peripherals connected will automatically request the required clock type from the CLOCK peripheral based on the configuration of the peripheral. This can be seen mentioned in the &lt;a href="https://infocenter.nordicsemi.com/topic/ps_nrf52840/clock.html?cp=4_0_0_4_3"&gt;CLOCK chapter&lt;/a&gt;.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I hope this answers your doubts related to the ticket and in case of any different queries kindly open a new ticket.&lt;/p&gt;
&lt;p&gt;Kind Regards,&lt;/p&gt;
&lt;p&gt;Priyanka&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to call "clock_control_off(const struct device *dev, clock_control_subsys_t sys)" on LFCLK</title><link>https://devzone.nordicsemi.com/thread/338900?ContentTypeID=1</link><pubDate>Mon, 15 Nov 2021 04:53:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:dee0dddb-e884-483c-9efd-347d024766e6</guid><dc:creator>Ubaid_M</dc:creator><description>&lt;p&gt;Hello Priyanka,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thank you, this helps.&lt;br /&gt;Please find as in the clock tree for my nRF board:&lt;/p&gt;
&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/pastedimage1636951838928v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Now, moving ahead, suppose that if I want to use PCLK16M from HFCLK for a peripheral, how can I get that..?&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;Similarly, if I want to use PCLK32KI from LFCLK for a timer perhaps, how can I get that frequency..?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to call "clock_control_off(const struct device *dev, clock_control_subsys_t sys)" on LFCLK</title><link>https://devzone.nordicsemi.com/thread/338818?ContentTypeID=1</link><pubDate>Fri, 12 Nov 2021 14:01:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4b601b70-523f-40ec-b5e3-05000ff94a22</guid><dc:creator>Priyanka</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;1. In order to turn the HFCLK on you could look into&lt;a href="https://github.com/nrfconnect/sdk-nrf/blob/main/samples/bluetooth/direct_test_mode/src/dtm.c#L497-L527"&gt; this code&lt;/a&gt;. I guess &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/79406/need-help-to-initialize-the-below-mentioned-api/329525#:~:text=You%20can%20also,mpsl_clock_hfclk_release()"&gt;this thread&lt;/a&gt; could also prove helpful to your query.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;2. Regarding how to populate the&amp;nbsp;&lt;em&gt;clock_control_off(const struct device *dev, clock_control_subsys_t sys)&amp;nbsp;&lt;/em&gt;, &lt;strong&gt;*dev&lt;/strong&gt; is defined the same way as you had mentioned in the ticket. But&lt;em&gt;&lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/zephyr/reference/peripherals/clock_control.html?highlight=clock_control_subsys#c.CLOCK_CONTROL_SUBSYS_ALL"&gt; clock_control_subsys_t&lt;/a&gt;&amp;nbsp;&lt;/em&gt;is a type with which you can define a clock controller sub-system. You could take a look at &lt;a href="https://github.com/zephyrproject-rtos/zephyr/tree/main/samples/drivers/clock_control_litex#:~:text=clock_control_on(dev%2C%20sub_system)"&gt;this example&lt;/a&gt; to understand the format or method better.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Moreover, stopping the LFCLK is not supported and doing the&amp;nbsp;&lt;em&gt;clock_control_off( )&amp;nbsp;&lt;/em&gt; on LFCLK will result in the error code &lt;a href="https://github.com/nrfconnect/sdk-nrf/blob/7f8ba175c257a1d0387382d4387b41f58de02b19/tests/drivers/clock_control/clock_control_mpsl/src/test_clock_control.c#L415"&gt;-ENOTSUP.&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;I hope this was helpful &lt;span class="emoticon" data-url="https://devzone.nordicsemi.com/cfs-file/__key/system/emoji/1f642.svg" title="Slight smile"&gt;&amp;#x1f642;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Kind Regards,&lt;/p&gt;
&lt;p&gt;Priyanka&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to call "clock_control_off(const struct device *dev, clock_control_subsys_t sys)" on LFCLK</title><link>https://devzone.nordicsemi.com/thread/338678?ContentTypeID=1</link><pubDate>Fri, 12 Nov 2021 05:36:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:82c9e0de-7302-4737-afcd-85c531cd722d</guid><dc:creator>Ubaid_M</dc:creator><description>&lt;p&gt;Hi Priyanka,&lt;br /&gt;&lt;br /&gt;I want to understand which zephyr driver APIs can be used to control clocks, both HFCLK and LFCLK.&lt;br /&gt;I understand the configurations and also that LFCLK is normally kept on.&lt;br /&gt;&lt;br /&gt;I want to know if needed to to turn off/on, which zephyr APIs can be used.?&lt;br /&gt;And How.? (how to populate and pass the arguments)&lt;/p&gt;
[quote userid="108934" url="~/f/nordic-q-a/81558/how-to-call-clock_control_off-const-struct-device-dev-clock_control_subsys_t-sys-on-lfclk/338559#338559"]&lt;p&gt;How do I populate the arguments &amp;#39;*dev&amp;#39; &amp;amp; &amp;#39;sys&amp;#39; to call&lt;br /&gt;&amp;quot;clock_control_off(const struct device *dev, clock_control_subsys_t sys)&amp;quot;&lt;/p&gt;
&lt;p&gt;on LFCLK..?&lt;/p&gt;[/quote]&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to call "clock_control_off(const struct device *dev, clock_control_subsys_t sys)" on LFCLK</title><link>https://devzone.nordicsemi.com/thread/338576?ContentTypeID=1</link><pubDate>Thu, 11 Nov 2021 13:05:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2e370c64-7179-472c-99e3-1df0fbdc829f</guid><dc:creator>Priyanka</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Could you specify as to what exactly you wish to implement this for? As I mentioned earlier,&amp;nbsp;&lt;/p&gt;
[quote user="PriyankaKesav"]the LFCLK is normally kept on since it is needed by the Zephyr Scheduler and bluetooth Stack. [/quote]&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to call "clock_control_off(const struct device *dev, clock_control_subsys_t sys)" on LFCLK</title><link>https://devzone.nordicsemi.com/thread/338559?ContentTypeID=1</link><pubDate>Thu, 11 Nov 2021 12:23:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b594e9ca-7b14-4fb4-9cef-2576b912e06e</guid><dc:creator>Ubaid_M</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Thanks for the info,&lt;br /&gt;I am aware of the configurations, but my question was not that,&lt;br /&gt;I rather want to know:&lt;/p&gt;
[quote userid="108934" url="~/f/nordic-q-a/81558/how-to-call-clock_control_off-const-struct-device-dev-clock_control_subsys_t-sys-on-lfclk"]If i need to call zephyr driver API&amp;nbsp;clock_control_off( ) present in&amp;nbsp;zephyr\include\drivers\clock_control.h on LFCLK.&lt;br /&gt;How can I do it,.?[/quote]
&lt;p&gt;as in&lt;/p&gt;
&lt;p&gt;How do I populate the arguments &amp;#39;*dev&amp;#39; &amp;amp; &amp;#39;sys&amp;#39; to call&lt;br /&gt;&amp;quot;clock_control_off(const struct device *dev, clock_control_subsys_t sys)&amp;quot;&lt;/p&gt;
&lt;p&gt;on LFCLK..?&lt;/p&gt;
&lt;h1 class="name"&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/h1&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to call "clock_control_off(const struct device *dev, clock_control_subsys_t sys)" on LFCLK</title><link>https://devzone.nordicsemi.com/thread/338507?ContentTypeID=1</link><pubDate>Thu, 11 Nov 2021 09:27:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8903b2df-96af-4c6e-aed1-8f3b2ddc411f</guid><dc:creator>Priyanka</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;The LFCLK is already on by default and this is done during startup for the Zephyr OS. If you need to do any changes, you could use the kconfig statements&lt;/p&gt;
&lt;p&gt;&lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/1.7.1/kconfig/CONFIG_CLOCK_CONTROL_NRF_ACCURACY.html"&gt;CONFIG_CLOCK_CONTROL_NRF_ACCURACY&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/1.7.1/kconfig/CONFIG_CLOCK_CONTROL_NRF_K32SRC_XTAL.html"&gt;CONFIG_CLOCK_CONTROL_NRF_K32SRC_XTAL&lt;/a&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;(=y by default)&lt;/p&gt;
&lt;p&gt;&lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/1.7.1/kconfig/CONFIG_CLOCK_CONTROL_NRF_K32SRC_RC.html"&gt;CONFIG_CLOCK_CONTROL_NRF_K32SRC_RC&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;But the LFCLK is normally kept on since it is needed by the Zephyr Scheduler and bluetooth Stack. So if you plan to deselect the XTAL source, you need to enable RC oscillator, since you should select one LF clock source. You could try referring to &lt;a href="https://infocenter.nordicsemi.com/topic/ps_nrf52840/clock.html?cp=4_0_0_4_3_1#concept_xkj_np1_2r"&gt;LFCLK controller&lt;/a&gt; documentation for more details.&lt;/p&gt;
&lt;p&gt;Generally, including the required kconfig statements in your prj.conf file should do the trick and you do not have to modify or set any code.&lt;/p&gt;
&lt;p&gt;Kind Regards,&lt;/p&gt;
&lt;p&gt;Priyanka&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to call "clock_control_off(const struct device *dev, clock_control_subsys_t sys)" on LFCLK</title><link>https://devzone.nordicsemi.com/thread/338298?ContentTypeID=1</link><pubDate>Wed, 10 Nov 2021 08:06:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8d0adcbb-c941-4024-9efa-1117cd17241c</guid><dc:creator>Ubaid_M</dc:creator><description>&lt;p&gt;Should i declare a new device in project&amp;#39;s zephyr.dts file for LFCLK label..?&lt;br /&gt;As in:&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;		clock: clock@40000000 {
			compatible = &amp;quot;nordic,nrf-clock&amp;quot;;
			reg = &amp;lt; 0x40000000 0x1000 &amp;gt;;
			interrupts = &amp;lt; 0x0 0x1 &amp;gt;;
			status = &amp;quot;okay&amp;quot;;
			label = &amp;quot;LFCLK&amp;quot;;
		};&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;What are the changes I need to consider to LFCLK device declaration as in above.?&lt;br /&gt;And how do I set the argument &amp;quot;clock_control_subsys_t sys&amp;quot; for LFCLK.?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>