This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

MSPM0L1306: How to invoke the interrupt of TIMG4?

Part Number: MSPM0L1306
Other Parts Discussed in Thread: , SYSCONFIG

i was trying to use TIMG4 in my project, so i modified the code base on 'pwm_led_driver_LP_MSPM0L1306_nortos_ticlang' from mspm0_sdk_1_30_00_03.

Before the modification, i debugged the sample on LP-MSPM0L1306. 

the code could run into the interrupt of  void PWM_0_INST_IRQHandler(void)

then i used system configuration to add TIMG4.

i encountered one issue, i coundn't select the TIMER.

in order to use TIMG4, i enabled all TIMERs of L1306, so would you please kindly let me know how to assign peripheral(for example just use TIMG4 only) in the system configuration?

From the following code, i learnt the TIMG4 was assigned to PWM_1_INST.

/* Defines for PWM_1 */
#define PWM_1_INST                                                         TIMG4

so i added the Initialization code for TIMG4 in MAIN.

int main(void) {
  SYSCFG_DL_init();

  NVIC_EnableIRQ(PWM_0_INST_INT_IRQN);
  NVIC_EnableIRQ(PWM_1_INST_INT_IRQN);

  DL_TimerG_startCounter(PWM_0_INST);
  DL_TimerG_startCounter(PWM_1_INST);

  while (1) {
    __WFI();
  }
}
and added the TIMG4 IRQHandler.
void PWM_1_INST_IRQHandler(void) {
  switch (DL_TimerG_getPendingInterrupt(PWM_1_INST)) {
  case DL_TIMER_IIDX_LOAD:
    if (dc1 <= 10) {
      mode1 = 1;
    } // if reached lowest dc (10%), increase dc
    else if (dc1 >= 90) {
      mode1 = 0;
    } // if reached highest dc (90%), decrease dc
    if (mode1) {
      pwm_count1 -= 20;
      dc1 += 1;
    } // up
    if (!mode1) {
      pwm_count1 += 20;
      dc1 -= 1;
    } // down
    DL_TimerG_setCaptureCompareValue(PWM_1_INST, pwm_count1,
                                     DL_TIMER_CC_0_INDEX); // update ccr0 value                                    
    break;
  default:
    break;
  }
}

 the code is compiled OK, and i begun to debug this code on LP-MSPM0L1306.

Unfortunately, the interrupt of TIMG4 was not invoked.

the code will not run into  'void PWM_1_INST_IRQHandler(void).'

would you please kindly help check how to make the code work for TIMG4?

and i attached the code here.

pwm_led_driver_LP_MSPM0L1306_nortos_ticlang.zip

many thanks.

BR

Kelly