Hi all,
I am trying to program the SCT timer in the LPC845brk to output a PWM waveform to PIO1_0.
Can you help me to understand why the SCTtimer does not run? I see that the counter register keeps staying at zero.
This is my initialization function
Basically I followed the manual and the AN11538 but there must be still something that I am missing.
Thanks
已解决! 转到解答。
Hello @tomato,
First of all, could you please check if you are having a change in PINASSIGN_DATA[7]?
Replicating your possible error, the PINASSIGN_DATA[7] was not modifying. You should clear the register, and then assign SCT_OUT0 to pin PIO1_0.
Here is an example:
Let us know if this helps you.
Also, you could try testing the SCT examples in MCUXpresso IDE with the SDK LPC845 or LPC845BREAKOUT.
The SCTimer Simple PWM example is a simple demonstration program of the SDK SCTimer driver capability to generate PWM signals.
It may be useful to try it out, and then made some changes according to what you need.
Best regards, Raul.
Hi @RaRo
I was doing some tests on my code and I discovered that changing this register
SYSCON->SCTCLKDIV=2; // SCT clock divider
does not affect the PWM period that I am generating.
Can you help to understand why ?
I see this in the manual
Even if I put zero in this field the PWM keeps working.
Best regards
Hello @tomato,
For modifying the period of the PWM signal, you should change the MATCHREL[0].
[AN11538. Chapter 6. Simple PWM]
The SCTCLKDIV may be affecting directly the behavior of the PWM only if you are using CKSEL as 8 or 9.
[LPC84x User Manual. Chapter 21. SCTimer/PWM. Table 387 SCTimer/PWM CONFIG register]
Regards, Raul.
Hi raul,
Thanks a lot for the quick and useful reply.
As you said I forgot to clear the PINASSIGN_DATA[7] register.
However there should be another problem that makes the SCTtimer to not start (COUNT register keeps staying at zero).
If I try to write to the COUNT register the value is not modified. The SCT clock enable bit is asserted and SCT clocked by main clock
What do you think about this? Did I forget anything else in the SCT initialization?
Best regards