Hello experts,
Device: S32K142 eval board
I want to generate frequency of 6.144MHz with 50% duty cycle. For that I tried using FTM_PWM but it is giving delta on output. I entered 6.144MHz in configurator but output side it is giving 6.4MHz.I want to over come this delta and need pure frequency.
Please share sample code or configured code for this requirement.
I don't want to generate frequency on CLKOUT pin.I attached configuration and output screenshot.
Solved! Go to Solution.
1. The tick value is the value that needs to be written to the register, but this value must be an integer, it cannot be a floating point number.
2. Theoretically, the larger the tick value, the higher the accuracy of the output waveform, and the corresponding waveform frequency will also decrease.
This is expected and this is not a problem with your software.
For example, if the FTM module clock is 80MHz, you can see that if you need to output 6.14Mhz PWM, you need to set it to 13.029315960912tick, but in fact you can only set it to 13 ticks
Hello @Senlent
Thanks for reply but can you also confirm for 4.096MHz frequency?
and which tool are you using? I'm using S32design studio 3.4
Regards,
Mohit
How to get this tick value and validate with frequency with peripheral clock?
How to find threshold of tick counts?
ticks = FTM_SOURCE_CLOCK / Expected output frequency
for example:FTM SOURCE CLOCK is 80MHz, expected output frequency is 4.096Mhz
ticks = 80Mhz / 4.096Mhz = 19.53125 ticks.
my FTM source clock is 48MHz and required freq is 6.144 then tick is calculated as 7.8125.
but is there any limit that calculated tick should not cross specific level?
1. The tick value is the value that needs to be written to the register, but this value must be an integer, it cannot be a floating point number.
2. Theoretically, the larger the tick value, the higher the accuracy of the output waveform, and the corresponding waveform frequency will also decrease.
Hello,
Thanks for quick and fruitful replies.
in last, can you suggest any other method or option to achieve this requirement?
Regards,
Mohit Manvar
Usually FTM modules are used for motor control, and motor applications don't actually require such high PWM frequencies.
Through the above formula, I think you already know the disadvantage of its high output frequency.
Simply put, it is unable to accurately output 6.144MHz and 4.096MHz.