<?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 MKL27: crashes when trying to start TPM/PWM in Kinetis Software Development Kit</title>
    <link>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/MKL27-crashes-when-trying-to-start-TPM-PWM/m-p/459188#M3335</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi everyone,&lt;/P&gt;&lt;P&gt;I am trying to configure TPM/PWM in MKL27 (&lt;SPAN style="font-family: arial, sans, sans-serif; font-size: 13px;"&gt;MKL27Z256VFM4 , KSDK 1.2.0, KDS 3.0.0, MQX for KSDK), and MCU reboots when doing TPM_DRV_PwmStart().&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, sans, sans-serif; font-size: 13px;"&gt;My code is similar to the one in example tpm_example_frdmkl27z. I have found that the crash happens when writing to CSnC register in: TPM_WR_CnSC(tpmBase, channel, value)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, sans, sans-serif; font-size: 13px;"&gt;(called in TPM_HAL_SetChnMsnbaElsnbaVal()).&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, sans, sans-serif; font-size: 13px;"&gt;I am using channel 0, and value=40 (so MSB:MSA=10 and ELSB:ELSA=10).&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, sans, sans-serif; font-size: 13px;"&gt;Could you give me any ideas?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, sans, sans-serif; font-size: 13px;"&gt;Thank you very much&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 05 Nov 2015 22:01:33 GMT</pubDate>
    <dc:creator>joséantoniomart</dc:creator>
    <dc:date>2015-11-05T22:01:33Z</dc:date>
    <item>
      <title>MKL27: crashes when trying to start TPM/PWM</title>
      <link>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/MKL27-crashes-when-trying-to-start-TPM-PWM/m-p/459188#M3335</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi everyone,&lt;/P&gt;&lt;P&gt;I am trying to configure TPM/PWM in MKL27 (&lt;SPAN style="font-family: arial, sans, sans-serif; font-size: 13px;"&gt;MKL27Z256VFM4 , KSDK 1.2.0, KDS 3.0.0, MQX for KSDK), and MCU reboots when doing TPM_DRV_PwmStart().&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, sans, sans-serif; font-size: 13px;"&gt;My code is similar to the one in example tpm_example_frdmkl27z. I have found that the crash happens when writing to CSnC register in: TPM_WR_CnSC(tpmBase, channel, value)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, sans, sans-serif; font-size: 13px;"&gt;(called in TPM_HAL_SetChnMsnbaElsnbaVal()).&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, sans, sans-serif; font-size: 13px;"&gt;I am using channel 0, and value=40 (so MSB:MSA=10 and ELSB:ELSA=10).&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, sans, sans-serif; font-size: 13px;"&gt;Could you give me any ideas?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, sans, sans-serif; font-size: 13px;"&gt;Thank you very much&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Nov 2015 22:01:33 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/MKL27-crashes-when-trying-to-start-TPM-PWM/m-p/459188#M3335</guid>
      <dc:creator>joséantoniomart</dc:creator>
      <dc:date>2015-11-05T22:01:33Z</dc:date>
    </item>
    <item>
      <title>Re: MKL27: crashes when trying to start TPM/PWM</title>
      <link>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/MKL27-crashes-when-trying-to-start-TPM-PWM/m-p/459189#M3336</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, Jose,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;After the FTM start, you can not change the &lt;SPAN style="font-family: arial, sans, sans-serif; font-size: 13px;"&gt; CSnC register. If you want to change the register, you have to stop the FTM by clearing the CMOD bits in TPMx_SC register, then change the FTM_CnSC registyer, then set the CMOD bits as you desired to start FTM.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, sans, sans-serif; font-size: 13px;"&gt;Pls refer to section 23.4.4 Channel (n) Status and Control (TPMx_CnSC) in the user manual of Kl27, I copy it here:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, sans, sans-serif; font-size: 13px;"&gt;"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;23.4.4 Channel (n) Status and Control (TPMx_CnSC)&lt;/P&gt;&lt;P&gt;CnSC contains the channel-interrupt-status flag and control bits used to configure the&lt;/P&gt;&lt;P&gt;interrupt enable, channel configuration, and pin function. When switching from one&lt;/P&gt;&lt;P&gt;channel mode to a different channel mode, the channel must first be disabled and this&lt;/P&gt;&lt;P&gt;must be acknowledged in the TPM counter clock domain.&lt;/P&gt;&lt;P&gt;"&lt;/P&gt;&lt;P&gt;BR&lt;/P&gt;&lt;P&gt;Xiangjun Rong&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 06 Nov 2015 09:15:45 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/MKL27-crashes-when-trying-to-start-TPM-PWM/m-p/459189#M3336</guid>
      <dc:creator>xiangjun_rong</dc:creator>
      <dc:date>2015-11-06T09:15:45Z</dc:date>
    </item>
    <item>
      <title>Re: MKL27: crashes when trying to start TPM/PWM</title>
      <link>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/MKL27-crashes-when-trying-to-start-TPM-PWM/m-p/459190#M3337</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi xiangjun.rong,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you four your response. I am going to study deeply now, but at first sight I am a bit confused. In my program I am using the following secuence:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TPM_DRV_Init(TPM_INSTANCE_0, &amp;amp;tpmConfig);&lt;/P&gt;&lt;P&gt;TPM_DRV_SetClock(TPM_INSTANCE_0, kTpmClockSourceModuleHighFreq, kTpmDividedBy2);&lt;/P&gt;&lt;P&gt;TPM_DRV_PwmStart(TPM_INSTANCE_0, &amp;amp;param, TPM_CHANNEL_0);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and the fail happens inside this last function, because TPM_DRV_PwmStart() internally modifies &lt;SPAN style="color: #51626f; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;TPMx_CnSC. So, what are then the correct steps to configure and start TPM/PWM using high level TPM driver (fsl_tpm_driver.h)?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;Thank you very much.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;Regards.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;José Antonio Martínez&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 06 Nov 2015 09:27:58 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/MKL27-crashes-when-trying-to-start-TPM-PWM/m-p/459190#M3337</guid>
      <dc:creator>joséantoniomart</dc:creator>
      <dc:date>2015-11-06T09:27:58Z</dc:date>
    </item>
    <item>
      <title>Re: MKL27: crashes when trying to start TPM/PWM</title>
      <link>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/MKL27-crashes-when-trying-to-start-TPM-PWM/m-p/459191#M3338</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi again,&lt;/P&gt;&lt;P&gt;Reading carefully your response I have also noted that the text you referenced appears in section &lt;STRONG&gt;29.4.4&lt;/STRONG&gt; of document KL27P64M48SF6RM (Rev 4, September 2014), that is the one that I am using. However you pointed it as section &lt;STRONG&gt;23.4.4&lt;/STRONG&gt;: Is it another document? another revision? maybe a typo?...&lt;/P&gt;&lt;P&gt;Thanks a lot!&lt;/P&gt;&lt;P&gt;BR&lt;/P&gt;&lt;P&gt;José Antonio Martínez&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 06 Nov 2015 10:44:52 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/MKL27-crashes-when-trying-to-start-TPM-PWM/m-p/459191#M3338</guid>
      <dc:creator>joséantoniomart</dc:creator>
      <dc:date>2015-11-06T10:44:52Z</dc:date>
    </item>
    <item>
      <title>Re: MKL27: crashes when trying to start TPM/PWM</title>
      <link>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/MKL27-crashes-when-trying-to-start-TPM-PWM/m-p/459192#M3339</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; color: #303030;"&gt;Hi,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; color: #303030;"&gt;I have revised code of function in TPM_HAL_EnablePwmMode() in file fsl_tpm_hal.c. This function disables (and then enables) the counter when calling TPM_HAL_SetCpwms(). However, it does NOT when calling TPM_HAL_SetChnMsnbaElsnbaVal() that is the call that causes my MKL27 to reboot. So, I have added the same protection to disable de counter before calling it, and enable it again after the call, but it does not fix the issue:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="line-height: 1.5; font-size: 10pt; font-family: arial, helvetica, sans-serif; color: #303030;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; clkSrc = TPM_HAL_GetClockMode(tpmBase);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="line-height: 1.5; font-size: 10pt; font-family: arial, helvetica, sans-serif; color: #303030;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; TPM_HAL_SetClockMode(tpmBase, kTpmClockSourceNoneClk);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: arial, helvetica, sans-serif; color: #303030;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; TPM_HAL_SetChnMsnbaElsnbaVal(tpmBase, channel, val);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="line-height: 1.5; font-size: 10pt; font-family: arial, helvetica, sans-serif; color: #303030;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; TPM_HAL_SetClockMode(tpmBase, clkSrc);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; color: #303030;"&gt;With this instructions I guess that I am following your upper indications (clear CMOD before changing &lt;SPAN style="font-family: arial, sans, sans-serif;"&gt;FTM_CnSC&amp;nbsp; and restore it later), so any idea about what is going wrong?&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #303030; font-family: arial, sans, sans-serif; font-size: 10pt;"&gt;Thank you very much&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; color: #303030;"&gt;BR&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; color: #303030;"&gt;José Antonio Martínez.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 06 Nov 2015 21:29:27 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/MKL27-crashes-when-trying-to-start-TPM-PWM/m-p/459192#M3339</guid>
      <dc:creator>joséantoniomart</dc:creator>
      <dc:date>2015-11-06T21:29:27Z</dc:date>
    </item>
    <item>
      <title>Re: MKL27: crashes when trying to start TPM/PWM</title>
      <link>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/MKL27-crashes-when-trying-to-start-TPM-PWM/m-p/459193#M3340</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi again,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have found the cause of the reboots: it seems that the two pins used as TPM0_CH0 and TPM0_CH1 (PTC1 and PTC2 respectively) must be initially configured as outputs (and not only configured to use ALT4 config), so I added these pins to the outputPins in gpio_pins.c so that they are configured in GPIO_DR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;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;.config.outputLogic = 0,&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;.config.slewRate = kPortSlowSlewRate,&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;.config.driveStrength = kPortLowDriveStrength,&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;},&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;With this change, the board does not restart, though I don't understand the reason causing this behaviour.&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;BR&lt;/P&gt;&lt;P&gt;José Antonio Martínez.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 Nov 2015 22:59:29 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/MKL27-crashes-when-trying-to-start-TPM-PWM/m-p/459193#M3340</guid>
      <dc:creator>joséantoniomart</dc:creator>
      <dc:date>2015-11-09T22:59:29Z</dc:date>
    </item>
    <item>
      <title>Re: MKL27: crashes when trying to start TPM/PWM</title>
      <link>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/MKL27-crashes-when-trying-to-start-TPM-PWM/m-p/459194#M3341</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, Jose,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If it is convenient, can you attach the project so that we can have a review even have a test?&lt;/P&gt;&lt;P&gt;BR&lt;/P&gt;&lt;P&gt;XiangJun Rong&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Nov 2015 09:42:43 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/MKL27-crashes-when-trying-to-start-TPM-PWM/m-p/459194#M3341</guid>
      <dc:creator>xiangjun_rong</dc:creator>
      <dc:date>2015-11-10T09:42:43Z</dc:date>
    </item>
    <item>
      <title>Re: MKL27: crashes when trying to start TPM/PWM</title>
      <link>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/MKL27-crashes-when-trying-to-start-TPM-PWM/m-p/459195#M3342</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi xiangjun.rong,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We have finally found the reason of the reboots: it was a HW problem: a short in our custom board unity. Our HW team repaired it and now the TPM/PWM is working ok managing a driver vibrator. So everything wask ok with our software solution.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you very much for your help.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Nov 2015 11:06:04 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/MKL27-crashes-when-trying-to-start-TPM-PWM/m-p/459195#M3342</guid>
      <dc:creator>joséantoniomart</dc:creator>
      <dc:date>2015-11-10T11:06:04Z</dc:date>
    </item>
  </channel>
</rss>

