Strage pulse from FTM

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Strage pulse from FTM

737 Views
kiyoshimatsuzak
Contributor III

Hi, all.

I created our original board with Kinetis K64F, then I build software using KSDK1.2.

This softwave generated clock pulse from FTM0 and the frequency is changed every 20msec.

I checked wave form and I got some strange pulses.(please see atached image)

The pulse at the left side is correct. The smaller pulse at the center is incorrect.

There are two strange points about the pulse at the center.

1.

Software didn't set this frequency.

2.

Eventhough the software set this frequency, I think pulse has to be 3.3V, but this strange pulse is 1.6V.

I would like a reason of this strange pulse.

If you have any advises, suggestions, etc, please let me know.

Best regards,

Kiyoshi Matsuzaki

0 Kudos
3 Replies

515 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi, Kiyoshi,

First of all, can you use the latest SDK2.0 software package and have a test? There is FTM example for SDK2.0 and FRDM-K64F platform.

C:\DriverE\Freescale\SDK2.0_K64F\boards\frdmk64f\demo_apps\bubble\kds

You can download the SDK2.0 for FRDM-K64F from the website:

Pls go to the website and download SDK2.0:

Welcome to Kinetis Expert | Kinetis Expert

I have checked your waveform, I think the waveform is weird. Do you set the pin in open drain mode or test the signal which is not connected to the pin directly? Do you change the example code?

anyway, pls refer to the example in SDK2.0, if you still have issue for your code, pls attach your code and tell us the pins you get the waveform so that we can have a debug.

BR

Xiangjun Rong

0 Kudos

515 Views
kiyoshimatsuzak
Contributor III

Hi, Xiangjun.

Thank you for your replay!

I want to try SDK2.0, but I can not use it sooner. Because I need much time to check SDK2.0.

My code is below. (I simplified )

If you have any advices, please let me know.

1.Start Function (Called at starting)

void Start(void)

{

    param->uFrequencyHZ = 500;

    param->uDutyCyclePercent = 50;

    FTM_DRV_PwmStop(FTM_0, param, CH_3);

    FTM_DRV_PwmStart(FTM_0, param, CH_3);

    FTM_DRV_SetTimeOverflowIntCmd(FTM_0, 1);

}

2.Frequency Change Function (Called every 20msec)

void ChangeFreq(void)

{

    param->uFrequencyHZ = 500;

    FTM_DRV_PwmStop(FTM_0, param, CH_3);

    FTM_DRV_PwmStart(FTM_0, param, CH_3);

    FTM_DRV_SetTimeOverflowIntCmd(FTM_0, 1);

}

Best Regards,

Kiyoshi Matsuzaki

0 Kudos

515 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi, Kiyoshi,

If you want to update the duty cycle and frequency of PWM signals while PWM is running, I suggest you use the function:

static void Board_UpdatePwm(uint16_t x, uint16_t y)

{

    /* Start PWM mode with updated duty cycle */

    FTM_UpdatePwmDutycycle(BOARD_FTM_BASEADDR, (ftm_chnl_t)BOARD_FIRST_TIMER_CHANNEL, kFTM_EdgeAlignedPwm, x);

    FTM_UpdatePwmDutycycle(BOARD_FTM_BASEADDR, (ftm_chnl_t)BOARD_SECOND_TIMER_CHANNEL, kFTM_EdgeAlignedPwm, y);

    /* Software trigger to update registers */

    FTM_SetSoftwareTrigger(BOARD_FTM_BASEADDR, true);

}

The above function is defined in the directory:

C:\Freescale\SDK2.0_K64F\boards\frdmk64f\demo_apps\bubble

Hope it can help you.

BR

XiangJun Rong

0 Kudos