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.
已解决! 转到解答。
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
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.
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.
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.