Hello,
I want to calculate the PWM clock frequency by Cortex-M4. Current setup is with SDK default values which is 32kHz clock frequency which I also verified by measurement.
I read out the PWM clock frequency with
CLOCK_GetClockRootFreq(kCLOCK_Pwm1ClkRoot)
which gives me 24MHz. This function also seems to take the pre/post dividers into account. Now I'm a bit confused because according to the clock tree figure on reference manual rev.3, page 315 there's no 32k clock source which can be assigned to PWM blocks by multiplexer.
What is the correct procedure to calculate the clock frequency with SDK functions?
Regards
已解决! 转到解答。
Got it, I was using this as reference.
But it is better to use this reference manual (2.14), this information matches to this case.
As you said, there is no direct 32K clock source which can be assigned to PWM blocks by multiplexer, but some of the clock sources comes from the clock control module.
And according to fsl_pwm.h, these are the definitions to the clock sources:
Best regards.
Hello @JorgeCas
this is interesting - my SDK manual shows the following:
This also fits to the device reference manual:
Your SDK information doesn't mention the 32kHz frequency? Which SDK version are you using?
Regards
Got it, I was using this as reference.
But it is better to use this reference manual (2.14), this information matches to this case.
As you said, there is no direct 32K clock source which can be assigned to PWM blocks by multiplexer, but some of the clock sources comes from the clock control module.
And according to fsl_pwm.h, these are the definitions to the clock sources:
Best regards.
Hello,
The clock source for PWM can be configured with kPWM_LowFrequencyClock that corresponds to 32.768 KHz.
But it seems that the function is returning the value of the bus clock.
I suggest you check the value of struct pwm_config_t on clockSource to check the clock source for the counter.
Best regards.
Hello @JorgeCas
okay, I'll check the PWM configuration. But how is the relation between clock tree and the clock source from PWM configuration register? It looks like the PWM clock mechanism works "around" the clock tree?
So, ClkSrc = 0x03 uses a dedicated 32.768 Hz clock which is not part of the clock tree? And 0x01/0x02 are sourced from clock tree?
Regards