<?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>Kinetis MicrocontrollersのトピックRe: FlexIO Set source clock API difference</title>
    <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/FlexIO-Set-source-clock-API-difference/m-p/782984#M47673</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The KL17 reference manual shows the FlexIO module clock source below:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_1.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/74478i64A0DAF33C02F410/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_1.png" alt="pastedImage_1.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;MCGPCLK is clock output from IRC48M (48MHz);&lt;/P&gt;&lt;P&gt;MCGIRCLK is clock output from IRC8M (IRC8M/2M internal reference clock divided by lirc_div2);&lt;/P&gt;&lt;P&gt;OSCERCLK is System oscillator output sourced from OSCCLK that may clock some on-chip modules (frequence same with external crystal/oscillator)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When customer call &lt;SPAN style="font-family: 'andale mono', monospace;"&gt;CLOCK_SetFlexio0Clock&lt;/SPAN&gt;() function, customer need to clear know the FlexIO clock source frequency.&lt;/P&gt;&lt;P&gt;Such as FlexIO_i2c [interrupt_i2c_transfer] demo using MCGPCLK as clock source, which is fixed to 48MHz.&lt;/P&gt;&lt;P&gt;So, the FLEXIO_CLOCK_FREQUENCY macro definition value is 48MHz.&lt;/P&gt;&lt;P&gt;#define FLEXIO_CLOCK_FREQUENCY 48000000U&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If customer change to use another clock source, customer need to set the correct clock frequency at FLEXIO_CLOCK_FREQUENCY macro.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for the attention.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Have a great day,&lt;BR /&gt;Mike&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-----------------------------------------------------------------------------------------------------------------------&lt;BR /&gt;Note: If this post answers your question, please click the Correct Answer button. Thank you!&lt;BR /&gt;-----------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 12 Oct 2018 08:12:31 GMT</pubDate>
    <dc:creator>Hui_Ma</dc:creator>
    <dc:date>2018-10-12T08:12:31Z</dc:date>
    <item>
      <title>FlexIO Set source clock API difference</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/FlexIO-Set-source-clock-API-difference/m-p/782983#M47672</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Setting the FlexIO source clock is required in order to&amp;nbsp;support&amp;nbsp;a desired SCL clock rate range (as explained in&amp;nbsp;&lt;A href="https://community.nxp.com/thread/431007" rel="nofollow noopener noreferrer" target="_blank"&gt;Problem with clock rate in FlexIO I2C&lt;/A&gt;&amp;nbsp;).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the following SDK functions, do the&amp;nbsp;source clock arguments refer to the same clock? If so, is there a way to go from the 2-bit "src" in&amp;nbsp;&lt;SPAN style="font-family: 'andale mono', monospace;"&gt;CLOCK_SetFlexio0Clock&lt;/SPAN&gt;&amp;nbsp;defined in the MCU datasheet to Hz? Similar to using &lt;SPAN style="font-family: 'andale mono', monospace;"&gt;CLOCK_GetFreq(clock_name_t clockName)&lt;/SPAN&gt;.&lt;/P&gt;&lt;P&gt;Secondly,&amp;nbsp;does a deinit and reinit of the FlexIO bus to change the SCL clock rate require a&amp;nbsp;call both functions (e.g. when changing the source clock to achieve a frequency outside the current range)?&lt;/P&gt;&lt;PRE class="language-c line-numbers"&gt;&lt;CODE&gt;&lt;SPAN class="comment token"&gt;/*!
 * @brief Set FLEXIO clock source.
 *
 * @param src The value to set FLEXIO clock source.
 */&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;static&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;inline&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;void&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;CLOCK_SetFlexio0Clock&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;uint32_t src&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
 SIM&lt;SPAN class="operator token"&gt;-&amp;gt;&lt;/SPAN&gt;SOPT2 &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;SIM&lt;SPAN class="operator token"&gt;-&amp;gt;&lt;/SPAN&gt;SOPT2 &lt;SPAN class="operator token"&gt;&amp;amp;&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;~&lt;/SPAN&gt;SIM_SOPT2_FLEXIOSRC_MASK&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;|&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;SIM_SOPT2_FLEXIOSRC&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;src&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;‍‍‍‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;PRE class="language-c line-numbers"&gt;&lt;CODE&gt;&lt;SPAN class="comment token"&gt;/*!
 * @brief Ungates the FlexIO clock, resets the FlexIO module, and configures the FlexIO I2C
 * hardware configuration.
 *
 * Example
 @code
 FLEXIO_I2C_Type base = {
 .flexioBase = FLEXIO,
 .SDAPinIndex = 0,
 .SCLPinIndex = 1,
 .shifterIndex = {0,1},
 .timerIndex = {0,1}
 };
 flexio_i2c_master_config_t config = {
 .enableInDoze = false,
 .enableInDebug = true,
 .enableFastAccess = false,
 .baudRate_Bps = 100000
 };
 FLEXIO_I2C_MasterInit(base, &amp;amp;config, srcClock_Hz);
 @endcode
 *
 * @param base Pointer to FLEXIO_I2C_Type structure.
 * @param masterConfig Pointer to flexio_i2c_master_config_t structure.
 * @param srcClock_Hz FlexIO source clock in Hz.
*/&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;void&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;FLEXIO_I2C_MasterInit&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;FLEXIO_I2C_Type &lt;SPAN class="operator token"&gt;*&lt;/SPAN&gt;base&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; flexio_i2c_master_config_t &lt;SPAN class="operator token"&gt;*&lt;/SPAN&gt;masterConfig&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; uint32_t srcClock_Hz&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Oct 2018 22:34:58 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/FlexIO-Set-source-clock-API-difference/m-p/782983#M47672</guid>
      <dc:creator>lucasrangit</dc:creator>
      <dc:date>2018-10-11T22:34:58Z</dc:date>
    </item>
    <item>
      <title>Re: FlexIO Set source clock API difference</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/FlexIO-Set-source-clock-API-difference/m-p/782984#M47673</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The KL17 reference manual shows the FlexIO module clock source below:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_1.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/74478i64A0DAF33C02F410/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_1.png" alt="pastedImage_1.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;MCGPCLK is clock output from IRC48M (48MHz);&lt;/P&gt;&lt;P&gt;MCGIRCLK is clock output from IRC8M (IRC8M/2M internal reference clock divided by lirc_div2);&lt;/P&gt;&lt;P&gt;OSCERCLK is System oscillator output sourced from OSCCLK that may clock some on-chip modules (frequence same with external crystal/oscillator)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When customer call &lt;SPAN style="font-family: 'andale mono', monospace;"&gt;CLOCK_SetFlexio0Clock&lt;/SPAN&gt;() function, customer need to clear know the FlexIO clock source frequency.&lt;/P&gt;&lt;P&gt;Such as FlexIO_i2c [interrupt_i2c_transfer] demo using MCGPCLK as clock source, which is fixed to 48MHz.&lt;/P&gt;&lt;P&gt;So, the FLEXIO_CLOCK_FREQUENCY macro definition value is 48MHz.&lt;/P&gt;&lt;P&gt;#define FLEXIO_CLOCK_FREQUENCY 48000000U&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If customer change to use another clock source, customer need to set the correct clock frequency at FLEXIO_CLOCK_FREQUENCY macro.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for the attention.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Have a great day,&lt;BR /&gt;Mike&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-----------------------------------------------------------------------------------------------------------------------&lt;BR /&gt;Note: If this post answers your question, please click the Correct Answer button. Thank you!&lt;BR /&gt;-----------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Oct 2018 08:12:31 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/FlexIO-Set-source-clock-API-difference/m-p/782984#M47673</guid>
      <dc:creator>Hui_Ma</dc:creator>
      <dc:date>2018-10-12T08:12:31Z</dc:date>
    </item>
  </channel>
</rss>

