Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - boredman

Pages: [1]
1
NXPTM M522XX, KINETIS and i.MX RT / Re: Kinetis PWM frequency
« on: March 10, 2018, 06:45:16 PM »
Thanks Mark!

One more thing, if I'm not mistaken, in kinetis.h PWM_CLOCK should be (BUS_CLOCK) and not (SYSTEM_CLOCK/2). I found this after setting 180MHz core clock through USE_HIGH_SPEED_RUN_MODE.

Could you please confirm?

2
NXPTM M522XX, KINETIS and i.MX RT / Kinetis PWM frequency
« on: March 10, 2018, 11:18:41 AM »
While playing with PWM on Teensy 3.6, I discovered that PWM frequency is half of what I wanted it to be. I think I traced the source of the problem to this code in kinetis_PWM.h:
Code: [Select]
            if ((ulMode & PWM_POLARITY) != 0) {                          // polarity
                ptrFlexTimer->FTM_channel[ucChannel].FTM_CSC = FTM_CSC_MS_ELS_PWM_LOW_TRUE_PULSES;
            }
            else {
                ptrFlexTimer->FTM_channel[ucChannel].FTM_CSC = FTM_CSC_MS_ELS_PWM_HIGH_TRUE_PULSES;
            }
            //
            ptrFlexTimer->FTM_channel[ucChannel].FTM_CSC = (FTM_CSC_ELSA | FTM_CSC_MSA);
            //

I do not understand the intention of the last line, but it seems that it configures the mode to Output Compare, thus overwriting the line before. Was this intended?

If I comment out the last line, the PWM frequency is correct.

Thanks for your help!

Pages: [1]