System clock as FTM source on K64?

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

System clock as FTM source on K64?

ソリューションへジャンプ
1,407件の閲覧回数
leo_thirifays
Contributor I

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.

2018-09-18 10_38_33-Combi-Meas - A0630-CB_MCUXpresso_project_source_A0630-CB.c - MCUXpresso IDE.png

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.

2018-09-18 10_38_04-Combi-Meas - A0630-CB_MCUXpresso_project_source_A0630-CB.c - MCUXpresso IDE.png

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

2018-09-18 10_37_45-K64 manual.pdf - Adobe Acrobat Reader DC.png

The K64 manual on Chapter 40.3.3, page 988

2018-09-18 10_42_01-Combi-Meas - A0630-CB_MCUXpresso_project_board_peripherals.h - MCUXpresso IDE.png

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

ラベル(1)
0 件の賞賛
返信
1 解決策
1,108件の閲覧回数
mjbcswitzerland
Specialist V

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

元の投稿で解決策を見る

2 返答(返信)
1,109件の閲覧回数
mjbcswitzerland
Specialist V

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

1,108件の閲覧回数
leo_thirifays
Contributor I

Thank you for the clarification, Mark. That's what I thought.

Regards,

Léo

0 件の賞賛
返信