Hello,
I am using MR-CANHUB board with S32K344 in Q172 package config and S32DS IDE.
I have to generate resolver PWM signals and their complementary with 200 Hz and 20% duty-cycle.
I was able to get the 20% duty-cycle working. However, the freq of the signal is around 147 Hz, instead of 200 Hz.
On the attached logic analyzer capture - Ch11 - PTA0, Ch12 - PTA1, Ch 13 - PTA2 and CH14 - PTA3.
PTA1 is complementary of PTA0 and PTA2 is complementary of PTA3. In other words, PTA1 is inverted of PTA0 and PTA2 is inverted of PTA3. Both PTA3 and PTA2 are generating PWMs at fixed - 200Hz and 20% duty-cycle.
Here is the calculation, I did to get 200 Hz (which is not working) and 20% dc.
CoreClk = 48 Mhz
Using this formula: PWM frequency = CORE_CLK / global prescaler / internal prescaler / (B1+1), I have the following settings:
200 Hz = 48 Mhz / 16 / 6 / (2499 + 1)
However, what I get is ~147 Hz.
Please tell me what I may have missed. Also attaching code for reference.