Hi, I try to set PWM for esc brushless motor which work on 50Hz by using sdk 2.0 and simply pwm example I couldn't achieve it. Could someone post how to configure it?
I use FRDM KL26Z.
If you would like to control a BLDC, I suggest you use a Kinetis processor with FTM module instead of TPM, as you know that the PWM generator module should have inverting/masking function when you control a BLDC motor, BTW, the PWM generator should have Fault function in order to disable pwm signals once over cruuent/voltage occur, but the TPM module is difficult to implement the above function.
Thanks a lot for your answer. I will use different processor for my project but I want to check if it is possible to generate 50Hz (20ms period) pwm signal (because such signal use esc controllers ). I changed the period in TPM_SetupPwm() and I can generate only 400Hz as the smallest. It's normal for TPM and I need FTM to generate 50Hz?
As you know that the PWM is a divider, the TPM_MOD register is 16 bits register, it's maximum value is 65535. If you use 48MHz clock to drive TPM module, set TPM in edge-alignment mode, and set the PS bits in 3b'111, the mimimum PWM signal frequency is 48MHz/(128*65535)=5.72Hz.
If you want to generate 50HZ PWM signal in edge-alignment mode, assume that you use 48MHz clock signal to drive TPM module and set the PS bits in TPMx_SC as 3b'111(128 divider).
In other words, in the condition:edge-alignment mode, TPM driving clock is 48MHz, set the PS bits in TPM_SC as 111 in binary, set the TPM_MOD as 7500, you will get 50HZ PWM signal.
Hope it can help you.
You can use the following code:
/* Initialize TPM module */
tpmInfo.prescale = kTPM_Prescale_Divide_128;
PM_SetupPwm(BOARD_TPM_BASEADDR, tpmParam, 2U, kTPM_EdgeAlignedPwm, 50U, TPM_SOURCE_CLOCK);
Hi, thanks for your help, now it works probably the problem was with prescaler because everything else i have the same thanks for the explanation
Retrieving data ...