<?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>8-bit MicrocontrollersのトピックUpdating TPMxCnV while CHnIE enabled (BUG?)</title>
    <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Updating-TPMxCnV-while-CHnIE-enabled-BUG/m-p/154794#M8746</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've got a strange problem in updating the TPM value registers and didn't found a solution yet. I read the datasheet of MC9S08DZ60 the nth time, looked for the errata sheet (3M05C) and of course searched in this forum but can't find exactly the same issue.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I want to set up a EPWM with TPM1 on HCS08DZ60 and the channel interrupt is disabled (CHnIE = 0) but with timer overflow interrupt enabled (TOI = 1) I can set the TPM1CnV whenever I want to and the value is written to the register. But when I enable the channel interrupt I recognized that the value registers TPM1CnV are not updated although I wrote them. After some debugging I found out that the value is only written to TPM1CnV when TPM1CNT &amp;gt; TPM1CnV at the time I want to write to it. So when the pwm duty cycle is close to 100% the probability is very low to be between TPM1CnV and TPM1MOD to update the value.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried to set the value registers in endless loop of main() and to set it in the interrupt what makes no difference. I did the tpm1 overflow and channel interrupt acknowledge as described in datasheet and proposed by processor expert, e.g.&lt;/P&gt;&lt;P&gt;=&amp;gt; TPM1C3SC &amp;amp;=0x7F; or&lt;/P&gt;&lt;P&gt;=&amp;gt; (void)getReg8(TPM1C3SC); clrReg8Bits(TPM1C3SC, 0x80);&lt;/P&gt;&lt;P&gt;so it IS a two step sequence of reading and then writing the zero&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So, what do I wrong? It's a fact, that when disabling CHnIE I can set the TPMxCnV whenever I want!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In datasheet section 16.3.5 it says:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3366FF;"&gt;"If (CLKSB:CLKSA not = 0:0 and in EPWM orCPWM modes), then the registers are updated after&lt;BR /&gt;the both bytes were written, and the TPM counter changes from (TPMxMODH:TPMxMODL - 1)&lt;BR /&gt;to (TPMxMODH:TPMxMODL). If the TPM counter is a free-running counter then the update is&lt;BR /&gt;made when the TPM counter changes from 0xFFFE to 0xFFFF.&lt;/SPAN&gt;"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;I cannot see any reason why the values are not written. Here the register settings:&lt;/SPAN&gt;&lt;BR /&gt;&lt;/P&gt;&lt;PRE&gt;
// 1. Setting TPM1C3SC
TPM1C3SC = 0x68;

// 2. Setting TPM1SC (depending on desired frequency)
TPM1SC = 0x48;

// 3. Setting TPM1MOD (depending on desired frequency)
TPM1MOD = 40000;

// 4. Setting TPM1C3V
TPM1C3V = 20000;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Setting TPM1C3V the first time is always succesful because it's zero. Writing a zero when it has a value &amp;gt; 0 is always succesful, too!!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope to get an idea from you!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance,&lt;/P&gt;&lt;P&gt;Daniel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 29 Oct 2020 08:58:46 GMT</pubDate>
    <dc:creator>JackyRyan</dc:creator>
    <dc:date>2020-10-29T08:58:46Z</dc:date>
    <item>
      <title>Updating TPMxCnV while CHnIE enabled (BUG?)</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Updating-TPMxCnV-while-CHnIE-enabled-BUG/m-p/154794#M8746</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've got a strange problem in updating the TPM value registers and didn't found a solution yet. I read the datasheet of MC9S08DZ60 the nth time, looked for the errata sheet (3M05C) and of course searched in this forum but can't find exactly the same issue.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I want to set up a EPWM with TPM1 on HCS08DZ60 and the channel interrupt is disabled (CHnIE = 0) but with timer overflow interrupt enabled (TOI = 1) I can set the TPM1CnV whenever I want to and the value is written to the register. But when I enable the channel interrupt I recognized that the value registers TPM1CnV are not updated although I wrote them. After some debugging I found out that the value is only written to TPM1CnV when TPM1CNT &amp;gt; TPM1CnV at the time I want to write to it. So when the pwm duty cycle is close to 100% the probability is very low to be between TPM1CnV and TPM1MOD to update the value.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried to set the value registers in endless loop of main() and to set it in the interrupt what makes no difference. I did the tpm1 overflow and channel interrupt acknowledge as described in datasheet and proposed by processor expert, e.g.&lt;/P&gt;&lt;P&gt;=&amp;gt; TPM1C3SC &amp;amp;=0x7F; or&lt;/P&gt;&lt;P&gt;=&amp;gt; (void)getReg8(TPM1C3SC); clrReg8Bits(TPM1C3SC, 0x80);&lt;/P&gt;&lt;P&gt;so it IS a two step sequence of reading and then writing the zero&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So, what do I wrong? It's a fact, that when disabling CHnIE I can set the TPMxCnV whenever I want!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In datasheet section 16.3.5 it says:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3366FF;"&gt;"If (CLKSB:CLKSA not = 0:0 and in EPWM orCPWM modes), then the registers are updated after&lt;BR /&gt;the both bytes were written, and the TPM counter changes from (TPMxMODH:TPMxMODL - 1)&lt;BR /&gt;to (TPMxMODH:TPMxMODL). If the TPM counter is a free-running counter then the update is&lt;BR /&gt;made when the TPM counter changes from 0xFFFE to 0xFFFF.&lt;/SPAN&gt;"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;I cannot see any reason why the values are not written. Here the register settings:&lt;/SPAN&gt;&lt;BR /&gt;&lt;/P&gt;&lt;PRE&gt;
// 1. Setting TPM1C3SC
TPM1C3SC = 0x68;

// 2. Setting TPM1SC (depending on desired frequency)
TPM1SC = 0x48;

// 3. Setting TPM1MOD (depending on desired frequency)
TPM1MOD = 40000;

// 4. Setting TPM1C3V
TPM1C3V = 20000;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Setting TPM1C3V the first time is always succesful because it's zero. Writing a zero when it has a value &amp;gt; 0 is always succesful, too!!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope to get an idea from you!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance,&lt;/P&gt;&lt;P&gt;Daniel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Oct 2020 08:58:46 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Updating-TPMxCnV-while-CHnIE-enabled-BUG/m-p/154794#M8746</guid>
      <dc:creator>JackyRyan</dc:creator>
      <dc:date>2020-10-29T08:58:46Z</dc:date>
    </item>
    <item>
      <title>Re: Updating TPMxCnV while CHnIE enabled (BUG?)</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Updating-TPMxCnV-while-CHnIE-enabled-BUG/m-p/154795#M8747</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Waw, 2 years old post without any response?&lt;/P&gt;&lt;P&gt;My&amp;nbsp;9S08SG8 behaves&amp;nbsp; totally the same. All one day I've read the manual.&lt;/P&gt;&lt;DIV&gt;So the only&amp;nbsp;choice is write the&amp;nbsp;TPM1C0V in overflow interrupt when Ch0 interrupt is disable??? Where is the problem???&lt;/DIV&gt;&lt;DIV&gt;Is there someone with the same&amp;nbsp;error?&lt;/DIV&gt;&lt;DIV&gt;Have a nice day.&lt;/DIV&gt;&lt;DIV&gt;Z &amp;nbsp;&amp;nbsp;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 10 Dec 2011 06:02:44 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Updating-TPMxCnV-while-CHnIE-enabled-BUG/m-p/154795#M8747</guid>
      <dc:creator>zdenojanoska</dc:creator>
      <dc:date>2011-12-10T06:02:44Z</dc:date>
    </item>
  </channel>
</rss>

