<?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>Need help to Initialize the below mentioned API</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/79406/need-help-to-initialize-the-below-mentioned-api</link><description>I need to call the API: clock_control_on( const struct device *dev, clock_control_subsys_t sys) 
 
 
 located at the SDK path ncs\v1.6.1\zephyr\drivers\clock_control. 
 
 Can you kindly help me on how i need to initialize the API arguments * dev and sys</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 20 Sep 2021 07:11:09 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/79406/need-help-to-initialize-the-below-mentioned-api" /><item><title>RE: Need help to Initialize the below mentioned API</title><link>https://devzone.nordicsemi.com/thread/330157?ContentTypeID=1</link><pubDate>Mon, 20 Sep 2021 07:11:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5c929198-6409-45eb-960e-11247161beb3</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;The following code can be used to retreive the device struct for clock:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;	const struct device *clock;
	
	clock = device_get_binding(&amp;quot;CLOCK&amp;quot;);
	if (clock == NULL) {
		printk(&amp;quot;Clock device not found\n\r&amp;quot;);
	}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;But like mentioned earlier, the clock control driver is already being invoked by the system on startup, and I&amp;#39;m honestly not sure if it it supports multiple users - that is something I need to look into. Could you let me know what you are trying achieve with this?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Need help to Initialize the below mentioned API</title><link>https://devzone.nordicsemi.com/thread/329709?ContentTypeID=1</link><pubDate>Thu, 16 Sep 2021 06:04:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:62d0b843-bb7a-4028-a74f-94012c7531ef</guid><dc:creator>Swati kumari</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Thanks&amp;nbsp; for the quick response!!&lt;/p&gt;
&lt;div&gt;
&lt;div&gt;I need to test an API &lt;em&gt;&lt;strong&gt;static inline int clock_control_on(const struct device *dev, clock_control_subsys_t sys)&lt;/strong&gt;&lt;/em&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div class="copy-paste-block"&gt;Can you kindly inform me in the context of this API, &lt;strong&gt;clock_control_on( )&lt;/strong&gt;, how i can create user handle for &lt;em&gt;&lt;strong&gt;device *dev &lt;/strong&gt;so that this API is successfully executed.?&lt;/em&gt;&lt;/div&gt;
&lt;div class="copy-paste-block"&gt;&lt;em&gt;That is i need to know what to populate in &lt;strong&gt;device *dev&lt;/strong&gt; for the context of &lt;/em&gt;&lt;strong&gt;clock_control_on( ).?&lt;/strong&gt;&lt;/div&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Need help to Initialize the below mentioned API</title><link>https://devzone.nordicsemi.com/thread/329576?ContentTypeID=1</link><pubDate>Wed, 15 Sep 2021 10:37:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:046e77f7-bfce-474f-975b-ad9d6f69d3e3</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Are you looking to use an existing zephyr driver, or create a new one? Either way, the structure will be populated by the&amp;nbsp;&lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/1.6.1/zephyr/reference/drivers/index.html#driver-apis"&gt;DEVICE_DEFINE()/DEVICE_DT_DEFINE()&lt;/a&gt; macro in the driver implementation, and the pointer to this structure is then retrieved by the main application through &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/1.6.1/zephyr/reference/drivers/index.html#c.DEVICE_DT_GET"&gt;DEVICE_GET()/DEVICE_DT_GET()&lt;/a&gt; or &lt;code&gt;&lt;span&gt;device_&lt;span&gt;get_binding(&amp;lt;device name&amp;gt;)&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;span&gt;&lt;/span&gt;.&lt;/p&gt;
&lt;p&gt;As an example, you may take a look at the Zephyr fade_led sample (/zephyr/samples/fade_led) to see how it invokes the nrf52&amp;#39;s PWM driver:&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Getting the device object from the main application&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/pastedimage1631701986527v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&amp;quot;PWM_0&amp;quot; label in &amp;lt;build dir&amp;gt;/zephyr/zephyr.dts&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/pastedimage1631702147874v2.png" alt=" " /&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Device object definition in /zephyr/drivers/pwm/pwm_nrfx.c&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/pastedimage1631702238212v3.png" alt=" " /&gt;&lt;/strong&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Need help to Initialize the below mentioned API</title><link>https://devzone.nordicsemi.com/thread/329525?ContentTypeID=1</link><pubDate>Wed, 15 Sep 2021 04:51:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b0833e93-e918-4d29-b6b6-cb0bb943ebff</guid><dc:creator>Swati kumari</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Thanks for the response!!&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;div&gt;
&lt;div&gt;My query was, The &amp;quot;device* dev&amp;quot; structure pointer is used in many other APIs, so how do i create user handles to populate this structure pointer before passing it off as an argument to any API.?&lt;/div&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Need help to Initialize the below mentioned API</title><link>https://devzone.nordicsemi.com/thread/328633?ContentTypeID=1</link><pubDate>Wed, 08 Sep 2021 13:49:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9a235c20-e555-4a6c-84c7-bcc5ad7879a6</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;The driver is already invoked on startup to enable the LF clock for the Zephyr OS so I don&amp;#39;t think it should be neccessary to invoke the driver in the application code. You can use the clock kconfig symbols if you wish to change the LF clock configuration (LFXO is selected by default):&lt;/p&gt;
&lt;p&gt;&lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/1.6.1/kconfig/CONFIG_CLOCK_CONTROL_NRF_ACCURACY.html?highlight=config_clock_control#cmdoption-arg-CONFIG_CLOCK_CONTROL_NRF_ACCURACY"&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.6.1/kconfig/CONFIG_CLOCK_CONTROL_NRF_K32SRC_XTAL.html?highlight=config_clock_control#cmdoption-arg-CONFIG_CLOCK_CONTROL_NRF_K32SRC_XTAL"&gt;CONFIG_CLOCK_CONTROL_NRF_K32SRC_XTAL&lt;/a&gt; (=y by default)&lt;/p&gt;
&lt;p&gt;&lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/1.6.1/kconfig/CONFIG_CLOCK_CONTROL_NRF_K32SRC_RC.html?highlight=config_clock_control#cmdoption-arg-CONFIG_CLOCK_CONTROL_NRF_K32SRC_RC"&gt;CONFIG_CLOCK_CONTROL_NRF_K32SRC_RC&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;You can also use the the following APIs to request and release the HFXO if you have a Bluetooth application:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/1.6.1/nrfxlib/mpsl/doc/api.html#c.mpsl_clock_hfclk_request"&gt;mpsl_clock_hfclk_request()&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;mpsl_clock_hfclk_release()&lt;/p&gt;
&lt;p&gt;But these should only be used if you need a high accuracy HF clock for a particular task. The idle current will stay at ~200 uA if you don&amp;#39;t call mpsl_clock_hfclk_release() after you are done with it.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Vidar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>