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
Solved! Go to Solution.
Hi Léo
The Flex timer document is confusing because it talks of using the system clock as one of its clock sources, but if you check the chip configuration you will find that the flex timer's "system clock" is in fact the overall system's bus clock (true for all Kinetis parts).
This means that the bus clock is indeed the fastest clock that you can use for the Flex Timer.
Regards
Mark
Kinetis: http://www.utasker.com/kinetis.html
Kinetis K64:
- http://www.utasker.com/kinetis/FRDM-K64F.html
- http://www.utasker.com/kinetis/TWR-K64F120M.html
- http://www.utasker.com/kinetis/TEENSY_3.5.html
- http://www.utasker.com/kinetis/Hexiwear-K64F.html
For less questions and faster, cheaper developments: try uTasker for Kinetis
Hi Léo
The Flex timer document is confusing because it talks of using the system clock as one of its clock sources, but if you check the chip configuration you will find that the flex timer's "system clock" is in fact the overall system's bus clock (true for all Kinetis parts).
This means that the bus clock is indeed the fastest clock that you can use for the Flex Timer.
Regards
Mark
Kinetis: http://www.utasker.com/kinetis.html
Kinetis K64:
- http://www.utasker.com/kinetis/FRDM-K64F.html
- http://www.utasker.com/kinetis/TWR-K64F120M.html
- http://www.utasker.com/kinetis/TEENSY_3.5.html
- http://www.utasker.com/kinetis/Hexiwear-K64F.html
For less questions and faster, cheaper developments: try uTasker for Kinetis
Thank you for the clarification, Mark. That's what I thought.
Regards,
Léo