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.

CCS/TMS570LC4357: Timer interrupt using HET module.

Part Number: TMS570LC4357
Other Parts Discussed in Thread: HALCOGEN

Tool/software: Code Composer Studio

Hi,

I am new to Hercules mcu series. I am having prior experience with c2000 series and msp series. I was trying to make a timer isr like cpu timer interrupt in c2000 mcus. I saw few threads in this forum which says that it will be easy to implement timer isr using het. But I couldn't figure out how to implement it correctly. 

I was trying to implement it using HET pwm interrupt with  pwmEND_OF_PERIOD trigger without enabling it to IO pins in halcogen. I am having few quetions.

1) is that the correct way to implement a timer interrupt?

3) when we configure pwm period 1000us in halcogen, it shows the actual period will be 1000.106us. So is that the actual time period that the interrupt runs?

2) what is the different between HET and RTI? and what is the most suitable way to configure the timer interrupt.

My testing code as below,

thanks

/* USER CODE BEGIN (0) */
#include "HL_gio.h"
#include "stdio.h"
#include "HL_system.h"
#include "HL_het.h"
/* USER CODE END */

/* Include Files */

#include "HL_sys_common.h"

/* USER CODE BEGIN (1) */
/* USER CODE END */

/** @fn void main(void)
* @brief Application main function
* @note This function is empty by default.
*
* This function is called after startup.
* The user can use this function to implement the application.
*/

/* USER CODE BEGIN (2) */
int i = 0;
int giob4 = 0;
int hetIsr = 0;
/* USER CODE END */

int main(void)
{
/* USER CODE BEGIN (3) */
_enable_IRQ_interrupt_();
gioInit();
hetInit();
gioEnableNotification(gioPORTB, 4);
pwmEnableNotification(hetREG1, pwm0, pwmEND_OF_PERIOD);

// printf("test console print");

while(1){
giob4 = gioGetBit(gioPORTB, 4);
// printf("\n .");
if(giob4 == 0){
gioSetBit(gioPORTB, 6, 1);
}else{
gioSetBit(gioPORTB, 6, 0);
}
}
/* USER CODE END */

return 0;
}


/* USER CODE BEGIN (4) */
void gioNotification(gioPORT_t *port, uint32 bit){
printf("\n GioISR trigger time : %d ",i);
i++;

}

void pwmNotification(hetBASE_t * hetREG,uint32 pwm, uint32 notification){
hetIsr++;
printf("\n HetISR trigger time : %d ",hetIsr);
}
/* USER CODE END */

  • Hello Lakshan,

    1. Using NHET PWM is one way to generate event timer. The simplest approach is to use RTI compare. The RTI module on LC4357 has 4 compare functions, so you can generate 2 ticks or 4 interval timers.

    2. Since ECMP opposite pin actions are always synchronized to the loop resolution clock., the PWM period is multiple of LRP. The maximum difference from the real PWM period is one LRP. If the 05.*LRP in your design is 853.33ns, 1000us period will take 1172 LRP.

    3. I prefer to use RTI