AnsweredAssumed Answered

kSCTIMER_Out_* doesn't work except for kSCTIMER_Out_2 and kSCTIMER_Out_4

Question asked by Jenny Rendall on Oct 10, 2018
Latest reply on Oct 11, 2018 by Kerry Zhou

I am looking at the sctimer_simple_pwm example provided for lpc54018.

According to the pin table for UM11079. for J11 area, the Sctimer output and pin correspondence are

 

Index Pin  SCTimer_OUT

1       2_2    6

2       3_28  2

3       3_14  4

4       3_10  3

....

 

The provided example is

 

 

#define DEMO_FIRST_SCTIMER_OUT kSCTIMER_Out_4

#define DEMO_SECOND_SCTIMER_OUT kSCTIMER_Out_2

 

 

 

int main(void)

{

    sctimer_config_t sctimerInfo;

    sctimer_pwm_signal_param_t pwmParam;

    uint32_t event;

    uint32_t sctimerClock;

 

    /* Board pin, clock, debug console init */

    /* attach 12 MHz clock to FLEXCOMM0 (debug console) */

    CLOCK_AttachClk(BOARD_DEBUG_UART_CLK_ATTACH);

 

    BOARD_InitPins();

    BOARD_BootClockFROHF96M();

    BOARD_InitDebugConsole();

 

    sctimerClock = SCTIMER_CLK_FREQ;

 

    SCTIMER_GetDefaultConfig(&sctimerInfo);

 

    /* Initialize SCTimer module */

    SCTIMER_Init(SCT0, &sctimerInfo);

 

    /* Configure first PWM with frequency 24kHZ from first output */

    pwmParam.output = DEMO_FIRST_SCTIMER_OUT;

    pwmParam.level = kSCTIMER_HighTrue;

    pwmParam.dutyCyclePercent = 50;

    if (SCTIMER_SetupPwm(SCT0, &pwmParam, kSCTIMER_CenterAlignedPwm, 24000U, sctimerClock, &event) == kStatus_Fail)

    {

        return -1;

    }

 

    /* Configure second PWM with different duty cycle but same frequency as before */

    pwmParam.output = DEMO_SECOND_SCTIMER_OUT;

    pwmParam.level = kSCTIMER_LowTrue;

    pwmParam.dutyCyclePercent = 20;

    if (SCTIMER_SetupPwm(SCT0, &pwmParam, kSCTIMER_CenterAlignedPwm, 24000U, sctimerClock, &event) == kStatus_Fail)

    {

        return -1;

    }

 

    /* Start the timer */

    SCTIMER_StartTimer(SCT0, kSCTIMER_Counter_L);

 

    while (1)

    {

    }

}

 

 

And it worked.

However, if I change kSCTIMER_Out_4 into kSCTIMER_Out_6 or kSCTIMER_Out_3, and plug the LED into the corresponding pinholes, the LED is not flickering.

 

Why only kSCTIMER_Out_4 and kSCTIMER_Out_2 works? How may I use the rest of the pinholes? (I need a third pinhole to PWM a tricolor LED)

 

Thanks,

Jenny

Outcomes