<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic How to use clockMan and pwrMan PE components with debug console in Kinetis Microcontrollers</title>
    <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/How-to-use-clockMan-and-pwrMan-PE-components-with-debug-console/m-p/518566#M32658</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;BR /&gt;Hello, I'm trying to do some simple clock and power mode changes. I would like to be able to go between Run, HSRun, VLPRun and VLPWait.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Using the FRDM-K22 board, KSDK 1.3, and KDS 3.2. When creating the KDS project I selected the pre-configured "board" file which provided a pre-configured clockMan1 component with 6 clock configurations. Just to get to something that works, I tried to get the current clock configuration using:&lt;/P&gt;&lt;P&gt;ret =&amp;nbsp; CLOCK_SYS_GetCurrentConfiguration()&lt;/P&gt;&lt;P&gt;and then transitioning to a new clock config using&lt;/P&gt;&lt;P&gt;CLOCK_SYS_SetConfiguration()&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I do think I am transitioning to the new clock configurations but CLOCK_SYS_GetCurrentConfiguration() always returns zero. Also, the debug console baud rate does not track with the clock configurations. It is supposed to do that. right?&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also trying to change power modes using the pwrMan component to go between Run mode, High speed run mode, Very low power run mode, and Very low power wait mode.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Just to get something working, I tried to get the current power mode configuration using&lt;/P&gt;&lt;P&gt;current_mode = POWER_SYS_GetCurrentMode();&lt;/P&gt;&lt;P&gt;But this never returns anything. Also tried changing the power mode using&lt;/P&gt;&lt;P&gt;ret = POWER_SYS_SetMode()&lt;/P&gt;&lt;P&gt;but I'm not sure if its working because POWER_SYS_GetCurrentMode(); doesn't return anything for me.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've attached my project. The code in main was just an attempt to get anything to work.&lt;/P&gt;&lt;P&gt;So my questions are:&lt;/P&gt;&lt;P&gt;Q1. How do i get the debug console to have the same baud rate when jumping between Run, HSRun and VLPRun?&lt;/P&gt;&lt;P&gt;Q2. Why does CLOCK_SYS_GetCurrentConfiguration() always return zero.&lt;/P&gt;&lt;P&gt;Q3. Why does POWER_SYS_GetCurrentMode() seem not to return anything?&lt;/P&gt;&lt;P&gt;Q4. Is it possible to take what I have there, delete my code in main, and write a few line of code that shows how to transition between clock and power modes and have the debug console baud rate also track with the changes?&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you in advance!&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;Mark&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Original Attachment has been moved to: &lt;A _jive_internal="true" href="https://community.nxp.com/docs/DOC-337459"&gt;Clock_and_Power_K22.zip&lt;/A&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 10 Jun 2016 20:09:19 GMT</pubDate>
    <dc:creator>marks</dc:creator>
    <dc:date>2016-06-10T20:09:19Z</dc:date>
    <item>
      <title>How to use clockMan and pwrMan PE components with debug console</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/How-to-use-clockMan-and-pwrMan-PE-components-with-debug-console/m-p/518566#M32658</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;BR /&gt;Hello, I'm trying to do some simple clock and power mode changes. I would like to be able to go between Run, HSRun, VLPRun and VLPWait.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Using the FRDM-K22 board, KSDK 1.3, and KDS 3.2. When creating the KDS project I selected the pre-configured "board" file which provided a pre-configured clockMan1 component with 6 clock configurations. Just to get to something that works, I tried to get the current clock configuration using:&lt;/P&gt;&lt;P&gt;ret =&amp;nbsp; CLOCK_SYS_GetCurrentConfiguration()&lt;/P&gt;&lt;P&gt;and then transitioning to a new clock config using&lt;/P&gt;&lt;P&gt;CLOCK_SYS_SetConfiguration()&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I do think I am transitioning to the new clock configurations but CLOCK_SYS_GetCurrentConfiguration() always returns zero. Also, the debug console baud rate does not track with the clock configurations. It is supposed to do that. right?&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also trying to change power modes using the pwrMan component to go between Run mode, High speed run mode, Very low power run mode, and Very low power wait mode.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Just to get something working, I tried to get the current power mode configuration using&lt;/P&gt;&lt;P&gt;current_mode = POWER_SYS_GetCurrentMode();&lt;/P&gt;&lt;P&gt;But this never returns anything. Also tried changing the power mode using&lt;/P&gt;&lt;P&gt;ret = POWER_SYS_SetMode()&lt;/P&gt;&lt;P&gt;but I'm not sure if its working because POWER_SYS_GetCurrentMode(); doesn't return anything for me.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've attached my project. The code in main was just an attempt to get anything to work.&lt;/P&gt;&lt;P&gt;So my questions are:&lt;/P&gt;&lt;P&gt;Q1. How do i get the debug console to have the same baud rate when jumping between Run, HSRun and VLPRun?&lt;/P&gt;&lt;P&gt;Q2. Why does CLOCK_SYS_GetCurrentConfiguration() always return zero.&lt;/P&gt;&lt;P&gt;Q3. Why does POWER_SYS_GetCurrentMode() seem not to return anything?&lt;/P&gt;&lt;P&gt;Q4. Is it possible to take what I have there, delete my code in main, and write a few line of code that shows how to transition between clock and power modes and have the debug console baud rate also track with the changes?&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you in advance!&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;Mark&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Original Attachment has been moved to: &lt;A _jive_internal="true" href="https://community.nxp.com/docs/DOC-337459"&gt;Clock_and_Power_K22.zip&lt;/A&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Jun 2016 20:09:19 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/How-to-use-clockMan-and-pwrMan-PE-components-with-debug-console/m-p/518566#M32658</guid>
      <dc:creator>marks</dc:creator>
      <dc:date>2016-06-10T20:09:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to use clockMan and pwrMan PE components with debug console</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/How-to-use-clockMan-and-pwrMan-PE-components-with-debug-console/m-p/518567#M32659</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Mark,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There are some conditions that need to be considered when transitioning between Clock configurations and Power Management modes.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There is an example in KSDK folder that could be helpful for you: &amp;lt;KSDK_1_3_PATH&amp;gt;\examples\frdmk22f\demo_apps\power_manager_hal_demo\kds&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For Clock manager, you can install a callback that will be called after and/or before switching between clock modes, in this callback, Debug Console should be de-initialized (when callback is called Before switching) and should be initialized again (when callback is called after new mode is set), next code snippet shows this:&lt;/P&gt;&lt;PRE __default_attr="c++" __jive_macro_name="code" class="_jivemacro_uid_14659428270252951 jive_macro_code jive_text_macro" data-renderedposition="216_8_1192_304" jivemacro_uid="_14659428270252951" modifiedtitle="true"&gt;&lt;P&gt;clock_manager_error_code_t debugCallback(clock_notify_struct_t *notify,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; void* callbackData)&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; clock_manager_error_code_t result = kClockManagerSuccess;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; switch (notify-&amp;gt;notifyType)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; case kClockManagerNotifyBefore:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Received "pre" message&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DbgConsole_DeInit();&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; break;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; case kClockManagerNotifyRecover: // Received "recover" message&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; case kClockManagerNotifyAfter:&amp;nbsp;&amp;nbsp;&amp;nbsp; // Received "post" message&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dbg_uart_reinit();&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; break;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; default:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; result = kClockManagerError;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; break;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return result;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;In the dbg_uart_reinit function, console is initialized and obtains the new clock value for uart module (that was modified according the clock configuration used).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For clock and low power modes, it is neccessary to define a clock manager user configuration structure and power manager user configuration structure as well:&lt;/P&gt;&lt;PRE __default_attr="c++" __jive_macro_name="code" class="_jivemacro_uid_14659430965268953 jive_macro_code jive_text_macro" data-renderedposition="598_8_1192_96" jivemacro_uid="_14659430965268953" modifiedtitle="true"&gt;&lt;P&gt;const clock_manager_user_config_t * g_defaultClockConfigurations[] = {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; NULL,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;amp;g_defaultClockConfigVlpr,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;amp;g_defaultClockConfigRun,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;amp;g_defaultClockConfigHsrun,&lt;/P&gt;&lt;P&gt;};&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="c++" __jive_macro_name="code" class="_jivemacro_uid_14659431088212959 jive_macro_code jive_text_macro" data-renderedposition="720_8_1192_272" jivemacro_uid="_14659431088212959" modifiedtitle="true"&gt;&lt;P&gt;power_manager_user_config_t const *powerConfigs[] =&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;amp;runConfig,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;amp;waitConfig,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;amp;stopConfig,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;amp;vlprConfig,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;amp;vlpwConfig,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;amp;vlpsConfig,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;amp;llsConfig,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;amp;vlls0Config,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;amp;vlls1Config,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;amp;vlls2Config,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;amp;vlls3Config,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;amp;hsrunConfig&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; };&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;In order to be able to return the current clock/low power configuration that is set.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would also like to refer to this useful document that talks more about Clock configurations and Low Power Modes on KSDK 1.3: &lt;A href="https://community.nxp.com/docs/DOC-329554" rel="nofollow noopener noreferrer" target="_blank"&gt;KSDK Clock configurations and Low Power modes with Processor Expert&lt;/A&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope you can find it useful.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;Isaac&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Jun 2016 22:29:22 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/How-to-use-clockMan-and-pwrMan-PE-components-with-debug-console/m-p/518567#M32659</guid>
      <dc:creator>isaacavila</dc:creator>
      <dc:date>2016-06-14T22:29:22Z</dc:date>
    </item>
  </channel>
</rss>

