<?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 RTC PCF2131 issue with Timestamp in Other NXP Products</title>
    <link>https://community.nxp.com/t5/Other-NXP-Products/RTC-PCF2131-issue-with-Timestamp/m-p/1766633#M20308</link>
    <description>&lt;P&gt;&lt;SPAN&gt;Hello,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I'm currently testing the PCF2131 RTC with I2C connection, on a Variscite devkit powered by i.MX8M Plus with Yocto Kirkstone (kernel 5.15.71).&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;The RTC works fine, but I have some strange behavior with the timestamp functions.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;This is what I've done to make it work:&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;SPAN&gt;Updated the driver in the kernel to support the PCF2131 (support added from kernel 6.6 &amp;gt;)&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN&gt;Add the RTC definition in the device tree&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN&gt;Boot up the board and checked the RTC was correctly recognized&lt;/SPAN&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;SPAN&gt;By default, as the datasheet states, the battery switch over is not active and timestamps save only the first triggered event (and not overwrites itself when triggered again). &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;U&gt;I'm interested in: &lt;/U&gt;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;&lt;SPAN&gt;Having the battery switch-over active&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN&gt;Saving the event in TS4 when RTC switch over (control bit BTSE in register control 4)&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN&gt;Timestamp (TS) overwriting themself when triggered&lt;/SPAN&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;U&gt;To do so I made the following changes:&amp;nbsp;&lt;/U&gt;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;function &lt;STRONG&gt;pcf2127_enable_ts &lt;/STRONG&gt;in &lt;STRONG&gt;&lt;FONT color="#3366FF"&gt;rtc-pcf2127.c&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/DIV&gt;&lt;DIV&gt;Set TSM (Timestamp mode) to 0.&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="cpp"&gt;/* Enable timestamp function. */
ret = regmap_update_bits(pcf2127-&amp;gt;regmap,
		        pcf2127-&amp;gt;cfg-&amp;gt;ts[ts_id].reg_base,
			PCF2127_BIT_TS_CTRL_TSOFF,
			0);

ret = regmap_update_bits(pcf2127-&amp;gt;regmap,
			pcf2127-&amp;gt;cfg-&amp;gt;ts[ts_id].reg_base,
			PCF2127_BIT_TS_CTRL_TSM,
			0);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="simoberny_3-1701361333037.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/252338i9048ED41B435E03A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="simoberny_3-1701361333037.png" alt="simoberny_3-1701361333037.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;function &lt;STRONG&gt;pcf2127_probe &lt;/STRONG&gt;in &lt;STRONG&gt;&lt;FONT color="#3366FF"&gt;rtc-pcf2127.c&amp;nbsp;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/DIV&gt;&lt;DIV&gt;Enabled switch-over and battery low detection and&lt;/DIV&gt;&lt;DIV&gt;set BTSE to 1 and BF to 0 to have the timestamp4 update when switch-over happen.&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Reference: page 17 and 43 of the datasheet to find bit map and default values.&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="cpp"&gt;	// Set default behavour of RTC
	// Activate switchover and low battery
	ret = regmap_update_bits(pcf2127-&amp;gt;regmap,
			PCF2127_REG_CTRL3,
			PCF2127_BIT_CTRL3_BTSE,
			1);			
	ret = regmap_update_bits(pcf2127-&amp;gt;regmap,
			PCF2127_REG_CTRL3,
			PCF2127_BIT_CTRL3_BF |
			PCF2127_BIT_CTRL3_PWR0 | 
			PCF2127_BIT_CTRL3_PWR1 |
			PCF2127_BIT_CTRL3_PWR2,
			0);	  &lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="simoberny_0-1701361203757.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/252335i1E7A0FE5B585F362/image-size/medium?v=v2&amp;amp;px=400" role="button" title="simoberny_0-1701361203757.png" alt="simoberny_0-1701361203757.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="simoberny_2-1701361316264.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/252337i817C0CF5CCD94D21/image-size/medium?v=v2&amp;amp;px=400" role="button" title="simoberny_2-1701361316264.png" alt="simoberny_2-1701361316264.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Everything seems to work fine, the RTC time is correct and is maintained when going with the battery. Timestamps correctly overwrite itself when triggered.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;U&gt;The problem are the following:&amp;nbsp;&lt;/U&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;SPAN&gt;When the system is rebooted (so when RTC does the switchover to battery), all the timestamp register reset and become empty.&amp;nbsp;&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN&gt;Some random other time they are not empty after reboot, but filled with the same value with recent date and time.&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN&gt;When doing the switch-over TS4 is not updated&amp;nbsp;&lt;/SPAN&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thank you in advande for any help,&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Best regards&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 30 Nov 2023 16:23:31 GMT</pubDate>
    <dc:creator>simoberny</dc:creator>
    <dc:date>2023-11-30T16:23:31Z</dc:date>
    <item>
      <title>RTC PCF2131 issue with Timestamp</title>
      <link>https://community.nxp.com/t5/Other-NXP-Products/RTC-PCF2131-issue-with-Timestamp/m-p/1766633#M20308</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Hello,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I'm currently testing the PCF2131 RTC with I2C connection, on a Variscite devkit powered by i.MX8M Plus with Yocto Kirkstone (kernel 5.15.71).&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;The RTC works fine, but I have some strange behavior with the timestamp functions.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;This is what I've done to make it work:&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;SPAN&gt;Updated the driver in the kernel to support the PCF2131 (support added from kernel 6.6 &amp;gt;)&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN&gt;Add the RTC definition in the device tree&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN&gt;Boot up the board and checked the RTC was correctly recognized&lt;/SPAN&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;SPAN&gt;By default, as the datasheet states, the battery switch over is not active and timestamps save only the first triggered event (and not overwrites itself when triggered again). &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;U&gt;I'm interested in: &lt;/U&gt;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;&lt;SPAN&gt;Having the battery switch-over active&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN&gt;Saving the event in TS4 when RTC switch over (control bit BTSE in register control 4)&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN&gt;Timestamp (TS) overwriting themself when triggered&lt;/SPAN&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;U&gt;To do so I made the following changes:&amp;nbsp;&lt;/U&gt;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;function &lt;STRONG&gt;pcf2127_enable_ts &lt;/STRONG&gt;in &lt;STRONG&gt;&lt;FONT color="#3366FF"&gt;rtc-pcf2127.c&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/DIV&gt;&lt;DIV&gt;Set TSM (Timestamp mode) to 0.&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="cpp"&gt;/* Enable timestamp function. */
ret = regmap_update_bits(pcf2127-&amp;gt;regmap,
		        pcf2127-&amp;gt;cfg-&amp;gt;ts[ts_id].reg_base,
			PCF2127_BIT_TS_CTRL_TSOFF,
			0);

ret = regmap_update_bits(pcf2127-&amp;gt;regmap,
			pcf2127-&amp;gt;cfg-&amp;gt;ts[ts_id].reg_base,
			PCF2127_BIT_TS_CTRL_TSM,
			0);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="simoberny_3-1701361333037.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/252338i9048ED41B435E03A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="simoberny_3-1701361333037.png" alt="simoberny_3-1701361333037.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;function &lt;STRONG&gt;pcf2127_probe &lt;/STRONG&gt;in &lt;STRONG&gt;&lt;FONT color="#3366FF"&gt;rtc-pcf2127.c&amp;nbsp;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/DIV&gt;&lt;DIV&gt;Enabled switch-over and battery low detection and&lt;/DIV&gt;&lt;DIV&gt;set BTSE to 1 and BF to 0 to have the timestamp4 update when switch-over happen.&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Reference: page 17 and 43 of the datasheet to find bit map and default values.&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="cpp"&gt;	// Set default behavour of RTC
	// Activate switchover and low battery
	ret = regmap_update_bits(pcf2127-&amp;gt;regmap,
			PCF2127_REG_CTRL3,
			PCF2127_BIT_CTRL3_BTSE,
			1);			
	ret = regmap_update_bits(pcf2127-&amp;gt;regmap,
			PCF2127_REG_CTRL3,
			PCF2127_BIT_CTRL3_BF |
			PCF2127_BIT_CTRL3_PWR0 | 
			PCF2127_BIT_CTRL3_PWR1 |
			PCF2127_BIT_CTRL3_PWR2,
			0);	  &lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="simoberny_0-1701361203757.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/252335i1E7A0FE5B585F362/image-size/medium?v=v2&amp;amp;px=400" role="button" title="simoberny_0-1701361203757.png" alt="simoberny_0-1701361203757.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="simoberny_2-1701361316264.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/252337i817C0CF5CCD94D21/image-size/medium?v=v2&amp;amp;px=400" role="button" title="simoberny_2-1701361316264.png" alt="simoberny_2-1701361316264.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Everything seems to work fine, the RTC time is correct and is maintained when going with the battery. Timestamps correctly overwrite itself when triggered.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;U&gt;The problem are the following:&amp;nbsp;&lt;/U&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;SPAN&gt;When the system is rebooted (so when RTC does the switchover to battery), all the timestamp register reset and become empty.&amp;nbsp;&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN&gt;Some random other time they are not empty after reboot, but filled with the same value with recent date and time.&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN&gt;When doing the switch-over TS4 is not updated&amp;nbsp;&lt;/SPAN&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thank you in advande for any help,&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Best regards&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 30 Nov 2023 16:23:31 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Other-NXP-Products/RTC-PCF2131-issue-with-Timestamp/m-p/1766633#M20308</guid>
      <dc:creator>simoberny</dc:creator>
      <dc:date>2023-11-30T16:23:31Z</dc:date>
    </item>
    <item>
      <title>Re: RTC PCF2131 issue with Timestamp</title>
      <link>https://community.nxp.com/t5/Other-NXP-Products/RTC-PCF2131-issue-with-Timestamp/m-p/1768808#M20350</link>
      <description>&lt;P&gt;Reboot means power on reset for RTC, right ? if yes, all of the RTC registers will be set as default value.&lt;/P&gt;</description>
      <pubDate>Tue, 05 Dec 2023 07:23:30 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Other-NXP-Products/RTC-PCF2131-issue-with-Timestamp/m-p/1768808#M20350</guid>
      <dc:creator>guoweisun</dc:creator>
      <dc:date>2023-12-05T07:23:30Z</dc:date>
    </item>
    <item>
      <title>Re: RTC PCF2131 issue with Timestamp</title>
      <link>https://community.nxp.com/t5/Other-NXP-Products/RTC-PCF2131-issue-with-Timestamp/m-p/1768821#M20351</link>
      <description>Yes, I mean turning the board off and on again. I expect the timestamps to remain saved just as the date and time remain saved by using the battery source power.&lt;BR /&gt;This is what an RTC is for, if it resets the timestamp registers every time what are they for?&lt;BR /&gt;&lt;BR /&gt;Thanks</description>
      <pubDate>Tue, 05 Dec 2023 07:37:46 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Other-NXP-Products/RTC-PCF2131-issue-with-Timestamp/m-p/1768821#M20351</guid>
      <dc:creator>simoberny</dc:creator>
      <dc:date>2023-12-05T07:37:46Z</dc:date>
    </item>
  </channel>
</rss>

