AnsweredAssumed Answered

System clock as FTM source on K64?

Question asked by leo.thirifays@chauvin-arnoux.com on Sep 18, 2018
Latest reply on Sep 19, 2018 by leo.thirifays@chauvin-arnoux.com

Hello,

 

I'm developing on a K64 board under MCUXpresso and I'm trying to get the best resolution for the duty cycle of a PWM I'm generating with one of the FTM. That's why I'm trying to use the fastest clock source possible.

 

I read from the K64 reference manual that you can use the system clock at 100MHz as the source clock for the module (Chapter 40.1.2, page 976).

However, when using the Peripherals tool from MCUXpresso to configure the FTM, the fastest clock available is the BusClock which is at 50MHz (System Clock with a division factor of 2). I can't get any higher because this clock is limited at 60MHz.

FTM3 config

 

My problem is that by looking at the FTM3 registers in Debug Mode and the manual, it seems that I'm selecting the System Clock even though on the peripherals.h generated by the MCUXpresso tools, it is using the Bus Clock at 50MHz.

The register for FTM3 in debug mode after the peripherals are all initialized.

 

The K64 manual on Chapter 40.3.3, page 988

 

The code generated by the MCUXpresso tools, on peripherals.h

 

So there seems to be an incoherence between the manual and MCUXpresso. And the resolution of duty cycle the 24kHz PWM generated from the timer is around 1000 steps, so it seems like the smallest change on the duty cycle possible is around 25MHz, not even 50MHz!

 

I tried to manually change the #define FTM_3_CLOCK_SOURCE by replacing kCLOCK_BusClk with kCLOCK_CoreSysClk but it just messes with the PWM frequency, dividing it by a factor of 2 and not giving me a better resolution for the pulse width.

 

A better resolution for the duty cycle of the PWM would really help, so does somebody managed to use the fastest clock available on the MCU for the FTM (or the other peripherals in general)?

 

Thanks

Outcomes