I'm currently struggling with the SCT, which I need to use for PWM generation.
I tried the LPCopen function:
Chip_SCTPWM_SetRate(LPC_SCT_T *pSCT, uint32_t freq);
It calculates a rate and writes it to the match reload register 0:
rate = Chip_Clock_GetRate(CLK_MX_SCT) / freq;
Chip_SCT_SetMatchReload(pSCT, SCT_MATCH_0, rate);
The chip clock is 204MHz and the requested PWM frequency (freq) is 48MHz.
204 / 48 = 4.25
The decimals are of course lost and I end up with a frequency of 40.8MHz (204 / (4+1))
The next step I can reach using this function is 51MHz.
Is there a way to get 48MHz output frequency using directly the SCT registers, without LPCopen?
Thanks for any hint.
Edit:
The frequencies are not multiples, the clock can only be divided, there is only one internal clock source for SCT.
It's not possible to generate PWM @ 48 MHz.
Hi quex,
Yes, just as your edit content.
Because 204/48=4.25, it not multiples, then you can't generate the 48Mhz directly.
If you want to generate the 48Mhz, I think you need to change the SCT module clock, which can be muliple by 48Mhz.
Wish it helps you!
Have a great day,
Kerry
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------