<?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 i.MX 8M Mini - Are clocks synchronized across Cortex A and Cortex M? in i.MX Processors</title>
    <link>https://community.nxp.com/t5/i-MX-Processors/i-MX-8M-Mini-Are-clocks-synchronized-across-Cortex-A-and-Cortex/m-p/1064126#M156378</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have an i.MX 8M Mini EVK, and I'm running Linux on the Cortex A53 and was planning on running FreeRTOS on the Cortex M4. I was curious, if I'm doing stuff on the Cortex A53, like changing the wall-clock time via Linux (think synchronizing its wall clock to a master clock source), does that change propagate to the Cortex M4 running FreeRTOS?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If not, how would you reliably synchronize the two clocks to run in step with each other?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 06 Apr 2020 14:37:44 GMT</pubDate>
    <dc:creator>stephen_eng</dc:creator>
    <dc:date>2020-04-06T14:37:44Z</dc:date>
    <item>
      <title>i.MX 8M Mini - Are clocks synchronized across Cortex A and Cortex M?</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/i-MX-8M-Mini-Are-clocks-synchronized-across-Cortex-A-and-Cortex/m-p/1064126#M156378</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have an i.MX 8M Mini EVK, and I'm running Linux on the Cortex A53 and was planning on running FreeRTOS on the Cortex M4. I was curious, if I'm doing stuff on the Cortex A53, like changing the wall-clock time via Linux (think synchronizing its wall clock to a master clock source), does that change propagate to the Cortex M4 running FreeRTOS?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If not, how would you reliably synchronize the two clocks to run in step with each other?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Apr 2020 14:37:44 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/i-MX-8M-Mini-Are-clocks-synchronized-across-Cortex-A-and-Cortex/m-p/1064126#M156378</guid>
      <dc:creator>stephen_eng</dc:creator>
      <dc:date>2020-04-06T14:37:44Z</dc:date>
    </item>
    <item>
      <title>Re: i.MX 8M Mini - Are clocks synchronized across Cortex A and Cortex M?</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/i-MX-8M-Mini-Are-clocks-synchronized-across-Cortex-A-and-Cortex/m-p/1064127#M156379</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Stephen,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If the clock parent is the same for A53 and M4, then by modifying the clock speed on Linux, will also modify at M4 side, for example, if both domains are fed by&amp;nbsp;SYSTEM_PLL1, by changing the PLL1 speed, changes all the clock tree tied to this source.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;There are 2 methods to change the clock speed of one domain without changing the other side:&lt;/P&gt;&lt;P&gt;&amp;nbsp;- Each domain uses a different clock source&lt;/P&gt;&lt;P&gt;&amp;nbsp;- Change the speed by selecting a different clock divider, instead of modifying the PLL parameters, for example.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;If not, how would you reliably synchronize the two clocks to run in step with each other?&lt;/SPAN&gt;&lt;/BLOCKQUOTE&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To syncronize the clocks, the application may select the same clock source for both cores, for example in the table below, the&amp;nbsp;ARM_A53_CLK_ROOT may derive from&amp;nbsp;SYSTEM_PLL1_CLK and&amp;nbsp;ARM_M4_CLK_ROOT may derive from&amp;nbsp;SYSTEM_PLL1_DIV3. In this situation, the speed for M4 is 1/3 of A53 and they will be in synchronization.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_3.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/105096iBB0A045B43A32D98/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_3.png" alt="pastedImage_3.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Just pay attention for the maximum frequency speed for each domains.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Apr 2020 13:14:41 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/i-MX-8M-Mini-Are-clocks-synchronized-across-Cortex-A-and-Cortex/m-p/1064127#M156379</guid>
      <dc:creator>Bio_TICFSL</dc:creator>
      <dc:date>2020-04-08T13:14:41Z</dc:date>
    </item>
    <item>
      <title>Re: i.MX 8M Mini - Are clocks synchronized across Cortex A and Cortex M?</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/i-MX-8M-Mini-Are-clocks-synchronized-across-Cortex-A-and-Cortex/m-p/1064128#M156380</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Bio_TICFSL,&lt;/P&gt;&lt;P&gt;Thanks for the pointers. I'll take a look at that a little more, but&amp;nbsp;I either don't quite understand everything you mentioned, or I didn't word my question clearly enough.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I were to display the date/time from the Cortex A processor (i.e. the 'date' command), I'll get something like April 8, 2020, 1:01:03 pm. If I were to do something similar on the Cortex M processor (which, I don't actually know how to do that... if you happen to know the API function call, I would be immensely appreciative), should I expect to see the same answer? If I change the date/time on the Cortex A processor to something ridiculous, would it automatically affect the Cortex M processor as well?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Configuring the two to use the same clock source would indeed keep them in lock step with one another, and I won't have to worry about drift over time. I just wasn't sure about how the real-time clock works with these two processors.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kind regards.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Apr 2020 17:06:01 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/i-MX-8M-Mini-Are-clocks-synchronized-across-Cortex-A-and-Cortex/m-p/1064128#M156380</guid>
      <dc:creator>stephen_eng</dc:creator>
      <dc:date>2020-04-08T17:06:01Z</dc:date>
    </item>
    <item>
      <title>Re: i.MX 8M Mini - Are clocks synchronized across Cortex A and Cortex M?</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/i-MX-8M-Mini-Are-clocks-synchronized-across-Cortex-A-and-Cortex/m-p/1064129#M156381</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The date and time is stored in SNVS (Secure Non-Volatile Storage) domain, which normally has an uninterrupted power supply, like a coin-cell battery, and its clock is derived from external 32kHz crystal.&amp;nbsp; So when you type a command 'date' in Linux, the driver reads the data from Secure RTC (Real Time Clock).&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The date and time is stored at&amp;nbsp;SNVS_LP SRTC register, this is a secure region, so not all peripherals have access to it, a simple method is to "mirror" this register synchronizing it with the HP (High Power)&amp;nbsp;counter of the SNVS, thus, you can read it from M4, as explained below on Reference Manual.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&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/105195i17CEB540B27DAF21/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;As this is a register, any modification on&amp;nbsp;A53 side, is immediately observed at M4 side.&amp;nbsp;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;There is no specific API, you'll have to implement a register read on M4 code. Using the SDK makes this implementation much faster.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Apr 2020 20:47:13 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/i-MX-8M-Mini-Are-clocks-synchronized-across-Cortex-A-and-Cortex/m-p/1064129#M156381</guid>
      <dc:creator>Bio_TICFSL</dc:creator>
      <dc:date>2020-04-08T20:47:13Z</dc:date>
    </item>
    <item>
      <title>Re: i.MX 8M Mini - Are clocks synchronized across Cortex A and Cortex M?</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/i-MX-8M-Mini-Are-clocks-synchronized-across-Cortex-A-and-Cortex/m-p/1439719#M189019</link>
      <description>&lt;P&gt;hello, I'm in the same situation and I have two questions:&lt;/P&gt;&lt;P&gt;1. the paragraph above mentions the HP_TS bit of the SNSVS_HP Control Register, but I can't find it in the register map. do you mean the RTC_EN bit of the of&amp;nbsp;SNVS_HP Control Register (HPCR)?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="RoccoBr_0-1649249682752.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/176066iD19FB902C4E8BAD5/image-size/medium?v=v2&amp;amp;px=400" role="button" title="RoccoBr_0-1649249682752.png" alt="RoccoBr_0-1649249682752.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;2. how can I access the&amp;nbsp;SNVS_HP submodule from Linux? in my device tree I can see the rct-lp as 30370000.snvs:svns-rct-lp, but I can't see the rct-hp module. I do have&amp;nbsp;30370000.snvs:svns-power-key in my device tree, is is the same as the HP submodule?&lt;/P&gt;</description>
      <pubDate>Wed, 06 Apr 2022 12:58:32 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/i-MX-8M-Mini-Are-clocks-synchronized-across-Cortex-A-and-Cortex/m-p/1439719#M189019</guid>
      <dc:creator>RoccoBr</dc:creator>
      <dc:date>2022-04-06T12:58:32Z</dc:date>
    </item>
    <item>
      <title>Re: i.MX 8M Mini - Are clocks synchronized across Cortex A and Cortex M?</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/i-MX-8M-Mini-Are-clocks-synchronized-across-Cortex-A-and-Cortex/m-p/1452677#M189975</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;where is defined the HP_TS bit of the SVNS_HP control register? I can't find it in the register map of the reference manual.&lt;/P&gt;&lt;P&gt;thanks&lt;/P&gt;</description>
      <pubDate>Wed, 04 May 2022 11:01:21 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/i-MX-8M-Mini-Are-clocks-synchronized-across-Cortex-A-and-Cortex/m-p/1452677#M189975</guid>
      <dc:creator>RoccoBr</dc:creator>
      <dc:date>2022-05-04T11:01:21Z</dc:date>
    </item>
    <item>
      <title>Re: i.MX 8M Mini - Are clocks synchronized across Cortex A and Cortex M?</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/i-MX-8M-Mini-Are-clocks-synchronized-across-Cortex-A-and-Cortex/m-p/1855802#M223052</link>
      <description>&lt;P&gt;The following worked on the I.MX 8M plus: Setting the 16th bit of the SVNS_HP Control Registers copies the RTC1 clock (SVNS LP), simultaneously setting the 0th bit will then also enable the clock. I use Torizon OS, which by default uses the external rtc as its main rtc. This means that RTC1 will not contain a valid value by default and will thus reset at each power on reset. Sharing the synchronized wall clock between the Cortex A and M cores is done as follows:&lt;BR /&gt;&lt;BR /&gt;First ensure that the system clock is synchronized using ntp or by manually setting it. Then issue the following command to write the system clock to rtc1:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;sudo hwclock -s -f /dev/rtc1&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;On the Cortex M7 you can use the following c++ code or equivalent c code to read the timestamp:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;void enable_timer(){
    SNVS-&amp;gt;HPCR = (1U &amp;lt;&amp;lt; 16U) | (1U &amp;lt;&amp;lt; 0U);
}

auto read_time() noexcept
{
    /* According to section 6.4.2.2.1.3 of the i.MX 8M Pluse Applications Processor Reference
       Manual the time resgisters must be read twice and compared. If the value are the same
       the retrieved time was correct, else retry for a maximum of three times after which the value
       should be correct
    */

    auto msb_first = SNVS-&amp;gt;HPRTCMR;
    auto lsb_first = SNVS-&amp;gt;HPRTCLR;

    auto msb_second = SNVS-&amp;gt;HPRTCMR;
    auto lsb_second = SNVS-&amp;gt;HPRTCLR;
    int i = 0;
    while (msb_first != msb_second || lsb_first != lsb_second)
    {
        msb_first = SNVS-&amp;gt;HPRTCMR;
        lsb_first = SNVS-&amp;gt;HPRTCLR;

        msb_second = SNVS-&amp;gt;HPRTCMR;
        lsb_second = SNVS-&amp;gt;HPRTCLR;
        ++i;
    }
    uint64_t ret = (msb_first &amp;lt;&amp;lt; 32 )|(lsb_first);
    ret = ret / 32768; // the clock counts at 32 khz, divide by 32khz to get the "real" unix timestamp in seconds.
    return ret;
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 26 Apr 2024 19:03:49 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/i-MX-8M-Mini-Are-clocks-synchronized-across-Cortex-A-and-Cortex/m-p/1855802#M223052</guid>
      <dc:creator>StephanOostveen</dc:creator>
      <dc:date>2024-04-26T19:03:49Z</dc:date>
    </item>
  </channel>
</rss>

