AnsweredAssumed Answered

LPC845 SCTimer/PWM

Question asked by Владимир Орлов on Sep 10, 2019
Latest reply on Sep 23, 2019 by Omar Anguiano

Good day.
For the initial setup of the LPC845, I use MCUXpresso Config Tools. I need to configure SCTimer/PWM as PWM in two outputs and multiple events mode (OUT_0 use 2 events, OUT_1 use 4 events). All events is "Match event only". The program throws an error "Number of events exceeds 8 events supported by peripheral SCT0 (each PWM signal internally allocates 2 events)." Is it true? Or can I configure multiple events on one output manually? For example:

 

const sctimer_pwm_signal_param_t SCTimer_0_pwmSignalsConfig[2] = {
  {
    .output = kSCTIMER_Out_0,
    .level = kSCTIMER_LowTrue,
    .dutyCyclePercent = 0
  },
  {
    .output = kSCTIMER_Out_1,
    .level = kSCTIMER_LowTrue,
    .dutyCyclePercent = 0
  }
};

 

void SCTimer_0_init(void)
{
  SCTIMER_Init(SCTIMER_0_PERIPHERAL, &SCTimer_0_initConfig);
  // OUT_0, 2 events
  SCTIMER_SetupPwm(SCTIMER_0_PERIPHERAL, &SCTimer_0_pwmSignalsConfig[0], kSCTIMER_EdgeAlignedPwm, DEF_M_FRQ, SCTIMER_0_CLOCK_FREQ, &SCTimer_0_pwmEvent[0]);
  SCTIMER_CreateAndScheduleEvent(SCTIMER_0_PERIPHERAL, kSCTIMER_MatchEventOnly, 6000, kSCTIMER_Out_0, kSCTIMER_Counter_L, &SCTimer_0_event[0]);
  SCTIMER_SetupOutputSetAction(SCTIMER_0_PERIPHERAL, kSCTIMER_Out_0, SCTimer_0_event[0]);
  SCTIMER_CreateAndScheduleEvent(SCTIMER_0_PERIPHERAL, kSCTIMER_MatchEventOnly, 12000, kSCTIMER_Out_0, kSCTIMER_Counter_L, &SCTimer_0_event[5]);
  SCTIMER_SetupOutputClearAction(SCTIMER_0_PERIPHERAL, kSCTIMER_Out_0, SCTimer_0_event[5]);
  SCTIMER_IncreaseState(SCTIMER_0_PERIPHERAL);
  // OUT_1, 4 events
  SCTIMER_SetupPwm(SCTIMER_0_PERIPHERAL, &SCTimer_0_pwmSignalsConfig[1], kSCTIMER_EdgeAlignedPwm, DEF_M_FRQ, SCTIMER_0_CLOCK_FREQ, &SCTimer_0_pwmEvent[1]);
  SCTIMER_ScheduleEvent(SCTIMER_0_PERIPHERAL, SCTimer_0_event[0]);
  SCTIMER_CreateAndScheduleEvent(SCTIMER_0_PERIPHERAL, kSCTIMER_MatchEventOnly, 25, kSCTIMER_Out_0, kSCTIMER_Counter_L, &SCTimer_0_event[1]);
  SCTIMER_SetupOutputSetAction(SCTIMER_0_PERIPHERAL, kSCTIMER_Out_1, SCTimer_0_event[1]);
  SCTIMER_CreateAndScheduleEvent(SCTIMER_0_PERIPHERAL, kSCTIMER_MatchEventOnly, 5975, kSCTIMER_Out_0, kSCTIMER_Counter_L, &SCTimer_0_event[2]);
  SCTIMER_SetupOutputClearAction(SCTIMER_0_PERIPHERAL, kSCTIMER_Out_1, SCTimer_0_event[2]);
  SCTIMER_CreateAndScheduleEvent(SCTIMER_0_PERIPHERAL, kSCTIMER_MatchEventOnly, 6025, kSCTIMER_Out_0, kSCTIMER_Counter_L, &SCTimer_0_event[3]);
  SCTIMER_SetupOutputSetAction(SCTIMER_0_PERIPHERAL, kSCTIMER_Out_1, SCTimer_0_event[3]);
  SCTIMER_CreateAndScheduleEvent(SCTIMER_0_PERIPHERAL, kSCTIMER_MatchEventOnly, 11975, kSCTIMER_Out_0, kSCTIMER_Counter_L, &SCTimer_0_event[4]);
  SCTIMER_SetupOutputClearAction(SCTIMER_0_PERIPHERAL, kSCTIMER_Out_1, SCTimer_0_event[4]);
}

Outcomes